author | Claus Gittinger <cg@exept.de> |
Fri, 23 Aug 2013 12:05:53 +0200 | |
changeset 4332 | 601cf68cb5a4 |
parent 4331 | 7c89cfb5b3a4 |
child 4335 | 5c5fd7a5565b |
permissions | -rw-r--r-- |
542 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1818 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
542 | 14 |
Object subclass:#DataSetColumn |
3775 | 15 |
instanceVariableNames:'columnNumber dataSet width description buttonExtent rendererType |
16 |
backgroundColor foregroundColor rowSeparatorSelector |
|
17 |
showColSeparator showRowSeparator columnAlignment label |
|
18 |
containsText columnAdaptor descWidth descMinWidth |
|
19 |
longStringCompression minValue maxValue' |
|
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Views-DataSet' |
|
542 | 23 |
! |
24 |
||
25 |
!DataSetColumn class methodsFor:'documentation'! |
|
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
||
40 |
||
41 |
||
42 |
! |
|
43 |
||
44 |
documentation |
|
45 |
" |
|
46 |
represent one single column description of a DataSetView |
|
47 |
||
48 |
[Instance variables:] |
|
49 |
||
647 | 50 |
columnNumber <Integer> sequence number (into list of columns) |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
51 |
|
542 | 52 |
dataSet <DSVColumnView> the view it belongs to |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
53 |
|
1088 | 54 |
width <Integer> width of column |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
55 |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
56 |
description <DataSetColumnSpec> the column description (a spec) |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
57 |
|
1088 | 58 |
buttonExtent <Point> extent of drawable form |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
59 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
60 |
rendererType <Type> renderer type (cached value from |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
61 |
the column specification). |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
62 |
|
647 | 63 |
backgroundColor <Color or nil> background color of all cells or nil |
64 |
(nil: use default background color). |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
65 |
|
647 | 66 |
foregroundColor <Color or nil> foreground color of all cells or nil |
67 |
(nil: use default foreground color). |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
68 |
|
1088 | 69 |
columnAlignment <Symbol> align text/icon #left #right or #center |
70 |
in row (on default: #left). |
|
71 |
||
72 |
label <label/icon or nil> label resolved by the builder shown |
|
73 |
in the column description field. |
|
74 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
75 |
readSelector <Symbol> cached readSelector (from the spec) |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
76 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
77 |
columnAdaptor <nil or any> if non-nil, that one is asked (via |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
78 |
read-writeSelectors to extract a column |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
79 |
from a row object. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
80 |
If nil, the row object is used itself. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
81 |
|
1113 | 82 |
showColSeparator <Boolean> true: vertical separators are enabled; |
83 |
separator between columns |
|
84 |
||
85 |
showRowSeparator <Boolean> true: horizontal separators are enabled; |
|
86 |
separator between rows |
|
87 |
||
88 |
rowSeparatorSelector <Selector or nil> access specific showRowSeparator state |
|
89 |
for a cell |
|
542 | 90 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
91 |
[from description:] |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
92 |
fgSelector <Selector or nil> access specific foreground color for |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
93 |
a cell |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
94 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
95 |
bgSelector <Selector or nil> access specific background color for |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
96 |
a cell |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
97 |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
98 |
numberOfRowsProbedForColumnSize the number of rows which are queries |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
99 |
<Integer> in order to compute the columns width. |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
100 |
(for scrollBar/col width computation) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
101 |
Notice, if its expensive to fetch rows |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
102 |
(dataBase apps), this should be small. |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
103 |
Default:15 |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
104 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
105 |
|
542 | 106 |
[author:] |
107 |
Claus Atzkern |
|
108 |
||
109 |
[see also:] |
|
110 |
DataSetColumnSpec |
|
111 |
DSVColumnView |
|
112 |
DataSetView |
|
113 |
" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
114 |
! ! |
542 | 115 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
116 |
!DataSetColumn class methodsFor:'utilities'! |
542 | 117 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
118 |
shortenedStringFor:aString on:aGC maxWidth:maxWidth |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
119 |
"common code to shorten a string; used in both the DSV label- and column Views, |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
120 |
if the string is too long for the column" |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
121 |
|
2221 | 122 |
|widthOf3Dots wRest shortenedLabel lUsed lMin lMax| |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
123 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
124 |
aString isString ifFalse:[^ aString]. |
4234 | 125 |
(aString widthOn:aGC) <= maxWidth ifTrue:[^ aString]. |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
126 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
127 |
widthOf3Dots := '...' widthOn:aGC. |
2221 | 128 |
|
129 |
lMin := 1. |
|
130 |
lMax := aString size. |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
131 |
[ |
2221 | 132 |
lUsed := (lMax + lMin) // 2. |
133 |
wRest := aString widthFrom:1 to:lUsed on:aGC. |
|
134 |
wRest > (maxWidth-widthOf3Dots) ifTrue:[ |
|
135 |
lMax := lUsed - 1. |
|
136 |
] ifFalse:[ |
|
137 |
lMin := lUsed + 1. |
|
138 |
]. |
|
139 |
lMin < lMax |
|
140 |
] whileTrue. |
|
141 |
shortenedLabel := aString copyFrom:1 to:lUsed. |
|
142 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
143 |
shortenedLabel isEmpty ifTrue:[ |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
144 |
((aString first asString , '..') widthOn:aGC) < maxWidth ifTrue:[ |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
145 |
"/ only two dots and the first character |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
146 |
^ (aString first asString , '..') |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
147 |
] |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
148 |
]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
149 |
^ (shortenedLabel , '...'). |
542 | 150 |
! ! |
151 |
||
152 |
!DataSetColumn methodsFor:'accessing'! |
|
153 |
||
3211 | 154 |
activeHelpText |
155 |
"get the active helpText or nil" |
|
156 |
||
157 |
|app key| |
|
158 |
||
3869 | 159 |
((key := description activeHelpKey) notEmptyOrNil |
3211 | 160 |
and:[(app := dataSet application) notNil]) ifTrue:[ |
3869 | 161 |
^ app flyByHelpTextForKey:key asSymbol. |
3211 | 162 |
]. |
3218 | 163 |
^ nil |
3211 | 164 |
|
165 |
"Created: / 26-03-2007 / 13:39:11 / cg" |
|
3218 | 166 |
"Modified: / 26-03-2007 / 17:51:15 / cg" |
3211 | 167 |
! |
168 |
||
3522
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
169 |
activeHelpTextForLabel |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
170 |
"get the active helpText for the label or nil" |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
171 |
|
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
172 |
|app key| |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
173 |
|
3869 | 174 |
((key := description activeHelpKeyForLabel) notEmptyOrNil |
3522
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
175 |
and:[(app := dataSet application) notNil]) ifTrue:[ |
3869 | 176 |
^ app flyByHelpTextForKey:key asSymbol. |
3522
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
177 |
]. |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
178 |
^ nil |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
179 |
|
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
180 |
"Created: / 26-03-2007 / 13:39:11 / cg" |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
181 |
"Modified: / 26-03-2007 / 17:51:15 / cg" |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
182 |
! |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
183 |
|
3459 | 184 |
activeHelpTextForRow:rowNr |
185 |
"get the active helpText or nil" |
|
186 |
||
187 |
|app key| |
|
188 |
||
3460 | 189 |
((key := description activeHelpKey) notEmptyOrNil |
3459 | 190 |
and:[(app := dataSet application) notNil]) ifTrue:[ |
3511 | 191 |
^ app flyByHelpTextForKey:key asSymbol row:rowNr. |
3459 | 192 |
]. |
193 |
^ nil |
|
194 |
||
195 |
"Created: / 26-03-2007 / 13:39:11 / cg" |
|
196 |
"Modified: / 26-03-2007 / 17:51:15 / cg" |
|
197 |
! |
|
198 |
||
542 | 199 |
at:aRowNr |
3505 | 200 |
"get the value of the cell at the row index, aRowNr" |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
201 |
|
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
202 |
|row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
203 |
|
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
204 |
row := dataSet at:aRowNr. |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
205 |
^ self extractColFromRow:row rowNr:aRowNr. |
542 | 206 |
! |
207 |
||
208 |
at:aRowNr put:something |
|
3505 | 209 |
"set the value of the cell at the row index, aRowNr" |
210 |
||
211 |
|row| |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
212 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
213 |
row := dataSet at:aRowNr. |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
214 |
self storeCol:something inRow:row. |
542 | 215 |
! |
216 |
||
1558
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
217 |
columnAdaptor |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
218 |
^ columnAdaptor |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
219 |
! |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
220 |
|
1712 | 221 |
columnAdaptor:anAdapter |
222 |
columnAdaptor := anAdapter. |
|
223 |
! |
|
224 |
||
3505 | 225 |
columnNumber |
226 |
^ columnNumber |
|
227 |
! |
|
228 |
||
807 | 229 |
description |
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
230 |
"returns the column spec |
807 | 231 |
" |
232 |
^ description |
|
233 |
! |
|
234 |
||
542 | 235 |
label |
236 |
"get the label assigned to the column |
|
237 |
" |
|
891 | 238 |
^ label |
542 | 239 |
|
240 |
||
241 |
! |
|
242 |
||
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
243 |
longStringCompression:aBoolean |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
244 |
^ longStringCompression ? true |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
245 |
! |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
246 |
|
1487 | 247 |
rendererType |
248 |
"returns my renderer type |
|
249 |
" |
|
250 |
^ rendererType |
|
251 |
! ! |
|
252 |
||
1818 | 253 |
!DataSetColumn methodsFor:'accessing-colors'! |
1565 | 254 |
|
255 |
backgroundColor |
|
256 |
"returns the background color or nil |
|
257 |
" |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
258 |
^ backgroundColor == dataSet backgroundColor ifTrue:[nil] ifFalse:[backgroundColor] |
1565 | 259 |
! |
260 |
||
2693 | 261 |
backgroundColor: aColor |
262 |
backgroundColor := aColor |
|
263 |
! |
|
264 |
||
1565 | 265 |
backgroundColorAt:aRowNr |
266 |
"returns the background color for a row at list index a rowNr |
|
267 |
" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
268 |
description backgroundSelector notNil ifTrue:[ |
1565 | 269 |
^ self backgroundColorFor:(dataSet at:aRowNr) at:aRowNr |
270 |
]. |
|
271 |
^ backgroundColor |
|
272 |
! |
|
273 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
274 |
backgroundColorFor:aRow at:aRowNr |
2727
5cb5708a6982
No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
275 |
"return the background color for a row at list index a rowNr" |
5cb5708a6982
No extra handling needed for LimitedPrecisionReal
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
276 |
|
3210 | 277 |
"/ backgroundColor has already been fetched from description/dataSet (see #initialize) |
278 |
^ self |
|
279 |
colorFor:aRow at:aRowNr |
|
280 |
descriptionSelector:(description backgroundSelector) |
|
281 |
descriptionColor:backgroundColor |
|
282 |
dataSetDefaultColor:nil |
|
1565 | 283 |
|
3210 | 284 |
"Modified: / 26-03-2007 / 13:27:19 / cg" |
285 |
! |
|
286 |
||
287 |
colorFor:aRow at:aRowNr descriptionSelector:descriptionSelector descriptionColor:descriptionColor dataSetDefaultColor:dataSetColor |
|
288 |
"common code for returning a color for a row at list index a rowNr, asking both description and dataSet as fallBack" |
|
289 |
||
290 |
|clr| |
|
291 |
||
292 |
descriptionSelector notNil ifTrue:[ |
|
1924 | 293 |
columnAdaptor notNil ifTrue:[ |
3210 | 294 |
clr := columnAdaptor perform:descriptionSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet |
1565 | 295 |
] ifFalse:[ |
3210 | 296 |
clr := aRow perform:descriptionSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
1565 | 297 |
]. |
3210 | 298 |
clr notNil ifTrue:[ |
299 |
(clr isColor or:[clr isImageOrForm]) ifTrue:[ |
|
300 |
^ clr |
|
1928
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
301 |
]. |
3210 | 302 |
self error:'unexpected color (not a color or image)'. |
1928
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
303 |
] |
1565 | 304 |
]. |
3210 | 305 |
^ descriptionColor ? dataSetColor |
306 |
||
307 |
"Created: / 26-03-2007 / 13:05:24 / cg" |
|
1565 | 308 |
! |
309 |
||
310 |
foregroundColor |
|
311 |
"returns the foreground color or nil |
|
312 |
" |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
313 |
^ foregroundColor == dataSet foregroundColor ifTrue:[nil] ifFalse:[foregroundColor] |
1565 | 314 |
! |
315 |
||
2693 | 316 |
foregroundColor: aColor |
317 |
foregroundColor := aColor |
|
318 |
! |
|
319 |
||
1565 | 320 |
foregroundColorFor:aRow at:aRowNr |
321 |
"returns the foreground color for a row at list index a rowNr |
|
322 |
" |
|
323 |
||
3210 | 324 |
"/ foregroundColor has already been fetched from description/dataSet (see #initialize) |
325 |
^ self |
|
326 |
colorFor:aRow at:aRowNr |
|
327 |
descriptionSelector:(description foregroundSelector) |
|
328 |
descriptionColor:foregroundColor |
|
329 |
dataSetDefaultColor:nil |
|
330 |
||
331 |
"Modified: / 26-03-2007 / 13:27:39 / cg" |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
332 |
! |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
333 |
|
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
334 |
selectedBackgroundColorFor:aRow at:aRowNr |
3210 | 335 |
"returns the selected background color for a row at list index a rowNr" |
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
336 |
|
3210 | 337 |
^ self |
338 |
colorFor:aRow at:aRowNr |
|
339 |
descriptionSelector:(description selectedBackgroundSelector) |
|
340 |
descriptionColor:(description selectedBackgroundColor) |
|
341 |
dataSetDefaultColor:(dataSet selectionBackgroundColor) |
|
3139 | 342 |
|
3210 | 343 |
"Modified: / 26-03-2007 / 13:06:06 / cg" |
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
344 |
! |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
345 |
|
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
346 |
selectedForegroundColorFor:aRow at:aRowNr |
3210 | 347 |
"returns the selected foreground color for a row at list index a rowNr" |
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
348 |
|
3210 | 349 |
^ self |
350 |
colorFor:aRow at:aRowNr |
|
351 |
descriptionSelector:(description selectedForegroundSelector) |
|
352 |
descriptionColor:(description selectedForegroundColor) |
|
353 |
dataSetDefaultColor:(dataSet selectionForegroundColor) |
|
354 |
||
355 |
"Modified: / 26-03-2007 / 13:05:31 / cg" |
|
3990
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
356 |
! |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
357 |
|
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
358 |
selectedFrameColorFor:aRow at:aRowNr |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
359 |
"returns the selected frame color for a row at list index a rowNr" |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
360 |
|
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
361 |
^ self |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
362 |
colorFor:aRow at:aRowNr |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
363 |
descriptionSelector:(description selectedBackgroundSelector) |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
364 |
descriptionColor:(description selectedBackgroundColor) |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
365 |
dataSetDefaultColor:(dataSet selectionFrameColor) |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
366 |
|
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
367 |
"Created: / 20-01-2011 / 08:46:32 / cg" |
1565 | 368 |
! ! |
369 |
||
1818 | 370 |
!DataSetColumn methodsFor:'accessing-dimension'! |
1487 | 371 |
|
1484 | 372 |
minWidth |
1490 | 373 |
"get the minimum width required by the column |
1484 | 374 |
" |
1490 | 375 |
descMinWidth notNil ifTrue:[ |
376 |
^ descMinWidth |
|
377 |
]. |
|
378 |
width := nil. |
|
379 |
^ self width |
|
1484 | 380 |
|
1490 | 381 |
! |
382 |
||
1492 | 383 |
minimumRequiredWidth |
384 |
"returns the minimum required width |
|
385 |
" |
|
386 |
|minWidth| |
|
387 |
||
1940 | 388 |
descMinWidth notNil ifTrue:[ |
389 |
minWidth := DSVLabelView tabSpacing max:2. |
|
390 |
^ minWidth // 2 + minWidth |
|
391 |
]. |
|
1492 | 392 |
|
1940 | 393 |
minWidth := dataSet separatorSize + (2 * dataSet horizontalSpacing). |
394 |
^ minWidth + label preferredWidth. |
|
1492 | 395 |
! |
396 |
||
1490 | 397 |
setDescWidth:aWidth |
398 |
"set a fixed width |
|
399 |
" |
|
1940 | 400 |
descMinWidth := 1. |
401 |
descMinWidth := width := descWidth := self minimumRequiredWidth max:aWidth. |
|
1484 | 402 |
! |
403 |
||
542 | 404 |
width |
405 |
"returns the width in pixels |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
406 |
Warning: |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
407 |
only the first numberOfRowsProbedForColumnSize are probed, |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
408 |
in case the access is expensive (dataBase apps) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
409 |
If the descriptor defines a width, that is used, and the items |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
410 |
are not probed at all." |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
411 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
412 |
|max "{ Class:SmallInteger }" |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
413 |
listSize "{ Class:SmallInteger }"| |
542 | 414 |
|
1484 | 415 |
width notNil ifTrue:[^ width]. "/ already computed |
542 | 416 |
|
1490 | 417 |
descMinWidth notNil ifTrue:[ |
418 |
width := descMinWidth. |
|
419 |
^ width |
|
1484 | 420 |
]. |
1482 | 421 |
|
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
422 |
(descWidth ~~ 0 and:[descWidth isLimitedPrecisionReal not]) ifTrue:[ |
1493 | 423 |
width := descMinWidth := descWidth. |
424 |
^ width |
|
425 |
]. |
|
426 |
||
1490 | 427 |
width := description minWidth max:(label preferredWidth). |
428 |
||
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
429 |
descWidth isLimitedPrecisionReal ifTrue:[ |
2093 | 430 |
width := width max:(descWidth * dataSet innerWidth) rounded. |
1490 | 431 |
^ width |
1482 | 432 |
]. |
433 |
||
1496 | 434 |
containsText ifTrue:[ |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
435 |
"/ take maximum numberOfRowsProbedForColumnSize entries to calculate the width; |
1484 | 436 |
"/ can be resized later if neccessary |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
437 |
listSize := dataSet size. |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
438 |
max := listSize min:description numberOfRowsProbedForColumnSize. |
542 | 439 |
|
1526 | 440 |
max ~~ 0 ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
441 |
1 to:max do:[:rowNr| |row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
442 |
row := dataSet at:rowNr. |
2444 | 443 |
width := width max:(self widthOfLabel:(self shownValueForRow:row rowNr:rowNr)) |
1526 | 444 |
]. |
2444 | 445 |
width := width max:(self widthOfLabel:(self shownValueForRow:(dataSet at:listSize) rowNr:listSize)) |
1484 | 446 |
]. |
447 |
description editorType ~~ #None ifTrue:[ |
|
448 |
width := width + (dataSet font widthOn:dataSet device) |
|
542 | 449 |
]. |
1493 | 450 |
] ifFalse:[ |
451 |
max := 1 |
|
1484 | 452 |
]. |
1490 | 453 |
width := width + buttonExtent x + dataSet separatorSize + (2 * dataSet horizontalSpacing). |
1493 | 454 |
|
455 |
max ~~ 0 ifTrue:[ |
|
1526 | 456 |
descMinWidth := width. |
457 |
description usePreferredWidth ifTrue:[ |
|
458 |
descWidth := width |
|
459 |
] |
|
1493 | 460 |
]. |
1490 | 461 |
^ width |
1484 | 462 |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
463 |
"Modified: / 25.2.2000 / 14:29:16 / cg" |
542 | 464 |
! ! |
465 |
||
466 |
!DataSetColumn methodsFor:'drawing'! |
|
467 |
||
3330 | 468 |
drawLabel:aLabelToDraw atX:xLeft y:yTop |
469 |
"draw aLabelToDraw; handle columnAlignment" |
|
470 |
||
471 |
|drawnLabel x space prevClip mustUndoClip cashedWidth |
|
472 |
labelWidth leftPart leftShift indexOfFirstDigit indexOfFirstNonDigit| |
|
473 |
||
474 |
cashedWidth := self width. |
|
475 |
cashedWidth isNil ifTrue:[ ^ self ]. |
|
476 |
||
477 |
space := dataSet horizontalSpacing. |
|
478 |
||
479 |
drawnLabel := aLabelToDraw. |
|
480 |
labelWidth := drawnLabel widthOn:dataSet. |
|
481 |
||
482 |
(longStringCompression ~~ false |
|
483 |
and:[ drawnLabel isString |
|
484 |
and:[ labelWidth > cashedWidth]]) ifTrue:[ |
|
485 |
drawnLabel := self class shortenedStringFor:drawnLabel on:dataSet maxWidth:cashedWidth-space. |
|
486 |
labelWidth := drawnLabel widthOn:dataSet. |
|
487 |
]. |
|
488 |
||
489 |
columnAlignment == #left ifTrue:[ |
|
490 |
x := xLeft + space. |
|
491 |
] ifFalse:[ |
|
3675
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
492 |
(columnAlignment == #decimal |
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
493 |
or:[ columnAlignment == #decimalRight ]) ifTrue:[ |
3330 | 494 |
drawnLabel := drawnLabel asString. |
495 |
(drawnLabel includes:$.) ifTrue:[ |
|
496 |
leftPart := drawnLabel upTo:$.. |
|
497 |
] ifFalse:[ |
|
498 |
leftPart := drawnLabel. |
|
499 |
||
500 |
indexOfFirstDigit := drawnLabel findFirst:[:char | char isDigit]. |
|
501 |
indexOfFirstDigit ~~ 0 ifTrue:[ |
|
502 |
indexOfFirstNonDigit := drawnLabel findFirst:[:char | char isDigit not] startingAt:indexOfFirstDigit+1. |
|
503 |
indexOfFirstNonDigit ~~ 0 ifTrue:[ |
|
504 |
leftPart := drawnLabel copyTo:indexOfFirstNonDigit-1. |
|
505 |
]. |
|
506 |
]. |
|
507 |
]. |
|
508 |
leftShift := leftPart widthOn:dataSet. |
|
3675
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
509 |
columnAlignment == #decimalRight ifTrue:[ |
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
510 |
"/ decimal at the right |
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
511 |
x := (cashedWidth) - ('9999' widthOn:dataSet) - leftShift. |
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
512 |
] ifFalse:[ |
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
513 |
"/ decimal at the middle |
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
514 |
x := (cashedWidth // 2) - leftShift. |
e0e63070a210
support a hacky form of decimalRight alignmnet
Claus Gittinger <cg@exept.de>
parents:
3674
diff
changeset
|
515 |
]. |
3330 | 516 |
] ifFalse:[ |
517 |
x := cashedWidth - labelWidth. |
|
518 |
||
519 |
columnAlignment == #right ifTrue:[x := x - space] |
|
520 |
ifFalse:[x := x // 2]. |
|
521 |
]. |
|
522 |
"/ cg: old code (did not right-align if string is larger than width |
|
523 |
"/ x := xLeft + (x max:0). |
|
524 |
||
525 |
"/ new code: always right-align. |
|
526 |
x := xLeft + x. |
|
527 |
||
528 |
"/ must clip left, if string is too large |
|
529 |
x < xLeft ifTrue:[ |
|
530 |
"/ must clip ... |
|
531 |
prevClip := dataSet clippingRectangleOrNil. |
|
532 |
mustUndoClip := true. |
|
533 |
dataSet clippingRectangle:(Rectangle |
|
534 |
left:xLeft top:yTop |
|
535 |
width:cashedWidth height:(drawnLabel heightOn:dataSet)). |
|
536 |
]. |
|
537 |
]. |
|
538 |
||
539 |
"/ drawnLabel isImageOrForm ifTrue:[ |
|
540 |
"/ y := yTop. |
|
541 |
"/ ] ifFalse:[ |
|
542 |
"/ y := (yTop + dataSet rowFontAscent) |
|
543 |
"/ ]. |
|
544 |
||
545 |
"/ drawnLabel isString ifFalse:[ |
|
546 |
"/ y := yTop + (drawnLabel ascentOn:dataSet). |
|
547 |
"/ ] ifTrue:[ |
|
548 |
"/ y := yTop + dataSet rowFontAscent |
|
549 |
"/ ]. |
|
550 |
"/ drawnLabel displayOn:dataSet x:x y:y. |
|
551 |
||
552 |
dataSet displayLabel:drawnLabel x:x y:yTop. |
|
553 |
||
554 |
mustUndoClip == true ifTrue:[ |
|
555 |
dataSet clippingRectangle:prevClip |
|
556 |
]. |
|
557 |
! |
|
558 |
||
1132 | 559 |
drawLabelsAtX:xLeft y:yTop h:h from:start to:stop |
560 |
"redraw labels from start to stop |
|
1088 | 561 |
" |
3990
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
562 |
|fg y yT x hspace lblHg bg label row isSel cachedWidth lineColor| |
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
563 |
|
3990
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
564 |
cachedWidth := self width. |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
565 |
cachedWidth isNil ifTrue:[ ^ self ]. |
2578 | 566 |
|
1132 | 567 |
yT := yTop. |
568 |
hspace := dataSet horizontalSpacing. |
|
1100 | 569 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
570 |
start to:stop do:[:aRowNr| |
3364
b7f6e426cd60
care for list change while drawing
Claus Gittinger <cg@exept.de>
parents:
3330
diff
changeset
|
571 |
row := dataSet at:aRowNr ifAbsent:[^ self]. |
1132 | 572 |
y := yT. |
573 |
x := xLeft. |
|
574 |
||
3990
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
575 |
"/ GET BACKGROUND AND FOREGROUND-COLOR |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
576 |
"/ =================================== |
1132 | 577 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
578 |
isSel := dataSet isSelected:aRowNr inColumn:columnNumber. |
1132 | 579 |
|
580 |
(isSel and:[description showSelectionHighLighted]) ifTrue:[ |
|
581 |
"/ SHOW SELECTED( MUST REDRAW BACKGROUND ) |
|
582 |
"/ ======================================= |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
583 |
bg := self selectedBackgroundColorFor:row at:aRowNr. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
584 |
fg := self selectedForegroundColorFor:row at:aRowNr. |
2578 | 585 |
|
1132 | 586 |
dataSet paint:bg. |
3990
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
587 |
dataSet fillRectangleX:x y:y width:cachedWidth height:h. |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
588 |
|
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
589 |
dataSet hasRowSelection ifFalse:[ |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
590 |
lineColor := self selectedFrameColorFor:row at:aRowNr. |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
591 |
lineColor notNil ifTrue:[ |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
592 |
dataSet paint:lineColor. |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
593 |
dataSet displayRectangleX:x y:y width:cachedWidth height:h. |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
594 |
] |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
595 |
] |
1113 | 596 |
] ifFalse:[ |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
597 |
description backgroundSelector notNil ifTrue:[ |
1132 | 598 |
"/ MUST REDRAW BACKGROUND |
599 |
"/ ====================== |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
600 |
bg := self backgroundColorFor:row at:aRowNr. |
1565 | 601 |
|
602 |
bg ~~ backgroundColor ifTrue:[ |
|
1132 | 603 |
bg := dataSet colorOnDevice:bg |
604 |
]. |
|
605 |
dataSet paint:bg. |
|
3990
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
606 |
dataSet fillRectangleX:x y:y width:cachedWidth height:h. |
1132 | 607 |
] ifFalse:[ |
608 |
bg := backgroundColor |
|
609 |
]. |
|
1100 | 610 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
611 |
fg := self foregroundColorFor:row at:aRowNr. |
1565 | 612 |
|
613 |
fg ~~ foregroundColor ifTrue:[ |
|
1132 | 614 |
fg := dataSet colorOnDevice:fg |
1565 | 615 |
]. |
1132 | 616 |
]. |
833 | 617 |
|
3990
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
618 |
"/ GET AND DRAW LABEL |
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
619 |
"/ ================== |
2542 | 620 |
(self isRowVisible:aRowNr) ifTrue:[ |
621 |
rendererType == #rowSelector ifTrue:[ |
|
622 |
isSel ifTrue:[ |
|
623 |
label := dataSet rowSelectorForm. |
|
624 |
x := x + hspace. |
|
625 |
] ifFalse:[ |
|
626 |
label := nil |
|
627 |
] |
|
1132 | 628 |
] ifFalse:[ |
2542 | 629 |
(isSel and:[dataSet hasOpenEditor]) ifTrue:[ |
630 |
label := nil |
|
631 |
] ifFalse:[ |
|
632 |
label := self shownValueForRow:row rowNr:aRowNr |
|
633 |
] |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
634 |
]. |
2542 | 635 |
label notNil ifTrue:[ |
636 |
"/ care for a dark-colored label, |
|
637 |
"/ with a dark selection-bg color |
|
638 |
(isSel and:[label isString and:[label hasChangeOfEmphasis]]) ifTrue:[ |
|
639 |
"/ take away the labels own color info |
|
640 |
label := label emphasisAllRemove:#color. |
|
641 |
]. |
|
642 |
||
643 |
lblHg := self heightOfLabel:label. |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
644 |
|
2542 | 645 |
lblHg ~~ 0 ifTrue:[ |
3139 | 646 |
y := y + ((h - lblHg) // 2). |
2542 | 647 |
dataSet paint:fg on:bg. |
1113 | 648 |
|
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
649 |
label isString ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
650 |
(label includes:Character cr) ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
651 |
label := label asCollectionOfLines |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
652 |
]. |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
653 |
]. |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
654 |
|
2542 | 655 |
(label isSequenceable and:[label isString not]) ifFalse:[ |
656 |
self drawLabel:label atX:x y:y |
|
657 |
] ifTrue:[ |
|
658 |
label do:[:el| |
|
659 |
el notNil ifTrue:[ |
|
660 |
self drawLabel:el atX:x y:y. |
|
661 |
y := y + (el heightOn:dataSet). |
|
662 |
] |
|
1147 | 663 |
] |
2542 | 664 |
]. |
665 |
] |
|
666 |
]. |
|
1132 | 667 |
]. |
668 |
yT := yT + h |
|
669 |
] |
|
3990
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
670 |
|
a1ed686544e0
added: #selectedFrameColorFor:at:
Claus Gittinger <cg@exept.de>
parents:
3920
diff
changeset
|
671 |
"Modified: / 20-01-2011 / 08:50:18 / cg" |
833 | 672 |
! |
673 |
||
3505 | 674 |
drawRendererInRow:rowNr x:xLeft y:y width:cellWidth value:cellValue |
675 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
676 |
(self hasChoices:rowNr) ifTrue:[ |
|
677 |
dataSet drawComboButtonAtX:xLeft y:y w:cellWidth |
|
678 |
]. |
|
679 |
^ self |
|
680 |
]. |
|
681 |
rendererType == #CheckToggle ifTrue:[ |
|
682 |
dataSet drawCheckToggleAtX:xLeft y:y w:cellWidth state:cellValue. |
|
683 |
^ self |
|
684 |
]. |
|
685 |
rendererType == #RadioButton ifTrue:[ |
|
686 |
dataSet drawRadioButtonAtX:xLeft y:y w:cellWidth state:cellValue. |
|
687 |
^ self |
|
688 |
]. |
|
689 |
! |
|
690 |
||
1132 | 691 |
drawSeparatorsAtX:xLeft y:yTop h:h from:start to:stop |
692 |
"redraw separators for cells between start and stop |
|
1088 | 693 |
" |
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
694 |
|cashedWidth is3D xL xR yB yT times| |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
695 |
|
1132 | 696 |
(showColSeparator or:[showRowSeparator]) ifFalse:[ |
697 |
^ self |
|
698 |
]. |
|
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
699 |
cashedWidth := self width. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
700 |
cashedWidth isNil ifTrue:[ ^ self ]. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
701 |
|
1132 | 702 |
is3D := dataSet has3Dseparators. |
703 |
||
1113 | 704 |
is3D ifTrue:[dataSet paint:(dataSet separatorDarkColor)] |
2638
f2b2ecc2c851
use user defined color for drawing separators in OneD mode
ca
parents:
2636
diff
changeset
|
705 |
ifFalse:[dataSet paint:(dataSet separatorOneDColor)]. |
1088 | 706 |
|
1132 | 707 |
times := stop - start + 1. |
708 |
xL := xLeft. |
|
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
709 |
xR := xL - 1 + cashedWidth. |
1088 | 710 |
|
1113 | 711 |
showRowSeparator ifTrue:[ |
1132 | 712 |
"/ DRAW SEPARATORS AT BOTTOM( DARK COLOR ) |
713 |
"/ ======================================= |
|
714 |
yB := yTop - 1 + h. |
|
715 |
||
716 |
rowSeparatorSelector isNil ifTrue:[ |
|
717 |
times timesRepeat:[ |
|
718 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB. |
|
719 |
yB := yB + h. |
|
720 |
] |
|
721 |
] ifFalse:[ |
|
722 |
start to:stop do:[:idx| |
|
3240
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
723 |
(self hasRowSeparatorAt:idx) ifTrue:[ |
1132 | 724 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB |
725 |
]. |
|
726 |
yB := yB + h. |
|
3240
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
727 |
]. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
728 |
]. |
1113 | 729 |
]. |
1132 | 730 |
|
1113 | 731 |
showColSeparator ifTrue:[ |
1132 | 732 |
"/ DRAW SEPARATORS AT RIGHT( DARK COLOR ) |
733 |
"/ ====================================== |
|
734 |
yT := yTop. |
|
735 |
||
736 |
times timesRepeat:[ |
|
737 |
dataSet displayLineFromX:xR y:yT toX:xR y:(yT - 1 + h). |
|
738 |
yT := yT + h. |
|
739 |
] |
|
1113 | 740 |
]. |
1089 | 741 |
|
1113 | 742 |
is3D ifFalse:[ |
743 |
^ self |
|
744 |
]. |
|
1088 | 745 |
|
1113 | 746 |
dataSet paint:(dataSet separatorLightColor). |
1040
c8e6a2ed7928
use the same background color for a selected rowSelector
ca
parents:
1007
diff
changeset
|
747 |
|
1113 | 748 |
( columnNumber == 1 |
3505 | 749 |
or:[(dataSet columnDescriptorAt:(columnNumber - 1)) showColSeparator] |
1113 | 750 |
) ifTrue:[ |
1132 | 751 |
|
752 |
"/ DRAW SEPARATORS AT LEFT( LIGHT COLOR ) |
|
753 |
"/ ====================================== |
|
754 |
yT := yTop. |
|
755 |
||
756 |
times timesRepeat:[ |
|
757 |
dataSet displayLineFromX:xL y:yT toX:xL y:(yT - 1 + h). |
|
758 |
yT := yT + h. |
|
759 |
]. |
|
1113 | 760 |
] ifFalse:[ |
1132 | 761 |
xL := xL - 1 |
1113 | 762 |
]. |
1092 | 763 |
|
1113 | 764 |
showRowSeparator ifTrue:[ |
1132 | 765 |
"/ DRAW SEPARATORS AT TOP( LIGHT COLOR ) |
766 |
"/ ===================================== |
|
767 |
yT := yTop. |
|
768 |
||
769 |
rowSeparatorSelector isNil ifTrue:[ |
|
770 |
times timesRepeat:[ |
|
771 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
|
772 |
yT := yT + h. |
|
773 |
] |
|
774 |
] ifFalse:[ |
|
775 |
"/ CHECK WHETHER PREVIOUS ROW HAS A SEPARATOR AT BOTTOM |
|
776 |
"/ ==================================================== |
|
777 |
start to:stop do:[:idx| |
|
3240
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
778 |
(idx == 1 or:[self hasRowSeparatorAt:(idx - 1)]) ifTrue:[ |
1132 | 779 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
780 |
]. |
|
781 |
yT := yT + h. |
|
782 |
] |
|
1088 | 783 |
] |
542 | 784 |
]. |
607 | 785 |
! |
786 |
||
542 | 787 |
invalidate |
1484 | 788 |
"invalidate width of column; forces a recomputation |
542 | 789 |
" |
1484 | 790 |
width := nil. |
542 | 791 |
|
1088 | 792 |
! |
793 |
||
1132 | 794 |
redrawX:xLeft y:yTop h:h from:start to:stop |
3505 | 795 |
"redraw all rows between start and stop" |
796 |
||
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
797 |
|rH y cashedWidth| |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
798 |
|
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
799 |
cashedWidth := self width. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
800 |
cashedWidth isNil ifTrue:[ ^ self ]. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
801 |
|
1132 | 802 |
rH := dataSet rowHeight. |
1088 | 803 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
804 |
description backgroundSelector isNil ifTrue:[ |
1132 | 805 |
dataSet paint:backgroundColor. |
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
806 |
dataSet fillRectangleX:xLeft y:yTop width:cashedWidth height:h |
1115 | 807 |
]. |
808 |
||
3505 | 809 |
"/ DRAW CELLS: BACKGROUND/FOREGROUND/LABEL |
810 |
"/ ======================================= |
|
1132 | 811 |
self drawLabelsAtX:xLeft y:yTop h:rH from:start to:stop. |
1113 | 812 |
|
3505 | 813 |
"/ DRAW RENDERED INDICATORS |
814 |
"/ ======================== |
|
815 |
rendererType notNil ifTrue:[ |
|
1132 | 816 |
y := yTop. |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
817 |
start to:stop do:[:rowNr| |
3505 | 818 |
|state| |
819 |
||
2542 | 820 |
(self isRowVisible:rowNr) ifTrue:[ |
3505 | 821 |
state := self at:rowNr. |
822 |
self drawRendererInRow:rowNr x:xLeft y:y width:cashedWidth value:state. |
|
1113 | 823 |
]. |
1132 | 824 |
y := y + rH. |
3505 | 825 |
]. |
1088 | 826 |
]. |
827 |
||
3505 | 828 |
"/ DRAW SEPARATORS |
829 |
"/ =============== |
|
1132 | 830 |
self drawSeparatorsAtX:xLeft y:yTop h:rH from:start to:stop |
2693 | 831 |
! |
832 |
||
833 |
shownValueForRow:aRow rowNr:aRowNr |
|
3325
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
834 |
|selector format value type choices translatedChoices idx converter| |
2693 | 835 |
|
836 |
rendererType == #CheckToggle ifTrue:[ |
|
837 |
^ nil |
|
838 |
]. |
|
3505 | 839 |
rendererType == #RadioButton ifTrue:[ |
840 |
^ nil |
|
841 |
]. |
|
2693 | 842 |
|
843 |
rendererType == #rowSelector ifTrue:[ |
|
844 |
^ nil |
|
845 |
]. |
|
846 |
||
847 |
selector := description printSelector. |
|
848 |
selector notNil ifTrue:[ |
|
849 |
^ aRow |
|
850 |
perform:selector |
|
851 |
withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet. |
|
852 |
]. |
|
853 |
||
854 |
value := self extractColFromRow:aRow rowNr:aRowNr. |
|
2865 | 855 |
description translatedChoices notNil ifTrue:[ |
856 |
choices := self choicesFor:aRow at:aRowNr. |
|
857 |
idx := choices indexOf:value. |
|
858 |
idx ~~ 0 ifTrue:[ |
|
859 |
translatedChoices := self translatedChoicesFor:aRow at:aRowNr. |
|
860 |
translatedChoices notNil ifTrue:[ |
|
861 |
value := translatedChoices at:idx. |
|
862 |
]. |
|
863 |
]. |
|
864 |
]. |
|
2693 | 865 |
|
866 |
selector := description formatSelector. |
|
867 |
selector notNil ifTrue:[ |
|
868 |
format := aRow |
|
3674 | 869 |
perform:selector asSymbol |
2693 | 870 |
withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet. |
871 |
] ifFalse:[ |
|
872 |
format := description formatString. |
|
873 |
]. |
|
874 |
format notNil ifTrue:[ |
|
875 |
"/ cannot remember what this was used for ... |
|
876 |
"/ (idx := format indexOf:$.) ~~ 0 ifTrue:[ |
|
877 |
"/ idx := format size - idx |
|
878 |
"/ ]. |
|
879 |
"/ format := '%0.', idx printString, 'f'. |
|
880 |
||
3674 | 881 |
^ value printStringFormat:format |
3325
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
882 |
]. |
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
883 |
|
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
884 |
type := description type. |
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
885 |
type ~~ #string ifTrue:[ |
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
886 |
converter := TypeConverter new perform:type. |
3920
4a1933e73efd
changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
887 |
^ converter getBlock value:value. |
4a1933e73efd
changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
888 |
"/ cg: the code below is dangerous (tries to addDependent to Integers) !! |
4a1933e73efd
changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
889 |
"/ converter model:value. |
4a1933e73efd
changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
890 |
"/ ^ converter value. |
2693 | 891 |
]. |
892 |
||
893 |
^ value |
|
3920
4a1933e73efd
changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
894 |
|
4a1933e73efd
changed: #shownValueForRow:rowNr:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
895 |
"Modified: / 28-07-2010 / 20:42:51 / cg" |
542 | 896 |
! ! |
897 |
||
614 | 898 |
!DataSetColumn methodsFor:'editing'! |
899 |
||
3856 | 900 |
editorForRowAt:aRowNr |
901 |
"creates the editor for the row in a view and returns an editorAndModel, or nil" |
|
3771 | 902 |
|
1268 | 903 |
|val row| |
614 | 904 |
|
3264
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
905 |
row := dataSet at:aRowNr ifAbsent:[^ nil]. |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
906 |
val := self extractColFromRow:row rowNr:aRowNr. |
614 | 907 |
|
833 | 908 |
val isText ifTrue:[val := val string]. |
3856 | 909 |
^ description editorOn:row at:aRowNr column:self value:val usingAdaptor:columnAdaptor. |
3264
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
910 |
|
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
911 |
"Modified: / 27-10-2007 / 10:26:15 / cg" |
2693 | 912 |
! ! |
913 |
||
914 |
!DataSetColumn methodsFor:'event handling'! |
|
915 |
||
916 |
doesNotUnderstand:aMessage |
|
917 |
||
918 |
(description respondsTo:(aMessage selector)) ifTrue:[ |
|
919 |
^ aMessage sendTo:description |
|
920 |
]. |
|
921 |
^ super doesNotUnderstand:aMessage |
|
922 |
||
923 |
! ! |
|
924 |
||
925 |
!DataSetColumn methodsFor:'grow & shrink'! |
|
926 |
||
927 |
growWidth:n |
|
928 |
"grow the width for n pixels |
|
929 |
" |
|
930 |
width := self width + n. |
|
931 |
||
932 |
||
933 |
! ! |
|
934 |
||
935 |
!DataSetColumn methodsFor:'initialization'! |
|
542 | 936 |
|
1147 | 937 |
on:aDSVColumnView description:aDescription columnNumber:aNumber label:aLabel |
542 | 938 |
"instance creation; set attributes dependent on the description |
939 |
" |
|
1089 | 940 |
columnNumber := aNumber. |
941 |
dataSet := aDSVColumnView. |
|
1147 | 942 |
label := aLabel. |
1487 | 943 |
|
1089 | 944 |
description := aDescription. |
945 |
rendererType := description rendererType. |
|
1496 | 946 |
containsText := ( rendererType ~~ #CheckToggle |
3505 | 947 |
and:[rendererType ~~ #RadioButton |
948 |
and:[rendererType ~~ #rowSelector]] |
|
1496 | 949 |
). |
1490 | 950 |
descWidth := description width. |
2424
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
951 |
longStringCompression := description longStringCompression. |
1526 | 952 |
|
953 |
description usePreferredWidth ifTrue:[ |
|
954 |
descWidth := 0 |
|
955 |
]. |
|
956 |
||
1565 | 957 |
width := nil. |
958 |
||
2693 | 959 |
minValue := description minValue. |
960 |
maxValue := description maxValue. |
|
1113 | 961 |
rowSeparatorSelector := description rowSeparatorSelector. |
1565 | 962 |
|
1113 | 963 |
showColSeparator := description showColSeparator. |
964 |
showRowSeparator := description showRowSeparator. |
|
1089 | 965 |
columnAdaptor := dataSet columnAdaptor. |
966 |
buttonExtent := 0 @ 0. |
|
967 |
columnAlignment := #left. |
|
584 | 968 |
|
1132 | 969 |
(backgroundColor := description backgroundColor) isNil ifTrue:[ |
970 |
backgroundColor := dataSet backgroundColor |
|
971 |
] ifFalse:[ |
|
1480 | 972 |
backgroundColor := backgroundColor onDevice:dataSet device |
584 | 973 |
]. |
1113 | 974 |
|
975 |
(foregroundColor := description foregroundColor) isNil ifTrue:[ |
|
976 |
foregroundColor := dataSet foregroundColor |
|
977 |
] ifFalse:[ |
|
1480 | 978 |
foregroundColor := foregroundColor onDevice:dataSet device |
584 | 979 |
]. |
542 | 980 |
|
981 |
rendererType == #CheckToggle ifTrue:[ |
|
1113 | 982 |
buttonExtent := dataSet checkToggleExtent. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
983 |
^ self |
542 | 984 |
]. |
3505 | 985 |
rendererType == #RadioButton ifTrue:[ |
986 |
buttonExtent := dataSet radioButtonExtent. |
|
987 |
^ self |
|
988 |
]. |
|
542 | 989 |
|
990 |
rendererType == #rowSelector ifTrue:[ |
|
807 | 991 |
buttonExtent := dataSet rowSelectorExtent. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
992 |
^ self |
542 | 993 |
]. |
994 |
||
995 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
807 | 996 |
buttonExtent := dataSet comboButtonExtent. |
883 | 997 |
] ifFalse:[ |
998 |
columnAlignment := description columnAlignment |
|
542 | 999 |
]. |
1000 |
||
2444 | 1001 |
"Modified: / 25.2.2000 / 14:25:56 / cg" |
2424
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
1002 |
! ! |
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
1003 |
|
621 | 1004 |
!DataSetColumn methodsFor:'private'! |
1005 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1006 |
extractColFromRow:aRow rowNr:rowNr |
3320 | 1007 |
|readSelector col numArgs| |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1008 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1009 |
readSelector := description readSelector. |
1226 | 1010 |
readSelector isNil ifTrue:[^ nil]. |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1011 |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1012 |
readSelector isBlock ifTrue:[ |
3737 | 1013 |
"/ I dont use valueWithOptionalArgument:and:and:and: here, to make better use of inline caches... |
3320 | 1014 |
numArgs := readSelector numArgs. |
1015 |
numArgs == 0 ifTrue:[ |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1016 |
^ readSelector value |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1017 |
]. |
3320 | 1018 |
numArgs == 1 ifTrue:[ |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1019 |
^ readSelector value:aRow |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1020 |
]. |
3320 | 1021 |
numArgs == 2 ifTrue:[ |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1022 |
^ readSelector value:aRow value:columnNumber |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1023 |
]. |
3320 | 1024 |
numArgs == 3 ifTrue:[ |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1025 |
^ readSelector value:aRow value:columnNumber value:rowNr |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1026 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1027 |
^ readSelector value:aRow value:columnNumber value:rowNr value:dataSet |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1028 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1029 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1030 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1031 |
^ columnAdaptor perform:readSelector withOptionalArgument:aRow and:columnNumber and:rowNr and:dataSet |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1032 |
]. |
2635
a8add4698dea
care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents:
2613
diff
changeset
|
1033 |
aRow isNil ifTrue:[^ nil]. |
a8add4698dea
care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents:
2613
diff
changeset
|
1034 |
|
4230 | 1035 |
(aRow isDictionary) ifTrue:[ |
3724
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1036 |
col := aRow at:readSelector |
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1037 |
] ifFalse:[ |
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1038 |
col := aRow perform:readSelector withOptionalArgument:columnNumber and:rowNr and:dataSet. |
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1039 |
]. |
2444 | 1040 |
^ col |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1041 |
! |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1042 |
|
2693 | 1043 |
storeCol:newValueArg inRow:aRow |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1044 |
|writeSelector numArgs newValue| |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1045 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1046 |
writeSelector := description writeSelector. |
1226 | 1047 |
writeSelector isNil ifTrue:[^ aRow]. |
1048 |
||
2693 | 1049 |
newValue := newValueArg. |
1050 |
(newValue isNumber) ifTrue:[ |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1051 |
minValue notNil ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1052 |
newValue < minValue ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1053 |
newValue := minValue |
2693 | 1054 |
] |
1055 |
]. |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1056 |
maxValue notNil ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1057 |
newValue > maxValue ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1058 |
newValue := maxValue |
2693 | 1059 |
] |
1060 |
]. |
|
1061 |
]. |
|
1062 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1063 |
numArgs := writeSelector numArgs. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1064 |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1065 |
writeSelector isBlock ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1066 |
numArgs == 2 ifTrue:[ |
2863
c0585cbcd922
argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents:
2862
diff
changeset
|
1067 |
^ writeSelector value:newValue value:aRow |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1068 |
]. |
2863
c0585cbcd922
argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents:
2862
diff
changeset
|
1069 |
^ writeSelector value:newValue value:aRow value:columnNumber |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1070 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1071 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1072 |
columnAdaptor notNil ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1073 |
numArgs == 2 ifTrue:[ |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
1074 |
columnAdaptor perform:writeSelector with:aRow with:newValue. |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
1075 |
^ self |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1076 |
]. |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
1077 |
columnAdaptor perform:writeSelector with:aRow with:columnNumber with:newValue. |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
1078 |
^ self |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1079 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1080 |
|
4230 | 1081 |
(aRow isDictionary) ifTrue:[ |
3724
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1082 |
aRow at:writeSelector put:newValue |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1083 |
] ifFalse:[ |
3724
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1084 |
numArgs == 1 ifTrue:[ |
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1085 |
aRow perform:writeSelector with:newValue |
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1086 |
] ifFalse:[ |
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1087 |
aRow perform:writeSelector with:columnNumber with:newValue |
f4726b172c16
allow for dictionary to be used as row
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1088 |
] |
1059 | 1089 |
]. |
621 | 1090 |
! ! |
1091 |
||
542 | 1092 |
!DataSetColumn methodsFor:'queries'! |
1093 |
||
1492 | 1094 |
canResize |
4117
b2eb0d2d0008
changed: #canResize - formatting
Stefan Vogel <sv@exept.de>
parents:
3992
diff
changeset
|
1095 |
^ containsText and:[descWidth == 0 or:[self hasRelativeWidth]] |
1492 | 1096 |
! |
1097 |
||
607 | 1098 |
canSelect:aRowNr |
3448
ef7d76d6bcfd
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3364
diff
changeset
|
1099 |
"returns true if the cell in column is selectable. |
ef7d76d6bcfd
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3364
diff
changeset
|
1100 |
(possibly calls the selectSelector, if any)" |
ef7d76d6bcfd
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3364
diff
changeset
|
1101 |
|
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1102 |
|s row| |
607 | 1103 |
|
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1104 |
description canSelect ifFalse:[^ false]. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1105 |
s := description selectSelector. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1106 |
s isNil ifTrue:[^ true]. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1107 |
|
3264
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
1108 |
row := dataSet at:aRowNr ifAbsent:[^ false]. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1109 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1110 |
^ columnAdaptor perform:s withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet |
607 | 1111 |
]. |
1112 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1113 |
^ row perform:s withOptionalArgument:columnNumber and:aRowNr and:dataSet |
3264
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
1114 |
|
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
1115 |
"Modified: / 27-10-2007 / 10:27:20 / cg" |
607 | 1116 |
! |
1117 |
||
2864
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1118 |
choicesFor:aRow at:aRowNr |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1119 |
|choicesSelector| |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1120 |
|
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1121 |
choicesSelector := description choices. |
2897 | 1122 |
choicesSelector isNil ifTrue:[^ nil]. |
2864
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1123 |
|
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1124 |
columnAdaptor notNil ifTrue:[ |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1125 |
^ columnAdaptor perform:choicesSelector withOptionalArgument:aRow and:columnNumber and:aRowNr and:dataSet |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1126 |
]. |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1127 |
^ aRow perform:choicesSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1128 |
! |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1129 |
|
647 | 1130 |
containsText |
1131 |
"returns true if text might exist |
|
1132 |
" |
|
1496 | 1133 |
^ containsText |
647 | 1134 |
! |
1135 |
||
2074 | 1136 |
doubleClickOn:aRowNr |
2694 | 1137 |
|sel row| |
2074 | 1138 |
|
1139 |
(sel := self doubleClickedSelector) notNil ifTrue:[ |
|
2694 | 1140 |
row := dataSet at:aRowNr. |
2074 | 1141 |
columnAdaptor notNil ifTrue:[ |
2694 | 1142 |
^ columnAdaptor perform:sel withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet |
2074 | 1143 |
]. |
2694 | 1144 |
^ row perform:sel withOptionalArgument:columnNumber and:aRowNr and:dataSet |
2074 | 1145 |
]. |
1146 |
! |
|
1147 |
||
833 | 1148 |
hasChoices:aRowNr |
2864
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1149 |
|row| |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1150 |
|
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1151 |
row := dataSet at:aRowNr. |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1152 |
^ (self choicesFor:row at:aRowNr) notNil |
833 | 1153 |
! |
1154 |
||
1950 | 1155 |
hasPotentialNonConstantBackground |
1156 |
(backgroundColor notNil and:[backgroundColor isImageOrForm]) ifTrue:[^ true]. |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1157 |
description backgroundSelector notNil ifTrue:[^ true]. |
1950 | 1158 |
^ false. |
1159 |
! |
|
1160 |
||
1484 | 1161 |
hasRelativeWidth |
1162 |
"returns true if width is relative |
|
1163 |
" |
|
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
1164 |
^ descWidth isLimitedPrecisionReal |
1484 | 1165 |
! |
1166 |
||
3240
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1167 |
hasRowSeparatorAt:rowNumber |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1168 |
|row bool| |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1169 |
|
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1170 |
rowSeparatorSelector isNil ifTrue:[^ true ]. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1171 |
row := dataSet at:rowNumber. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1172 |
|
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1173 |
columnAdaptor isNil ifTrue:[ |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1174 |
bool := row perform:rowSeparatorSelector. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1175 |
] ifFalse:[ |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1176 |
bool := columnAdaptor perform:rowSeparatorSelector |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1177 |
withOptionalArgument:row and:columnNumber and:rowNumber and:dataSet. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1178 |
]. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1179 |
^ bool ~~ false |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1180 |
! |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1181 |
|
542 | 1182 |
heightOfHighestRow |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1183 |
"returns the height of the highest row in pixels. |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1184 |
Warning: |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1185 |
only the first numberOfRowsProbedForColumnSize are probed, |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1186 |
in case the access is expensive (dataBase apps) |
3992 | 1187 |
If the descriptor defines a height, that is used, and the items are not probed at all. |
4331 | 1188 |
If the descriptor's height is -1 or #fontHeight, that is used. |
4332 | 1189 |
If the descriptor's height is #heightOfFirstRow, only the first columns height is probed. |
542 | 1190 |
" |
4331 | 1191 |
|h end bE editorType row1| |
542 | 1192 |
|
1496 | 1193 |
(h := description height) == 0 ifTrue:[ |
1194 |
containsText ifTrue:[ |
|
542 | 1195 |
"/ search first none empty drawable object |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1196 |
end := description numberOfRowsProbedForColumnSize min:dataSet size. |
542 | 1197 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1198 |
1 to:end do:[:rowNr| |row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1199 |
row := dataSet at:rowNr. |
2444 | 1200 |
h := h max:(self heightOfLabel:(self shownValueForRow:row rowNr:rowNr)) |
542 | 1201 |
] |
1202 |
] |
|
3992 | 1203 |
] ifFalse:[ |
4332 | 1204 |
((h == #heightOfFirstRow) or:[ h == #askFirst]) ifTrue:[ |
4331 | 1205 |
row1 := dataSet at:1. |
1206 |
h := self heightOfLabel:(self shownValueForRow:row1 rowNr:1) |
|
1207 |
] ifFalse:[ |
|
1208 |
(h == #fontHeight or:[ h isNumber and:[h < 0] ]) ifTrue:[ |
|
1209 |
h := dataSet font heightOn:dataSet device. |
|
1210 |
]. |
|
3992 | 1211 |
]. |
542 | 1212 |
]. |
3992 | 1213 |
|
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1214 |
(bE := buttonExtent y) = 0 ifTrue:[ |
3505 | 1215 |
editorType := description editorType. |
1216 |
(editorType == #ComboList or:[ editorType == #ComboBox]) ifTrue:[ |
|
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1217 |
bE := dataSet comboButtonExtent y. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1218 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1219 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1220 |
^ h max:bE |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1221 |
|
3992 | 1222 |
"Modified: / 20-01-2011 / 18:03:45 / cg" |
1113 | 1223 |
! |
1224 |
||
1147 | 1225 |
heightOfLabel:aLabel |
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1226 |
"returns the height of the label" |
1147 | 1227 |
|
4332 | 1228 |
|h font| |
3992 | 1229 |
|
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1230 |
aLabel isNil ifTrue:[ ^ 0 ]. |
4332 | 1231 |
font := dataSet font onDevice:dataSet device. |
3992 | 1232 |
|
4331 | 1233 |
((h := description height) == #fontHeight or:[ h isNumber and:[h < 0] ]) ifTrue:[ |
4332 | 1234 |
^ font height |
3992 | 1235 |
]. |
1236 |
||
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1237 |
(aLabel isString) ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1238 |
"/ if multiple lines - count 'em |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1239 |
(aLabel includes:Character cr) ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1240 |
^ aLabel asStringCollection inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)] |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1241 |
]. |
4332 | 1242 |
^ font heightOf:aLabel |
1496 | 1243 |
]. |
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1244 |
(aLabel isImageOrForm) ifTrue:[ |
4332 | 1245 |
^ font heightOf:aLabel |
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1246 |
]. |
1147 | 1247 |
|
1496 | 1248 |
aLabel isSequenceable ifFalse:[ |
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1249 |
^ aLabel |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1250 |
perform:#heightOn: |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1251 |
with:dataSet |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1252 |
ifNotUnderstood:[ aLabel displayString heightOn:dataSet ] |
1147 | 1253 |
]. |
1254 |
||
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1255 |
^ aLabel inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)]. |
3992 | 1256 |
|
1257 |
"Modified: / 20-01-2011 / 18:03:38 / cg" |
|
1147 | 1258 |
! |
1259 |
||
1937 | 1260 |
isResizeable |
1261 |
"returns true if the row is resizeable |
|
1262 |
" |
|
1263 |
^ description isResizeable |
|
1264 |
! |
|
1265 |
||
2542 | 1266 |
isRowVisible:rowNr |
1267 |
^ description rowIsVisible:(dataSet at:rowNr) |
|
1268 |
! |
|
1269 |
||
3767 | 1270 |
isSortable |
1271 |
^ description isSortable |
|
1272 |
! |
|
1273 |
||
1113 | 1274 |
showColSeparator |
1275 |
"returns true if column separator is on |
|
1276 |
" |
|
1277 |
^ showColSeparator |
|
1133 | 1278 |
! |
1279 |
||
1280 |
showSelectionHighLighted |
|
1281 |
"returns true if selection is highLighted |
|
1282 |
" |
|
1283 |
^ description showSelectionHighLighted ~~ false |
|
1147 | 1284 |
! |
1285 |
||
2865 | 1286 |
translatedChoicesFor:aRow at:aRowNr |
1287 |
|translatedChoicesSelector| |
|
1288 |
||
1289 |
translatedChoicesSelector := description translatedChoices. |
|
1290 |
||
1291 |
columnAdaptor notNil ifTrue:[ |
|
1292 |
^ columnAdaptor perform:translatedChoicesSelector withOptionalArgument:aRow and:columnNumber and:aRowNr and:dataSet |
|
1293 |
]. |
|
1294 |
^ aRow perform:translatedChoicesSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
|
1295 |
! |
|
1296 |
||
1147 | 1297 |
widthOfLabel:aLabel |
1298 |
"returns the width of the label |
|
1299 |
" |
|
1496 | 1300 |
|w| |
1147 | 1301 |
|
1496 | 1302 |
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[ |
1303 |
^ aLabel widthOn:dataSet |
|
1304 |
]. |
|
1147 | 1305 |
aLabel isNil ifTrue:[ ^ 0 ]. |
1306 |
||
1496 | 1307 |
aLabel isSequenceable ifFalse:[ |
1308 |
^ aLabel perform:#widthOn: with:dataSet ifNotUnderstood:[ |
|
1309 |
aLabel displayString widthOn:dataSet |
|
1310 |
] |
|
1147 | 1311 |
]. |
1312 |
||
1496 | 1313 |
w := 0. |
1314 |
aLabel do:[:el|w := w max:(el widthOn:dataSet)]. |
|
1315 |
^ w |
|
542 | 1316 |
! ! |
1317 |
||
1318 |
!DataSetColumn methodsFor:'searching'! |
|
1319 |
||
1320 |
findRowNrStartingWithChar:aChar start:start stop:stop |
|
1321 |
"find the first row starting at start to stop, which drawable label |
|
1322 |
starts with the character, aChar. The index of the detected row is |
|
1323 |
returned or if no row is found 0. |
|
1324 |
" |
|
1325 |
|char| |
|
1326 |
||
1496 | 1327 |
containsText ifTrue:[ |
542 | 1328 |
char := aChar asLowercase. |
1329 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1330 |
start to:stop do:[:eachNr| |row lbl| |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1331 |
(dataSet isRowSelectable:eachNr) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1332 |
row := dataSet at:eachNr. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1333 |
lbl := self shownValueForRow:row rowNr:eachNr. |
1147 | 1334 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1335 |
(lbl isSequenceable and:[lbl isString not]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1336 |
lbl := lbl at:1 ifAbsent:nil |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1337 |
]. |
542 | 1338 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1339 |
(lbl respondsTo:#string) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1340 |
lbl := lbl string. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1341 |
(lbl size ~~ 0 and:[(lbl at:1) asLowercase == char]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1342 |
^ eachNr |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1343 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1344 |
] ifFalse:[ |
4248 | 1345 |
lbl notNil ifTrue:[ ^ 0 ]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1346 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1347 |
]. |
542 | 1348 |
] |
1349 |
]. |
|
1350 |
^ 0 |
|
1351 |
! ! |
|
1352 |
||
1353 |
!DataSetColumn class methodsFor:'documentation'! |
|
1354 |
||
1355 |
version |
|
4332 | 1356 |
^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.141 2013-08-23 10:05:53 cg Exp $' |
3767 | 1357 |
! |
1358 |
||
1359 |
version_CVS |
|
4332 | 1360 |
^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.141 2013-08-23 10:05:53 cg Exp $' |
542 | 1361 |
! ! |
4230 | 1362 |