author | Stefan Vogel <sv@exept.de> |
Thu, 26 Mar 2009 12:55:16 +0100 | |
changeset 3674 | 384982192479 |
parent 3522 | 3a173979096d |
child 3675 | e0e63070a210 |
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 |
2444 | 15 |
instanceVariableNames:'columnNumber dataSet width description buttonExtent rendererType |
16 |
backgroundColor foregroundColor rowSeparatorSelector |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
17 |
showColSeparator showRowSeparator columnAlignment label |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
18 |
containsText columnAdaptor descWidth descMinWidth |
2693 | 19 |
longStringCompression minValue maxValue' |
1712 | 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]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
125 |
(aString widthOn:aGC) > maxWidth ifFalse:[aString]. |
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 |
||
159 |
((key := description activeHelpKey) notNil |
|
160 |
and:[(app := dataSet application) notNil]) ifTrue:[ |
|
3213 | 161 |
^ app flyByHelpTextForKey:key. |
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 |
|
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
174 |
((key := description activeHelpKeyForLabel) notNil |
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:[ |
3a173979096d
allow for separate activeHelp for the label area
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
176 |
^ app flyByHelpTextForKey:key. |
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" |
|
1565 | 356 |
! ! |
357 |
||
1818 | 358 |
!DataSetColumn methodsFor:'accessing-dimension'! |
1487 | 359 |
|
1484 | 360 |
minWidth |
1490 | 361 |
"get the minimum width required by the column |
1484 | 362 |
" |
1490 | 363 |
descMinWidth notNil ifTrue:[ |
364 |
^ descMinWidth |
|
365 |
]. |
|
366 |
width := nil. |
|
367 |
^ self width |
|
1484 | 368 |
|
1490 | 369 |
! |
370 |
||
1492 | 371 |
minimumRequiredWidth |
372 |
"returns the minimum required width |
|
373 |
" |
|
374 |
|minWidth| |
|
375 |
||
1940 | 376 |
descMinWidth notNil ifTrue:[ |
377 |
minWidth := DSVLabelView tabSpacing max:2. |
|
378 |
^ minWidth // 2 + minWidth |
|
379 |
]. |
|
1492 | 380 |
|
1940 | 381 |
minWidth := dataSet separatorSize + (2 * dataSet horizontalSpacing). |
382 |
^ minWidth + label preferredWidth. |
|
1492 | 383 |
! |
384 |
||
1490 | 385 |
setDescWidth:aWidth |
386 |
"set a fixed width |
|
387 |
" |
|
1940 | 388 |
descMinWidth := 1. |
389 |
descMinWidth := width := descWidth := self minimumRequiredWidth max:aWidth. |
|
1484 | 390 |
! |
391 |
||
542 | 392 |
width |
393 |
"returns the width in pixels |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
394 |
Warning: |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
395 |
only the first numberOfRowsProbedForColumnSize are probed, |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
396 |
in case the access is expensive (dataBase apps) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
397 |
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
|
398 |
are not probed at all." |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
399 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
400 |
|max "{ Class:SmallInteger }" |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
401 |
listSize "{ Class:SmallInteger }"| |
542 | 402 |
|
1484 | 403 |
width notNil ifTrue:[^ width]. "/ already computed |
542 | 404 |
|
1490 | 405 |
descMinWidth notNil ifTrue:[ |
406 |
width := descMinWidth. |
|
407 |
^ width |
|
1484 | 408 |
]. |
1482 | 409 |
|
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
410 |
(descWidth ~~ 0 and:[descWidth isLimitedPrecisionReal not]) ifTrue:[ |
1493 | 411 |
width := descMinWidth := descWidth. |
412 |
^ width |
|
413 |
]. |
|
414 |
||
1490 | 415 |
width := description minWidth max:(label preferredWidth). |
416 |
||
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
417 |
descWidth isLimitedPrecisionReal ifTrue:[ |
2093 | 418 |
width := width max:(descWidth * dataSet innerWidth) rounded. |
1490 | 419 |
^ width |
1482 | 420 |
]. |
421 |
||
1496 | 422 |
containsText ifTrue:[ |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
423 |
"/ take maximum numberOfRowsProbedForColumnSize entries to calculate the width; |
1484 | 424 |
"/ 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
|
425 |
listSize := dataSet size. |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
426 |
max := listSize min:description numberOfRowsProbedForColumnSize. |
542 | 427 |
|
1526 | 428 |
max ~~ 0 ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
429 |
1 to:max do:[:rowNr| |row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
430 |
row := dataSet at:rowNr. |
2444 | 431 |
width := width max:(self widthOfLabel:(self shownValueForRow:row rowNr:rowNr)) |
1526 | 432 |
]. |
2444 | 433 |
width := width max:(self widthOfLabel:(self shownValueForRow:(dataSet at:listSize) rowNr:listSize)) |
1484 | 434 |
]. |
435 |
description editorType ~~ #None ifTrue:[ |
|
436 |
width := width + (dataSet font widthOn:dataSet device) |
|
542 | 437 |
]. |
1493 | 438 |
] ifFalse:[ |
439 |
max := 1 |
|
1484 | 440 |
]. |
1490 | 441 |
width := width + buttonExtent x + dataSet separatorSize + (2 * dataSet horizontalSpacing). |
1493 | 442 |
|
443 |
max ~~ 0 ifTrue:[ |
|
1526 | 444 |
descMinWidth := width. |
445 |
description usePreferredWidth ifTrue:[ |
|
446 |
descWidth := width |
|
447 |
] |
|
1493 | 448 |
]. |
1490 | 449 |
^ width |
1484 | 450 |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
451 |
"Modified: / 25.2.2000 / 14:29:16 / cg" |
542 | 452 |
! ! |
453 |
||
454 |
!DataSetColumn methodsFor:'drawing'! |
|
455 |
||
3330 | 456 |
drawLabel:aLabelToDraw atX:xLeft y:yTop |
457 |
"draw aLabelToDraw; handle columnAlignment" |
|
458 |
||
459 |
|drawnLabel x space prevClip mustUndoClip cashedWidth |
|
460 |
labelWidth leftPart leftShift indexOfFirstDigit indexOfFirstNonDigit| |
|
461 |
||
462 |
cashedWidth := self width. |
|
463 |
cashedWidth isNil ifTrue:[ ^ self ]. |
|
464 |
||
465 |
space := dataSet horizontalSpacing. |
|
466 |
||
467 |
drawnLabel := aLabelToDraw. |
|
468 |
labelWidth := drawnLabel widthOn:dataSet. |
|
469 |
||
470 |
(longStringCompression ~~ false |
|
471 |
and:[ drawnLabel isString |
|
472 |
and:[ labelWidth > cashedWidth]]) ifTrue:[ |
|
473 |
drawnLabel := self class shortenedStringFor:drawnLabel on:dataSet maxWidth:cashedWidth-space. |
|
474 |
labelWidth := drawnLabel widthOn:dataSet. |
|
475 |
]. |
|
476 |
||
477 |
columnAlignment == #left ifTrue:[ |
|
478 |
x := xLeft + space. |
|
479 |
] ifFalse:[ |
|
480 |
columnAlignment == #decimal ifTrue:[ |
|
481 |
drawnLabel := drawnLabel asString. |
|
482 |
(drawnLabel includes:$.) ifTrue:[ |
|
483 |
leftPart := drawnLabel upTo:$.. |
|
484 |
] ifFalse:[ |
|
485 |
leftPart := drawnLabel. |
|
486 |
||
487 |
indexOfFirstDigit := drawnLabel findFirst:[:char | char isDigit]. |
|
488 |
indexOfFirstDigit ~~ 0 ifTrue:[ |
|
489 |
indexOfFirstNonDigit := drawnLabel findFirst:[:char | char isDigit not] startingAt:indexOfFirstDigit+1. |
|
490 |
indexOfFirstNonDigit ~~ 0 ifTrue:[ |
|
491 |
leftPart := drawnLabel copyTo:indexOfFirstNonDigit-1. |
|
492 |
]. |
|
493 |
]. |
|
494 |
]. |
|
495 |
leftShift := leftPart widthOn:dataSet. |
|
496 |
x := (cashedWidth // 2) - leftShift. |
|
497 |
] ifFalse:[ |
|
498 |
x := cashedWidth - labelWidth. |
|
499 |
||
500 |
columnAlignment == #right ifTrue:[x := x - space] |
|
501 |
ifFalse:[x := x // 2]. |
|
502 |
]. |
|
503 |
"/ cg: old code (did not right-align if string is larger than width |
|
504 |
"/ x := xLeft + (x max:0). |
|
505 |
||
506 |
"/ new code: always right-align. |
|
507 |
x := xLeft + x. |
|
508 |
||
509 |
"/ must clip left, if string is too large |
|
510 |
x < xLeft ifTrue:[ |
|
511 |
"/ must clip ... |
|
512 |
prevClip := dataSet clippingRectangleOrNil. |
|
513 |
mustUndoClip := true. |
|
514 |
dataSet clippingRectangle:(Rectangle |
|
515 |
left:xLeft top:yTop |
|
516 |
width:cashedWidth height:(drawnLabel heightOn:dataSet)). |
|
517 |
]. |
|
518 |
]. |
|
519 |
||
520 |
"/ drawnLabel isImageOrForm ifTrue:[ |
|
521 |
"/ y := yTop. |
|
522 |
"/ ] ifFalse:[ |
|
523 |
"/ y := (yTop + dataSet rowFontAscent) |
|
524 |
"/ ]. |
|
525 |
||
526 |
"/ drawnLabel isString ifFalse:[ |
|
527 |
"/ y := yTop + (drawnLabel ascentOn:dataSet). |
|
528 |
"/ ] ifTrue:[ |
|
529 |
"/ y := yTop + dataSet rowFontAscent |
|
530 |
"/ ]. |
|
531 |
"/ drawnLabel displayOn:dataSet x:x y:y. |
|
532 |
||
533 |
dataSet displayLabel:drawnLabel x:x y:yTop. |
|
534 |
||
535 |
mustUndoClip == true ifTrue:[ |
|
536 |
dataSet clippingRectangle:prevClip |
|
537 |
]. |
|
538 |
! |
|
539 |
||
1132 | 540 |
drawLabelsAtX:xLeft y:yTop h:h from:start to:stop |
541 |
"redraw labels from start to stop |
|
1088 | 542 |
" |
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
543 |
|fg y yT x hspace lblHg bg label row isSel cashedWidth| |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
544 |
|
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
545 |
cashedWidth := self width. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
546 |
cashedWidth isNil ifTrue:[ ^ self ]. |
2578 | 547 |
|
1132 | 548 |
yT := yTop. |
549 |
hspace := dataSet horizontalSpacing. |
|
1100 | 550 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
551 |
start to:stop do:[:aRowNr| |
3364
b7f6e426cd60
care for list change while drawing
Claus Gittinger <cg@exept.de>
parents:
3330
diff
changeset
|
552 |
row := dataSet at:aRowNr ifAbsent:[^ self]. |
1132 | 553 |
y := yT. |
554 |
x := xLeft. |
|
555 |
||
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
556 |
"/ GET BACKGROUND AND FOREGROUND-COLOR |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
557 |
"/ =================================== |
1132 | 558 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
559 |
isSel := dataSet isSelected:aRowNr inColumn:columnNumber. |
1132 | 560 |
|
561 |
(isSel and:[description showSelectionHighLighted]) ifTrue:[ |
|
562 |
"/ SHOW SELECTED( MUST REDRAW BACKGROUND ) |
|
563 |
"/ ======================================= |
|
2710
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
564 |
bg := self selectedBackgroundColorFor:row at:aRowNr. |
fcfa161492ae
added selectedFg/selectedBG attributes
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
565 |
fg := self selectedForegroundColorFor:row at:aRowNr. |
2578 | 566 |
|
1132 | 567 |
dataSet paint:bg. |
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
568 |
dataSet fillRectangleX:x y:y width:cashedWidth height:h. |
1113 | 569 |
] ifFalse:[ |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
570 |
description backgroundSelector notNil ifTrue:[ |
1132 | 571 |
"/ MUST REDRAW BACKGROUND |
572 |
"/ ====================== |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
573 |
bg := self backgroundColorFor:row at:aRowNr. |
1565 | 574 |
|
575 |
bg ~~ backgroundColor ifTrue:[ |
|
1132 | 576 |
bg := dataSet colorOnDevice:bg |
577 |
]. |
|
578 |
dataSet paint:bg. |
|
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
579 |
dataSet fillRectangleX:x y:y width:cashedWidth height:h. |
1132 | 580 |
] ifFalse:[ |
581 |
bg := backgroundColor |
|
582 |
]. |
|
1100 | 583 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
584 |
fg := self foregroundColorFor:row at:aRowNr. |
1565 | 585 |
|
586 |
fg ~~ foregroundColor ifTrue:[ |
|
1132 | 587 |
fg := dataSet colorOnDevice:fg |
1565 | 588 |
]. |
1132 | 589 |
]. |
833 | 590 |
|
1132 | 591 |
"/ GET AND DRAW LABEL |
592 |
"/ ================== |
|
2542 | 593 |
(self isRowVisible:aRowNr) ifTrue:[ |
594 |
rendererType == #rowSelector ifTrue:[ |
|
595 |
isSel ifTrue:[ |
|
596 |
label := dataSet rowSelectorForm. |
|
597 |
x := x + hspace. |
|
598 |
] ifFalse:[ |
|
599 |
label := nil |
|
600 |
] |
|
1132 | 601 |
] ifFalse:[ |
2542 | 602 |
(isSel and:[dataSet hasOpenEditor]) ifTrue:[ |
603 |
label := nil |
|
604 |
] ifFalse:[ |
|
605 |
label := self shownValueForRow:row rowNr:aRowNr |
|
606 |
] |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
607 |
]. |
2542 | 608 |
label notNil ifTrue:[ |
609 |
"/ care for a dark-colored label, |
|
610 |
"/ with a dark selection-bg color |
|
611 |
(isSel and:[label isString and:[label hasChangeOfEmphasis]]) ifTrue:[ |
|
612 |
"/ take away the labels own color info |
|
613 |
label := label emphasisAllRemove:#color. |
|
614 |
]. |
|
615 |
||
616 |
lblHg := self heightOfLabel:label. |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
617 |
|
2542 | 618 |
lblHg ~~ 0 ifTrue:[ |
3139 | 619 |
y := y + ((h - lblHg) // 2). |
2542 | 620 |
dataSet paint:fg on:bg. |
1113 | 621 |
|
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
622 |
label isString ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
623 |
(label includes:Character cr) ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
624 |
label := label asCollectionOfLines |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
625 |
]. |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
626 |
]. |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
627 |
|
2542 | 628 |
(label isSequenceable and:[label isString not]) ifFalse:[ |
629 |
self drawLabel:label atX:x y:y |
|
630 |
] ifTrue:[ |
|
631 |
label do:[:el| |
|
632 |
el notNil ifTrue:[ |
|
633 |
self drawLabel:el atX:x y:y. |
|
634 |
y := y + (el heightOn:dataSet). |
|
635 |
] |
|
1147 | 636 |
] |
2542 | 637 |
]. |
638 |
] |
|
639 |
]. |
|
1132 | 640 |
]. |
641 |
yT := yT + h |
|
642 |
] |
|
833 | 643 |
! |
644 |
||
3505 | 645 |
drawRendererInRow:rowNr x:xLeft y:y width:cellWidth value:cellValue |
646 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
647 |
(self hasChoices:rowNr) ifTrue:[ |
|
648 |
dataSet drawComboButtonAtX:xLeft y:y w:cellWidth |
|
649 |
]. |
|
650 |
^ self |
|
651 |
]. |
|
652 |
rendererType == #CheckToggle ifTrue:[ |
|
653 |
dataSet drawCheckToggleAtX:xLeft y:y w:cellWidth state:cellValue. |
|
654 |
^ self |
|
655 |
]. |
|
656 |
rendererType == #RadioButton ifTrue:[ |
|
657 |
dataSet drawRadioButtonAtX:xLeft y:y w:cellWidth state:cellValue. |
|
658 |
^ self |
|
659 |
]. |
|
660 |
! |
|
661 |
||
1132 | 662 |
drawSeparatorsAtX:xLeft y:yTop h:h from:start to:stop |
663 |
"redraw separators for cells between start and stop |
|
1088 | 664 |
" |
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
665 |
|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
|
666 |
|
1132 | 667 |
(showColSeparator or:[showRowSeparator]) ifFalse:[ |
668 |
^ self |
|
669 |
]. |
|
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
670 |
cashedWidth := self width. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
671 |
cashedWidth isNil ifTrue:[ ^ self ]. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
672 |
|
1132 | 673 |
is3D := dataSet has3Dseparators. |
674 |
||
1113 | 675 |
is3D ifTrue:[dataSet paint:(dataSet separatorDarkColor)] |
2638
f2b2ecc2c851
use user defined color for drawing separators in OneD mode
ca
parents:
2636
diff
changeset
|
676 |
ifFalse:[dataSet paint:(dataSet separatorOneDColor)]. |
1088 | 677 |
|
1132 | 678 |
times := stop - start + 1. |
679 |
xL := xLeft. |
|
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
680 |
xR := xL - 1 + cashedWidth. |
1088 | 681 |
|
1113 | 682 |
showRowSeparator ifTrue:[ |
1132 | 683 |
"/ DRAW SEPARATORS AT BOTTOM( DARK COLOR ) |
684 |
"/ ======================================= |
|
685 |
yB := yTop - 1 + h. |
|
686 |
||
687 |
rowSeparatorSelector isNil ifTrue:[ |
|
688 |
times timesRepeat:[ |
|
689 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB. |
|
690 |
yB := yB + h. |
|
691 |
] |
|
692 |
] ifFalse:[ |
|
693 |
start to:stop do:[:idx| |
|
3240
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
694 |
(self hasRowSeparatorAt:idx) ifTrue:[ |
1132 | 695 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB |
696 |
]. |
|
697 |
yB := yB + h. |
|
3240
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
698 |
]. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
699 |
]. |
1113 | 700 |
]. |
1132 | 701 |
|
1113 | 702 |
showColSeparator ifTrue:[ |
1132 | 703 |
"/ DRAW SEPARATORS AT RIGHT( DARK COLOR ) |
704 |
"/ ====================================== |
|
705 |
yT := yTop. |
|
706 |
||
707 |
times timesRepeat:[ |
|
708 |
dataSet displayLineFromX:xR y:yT toX:xR y:(yT - 1 + h). |
|
709 |
yT := yT + h. |
|
710 |
] |
|
1113 | 711 |
]. |
1089 | 712 |
|
1113 | 713 |
is3D ifFalse:[ |
714 |
^ self |
|
715 |
]. |
|
1088 | 716 |
|
1113 | 717 |
dataSet paint:(dataSet separatorLightColor). |
1040
c8e6a2ed7928
use the same background color for a selected rowSelector
ca
parents:
1007
diff
changeset
|
718 |
|
1113 | 719 |
( columnNumber == 1 |
3505 | 720 |
or:[(dataSet columnDescriptorAt:(columnNumber - 1)) showColSeparator] |
1113 | 721 |
) ifTrue:[ |
1132 | 722 |
|
723 |
"/ DRAW SEPARATORS AT LEFT( LIGHT COLOR ) |
|
724 |
"/ ====================================== |
|
725 |
yT := yTop. |
|
726 |
||
727 |
times timesRepeat:[ |
|
728 |
dataSet displayLineFromX:xL y:yT toX:xL y:(yT - 1 + h). |
|
729 |
yT := yT + h. |
|
730 |
]. |
|
1113 | 731 |
] ifFalse:[ |
1132 | 732 |
xL := xL - 1 |
1113 | 733 |
]. |
1092 | 734 |
|
1113 | 735 |
showRowSeparator ifTrue:[ |
1132 | 736 |
"/ DRAW SEPARATORS AT TOP( LIGHT COLOR ) |
737 |
"/ ===================================== |
|
738 |
yT := yTop. |
|
739 |
||
740 |
rowSeparatorSelector isNil ifTrue:[ |
|
741 |
times timesRepeat:[ |
|
742 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
|
743 |
yT := yT + h. |
|
744 |
] |
|
745 |
] ifFalse:[ |
|
746 |
"/ CHECK WHETHER PREVIOUS ROW HAS A SEPARATOR AT BOTTOM |
|
747 |
"/ ==================================================== |
|
748 |
start to:stop do:[:idx| |
|
3240
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
749 |
(idx == 1 or:[self hasRowSeparatorAt:(idx - 1)]) ifTrue:[ |
1132 | 750 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
751 |
]. |
|
752 |
yT := yT + h. |
|
753 |
] |
|
1088 | 754 |
] |
542 | 755 |
]. |
607 | 756 |
! |
757 |
||
542 | 758 |
invalidate |
1484 | 759 |
"invalidate width of column; forces a recomputation |
542 | 760 |
" |
1484 | 761 |
width := nil. |
542 | 762 |
|
1088 | 763 |
! |
764 |
||
1132 | 765 |
redrawX:xLeft y:yTop h:h from:start to:stop |
3505 | 766 |
"redraw all rows between start and stop" |
767 |
||
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
768 |
|rH y cashedWidth| |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
769 |
|
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
770 |
cashedWidth := self width. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
771 |
cashedWidth isNil ifTrue:[ ^ self ]. |
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
772 |
|
1132 | 773 |
rH := dataSet rowHeight. |
1088 | 774 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
775 |
description backgroundSelector isNil ifTrue:[ |
1132 | 776 |
dataSet paint:backgroundColor. |
3298
3408a7138374
Cache width during redraw. Should solve problems by setting width to nil
ab
parents:
3264
diff
changeset
|
777 |
dataSet fillRectangleX:xLeft y:yTop width:cashedWidth height:h |
1115 | 778 |
]. |
779 |
||
3505 | 780 |
"/ DRAW CELLS: BACKGROUND/FOREGROUND/LABEL |
781 |
"/ ======================================= |
|
1132 | 782 |
self drawLabelsAtX:xLeft y:yTop h:rH from:start to:stop. |
1113 | 783 |
|
3505 | 784 |
"/ DRAW RENDERED INDICATORS |
785 |
"/ ======================== |
|
786 |
rendererType notNil ifTrue:[ |
|
1132 | 787 |
y := yTop. |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
788 |
start to:stop do:[:rowNr| |
3505 | 789 |
|state| |
790 |
||
2542 | 791 |
(self isRowVisible:rowNr) ifTrue:[ |
3505 | 792 |
state := self at:rowNr. |
793 |
self drawRendererInRow:rowNr x:xLeft y:y width:cashedWidth value:state. |
|
1113 | 794 |
]. |
1132 | 795 |
y := y + rH. |
3505 | 796 |
]. |
1088 | 797 |
]. |
798 |
||
3505 | 799 |
"/ DRAW SEPARATORS |
800 |
"/ =============== |
|
1132 | 801 |
self drawSeparatorsAtX:xLeft y:yTop h:rH from:start to:stop |
2693 | 802 |
! |
803 |
||
804 |
shownValueForRow:aRow rowNr:aRowNr |
|
3325
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
805 |
|selector format value type choices translatedChoices idx converter| |
2693 | 806 |
|
807 |
rendererType == #CheckToggle ifTrue:[ |
|
808 |
^ nil |
|
809 |
]. |
|
3505 | 810 |
rendererType == #RadioButton ifTrue:[ |
811 |
^ nil |
|
812 |
]. |
|
2693 | 813 |
|
814 |
rendererType == #rowSelector ifTrue:[ |
|
815 |
^ nil |
|
816 |
]. |
|
817 |
||
818 |
selector := description printSelector. |
|
819 |
selector notNil ifTrue:[ |
|
820 |
^ aRow |
|
821 |
perform:selector |
|
822 |
withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet. |
|
823 |
]. |
|
824 |
||
825 |
value := self extractColFromRow:aRow rowNr:aRowNr. |
|
2865 | 826 |
description translatedChoices notNil ifTrue:[ |
827 |
choices := self choicesFor:aRow at:aRowNr. |
|
828 |
idx := choices indexOf:value. |
|
829 |
idx ~~ 0 ifTrue:[ |
|
830 |
translatedChoices := self translatedChoicesFor:aRow at:aRowNr. |
|
831 |
translatedChoices notNil ifTrue:[ |
|
832 |
value := translatedChoices at:idx. |
|
833 |
]. |
|
834 |
]. |
|
835 |
]. |
|
2693 | 836 |
|
837 |
selector := description formatSelector. |
|
838 |
selector notNil ifTrue:[ |
|
839 |
format := aRow |
|
3674 | 840 |
perform:selector asSymbol |
2693 | 841 |
withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet. |
842 |
] ifFalse:[ |
|
843 |
format := description formatString. |
|
844 |
]. |
|
845 |
format notNil ifTrue:[ |
|
846 |
"/ cannot remember what this was used for ... |
|
847 |
"/ (idx := format indexOf:$.) ~~ 0 ifTrue:[ |
|
848 |
"/ idx := format size - idx |
|
849 |
"/ ]. |
|
850 |
"/ format := '%0.', idx printString, 'f'. |
|
851 |
||
3674 | 852 |
^ value printStringFormat:format |
3325
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
853 |
]. |
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
854 |
|
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
855 |
type := description type. |
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
856 |
type ~~ #string ifTrue:[ |
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
857 |
converter := TypeConverter new perform:type. |
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
858 |
converter model:value. |
8d2a6394f01a
added/fixed printConverter handling
Claus Gittinger <cg@exept.de>
parents:
3320
diff
changeset
|
859 |
^ converter value. |
2693 | 860 |
]. |
861 |
||
862 |
^ value |
|
542 | 863 |
! ! |
864 |
||
614 | 865 |
!DataSetColumn methodsFor:'editing'! |
866 |
||
833 | 867 |
editorAt:aRowNr |
1268 | 868 |
|val row| |
614 | 869 |
|
3264
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
870 |
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
|
871 |
val := self extractColFromRow:row rowNr:aRowNr. |
614 | 872 |
|
833 | 873 |
val isText ifTrue:[val := val string]. |
2864
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
874 |
^ 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
|
875 |
|
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
876 |
"Modified: / 27-10-2007 / 10:26:15 / cg" |
2693 | 877 |
! ! |
878 |
||
879 |
!DataSetColumn methodsFor:'event handling'! |
|
880 |
||
881 |
doesNotUnderstand:aMessage |
|
882 |
||
883 |
(description respondsTo:(aMessage selector)) ifTrue:[ |
|
884 |
^ aMessage sendTo:description |
|
885 |
]. |
|
886 |
^ super doesNotUnderstand:aMessage |
|
887 |
||
888 |
! ! |
|
889 |
||
890 |
!DataSetColumn methodsFor:'grow & shrink'! |
|
891 |
||
892 |
growWidth:n |
|
893 |
"grow the width for n pixels |
|
894 |
" |
|
895 |
width := self width + n. |
|
896 |
||
897 |
||
898 |
! ! |
|
899 |
||
900 |
!DataSetColumn methodsFor:'initialization'! |
|
542 | 901 |
|
1147 | 902 |
on:aDSVColumnView description:aDescription columnNumber:aNumber label:aLabel |
542 | 903 |
"instance creation; set attributes dependent on the description |
904 |
" |
|
1089 | 905 |
columnNumber := aNumber. |
906 |
dataSet := aDSVColumnView. |
|
1147 | 907 |
label := aLabel. |
1487 | 908 |
|
1089 | 909 |
description := aDescription. |
910 |
rendererType := description rendererType. |
|
1496 | 911 |
containsText := ( rendererType ~~ #CheckToggle |
3505 | 912 |
and:[rendererType ~~ #RadioButton |
913 |
and:[rendererType ~~ #rowSelector]] |
|
1496 | 914 |
). |
1490 | 915 |
descWidth := description width. |
2424
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
916 |
longStringCompression := description longStringCompression. |
1526 | 917 |
|
918 |
description usePreferredWidth ifTrue:[ |
|
919 |
descWidth := 0 |
|
920 |
]. |
|
921 |
||
1565 | 922 |
width := nil. |
923 |
||
2693 | 924 |
minValue := description minValue. |
925 |
maxValue := description maxValue. |
|
1113 | 926 |
rowSeparatorSelector := description rowSeparatorSelector. |
1565 | 927 |
|
1113 | 928 |
showColSeparator := description showColSeparator. |
929 |
showRowSeparator := description showRowSeparator. |
|
1089 | 930 |
columnAdaptor := dataSet columnAdaptor. |
931 |
buttonExtent := 0 @ 0. |
|
932 |
columnAlignment := #left. |
|
584 | 933 |
|
1132 | 934 |
(backgroundColor := description backgroundColor) isNil ifTrue:[ |
935 |
backgroundColor := dataSet backgroundColor |
|
936 |
] ifFalse:[ |
|
1480 | 937 |
backgroundColor := backgroundColor onDevice:dataSet device |
584 | 938 |
]. |
1113 | 939 |
|
940 |
(foregroundColor := description foregroundColor) isNil ifTrue:[ |
|
941 |
foregroundColor := dataSet foregroundColor |
|
942 |
] ifFalse:[ |
|
1480 | 943 |
foregroundColor := foregroundColor onDevice:dataSet device |
584 | 944 |
]. |
542 | 945 |
|
946 |
rendererType == #CheckToggle ifTrue:[ |
|
1113 | 947 |
buttonExtent := dataSet checkToggleExtent. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
948 |
^ self |
542 | 949 |
]. |
3505 | 950 |
rendererType == #RadioButton ifTrue:[ |
951 |
buttonExtent := dataSet radioButtonExtent. |
|
952 |
^ self |
|
953 |
]. |
|
542 | 954 |
|
955 |
rendererType == #rowSelector ifTrue:[ |
|
807 | 956 |
buttonExtent := dataSet rowSelectorExtent. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
957 |
^ self |
542 | 958 |
]. |
959 |
||
960 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
807 | 961 |
buttonExtent := dataSet comboButtonExtent. |
883 | 962 |
] ifFalse:[ |
963 |
columnAlignment := description columnAlignment |
|
542 | 964 |
]. |
965 |
||
2444 | 966 |
"Modified: / 25.2.2000 / 14:25:56 / cg" |
2424
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
967 |
! ! |
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
968 |
|
621 | 969 |
!DataSetColumn methodsFor:'private'! |
970 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
971 |
extractColFromRow:aRow rowNr:rowNr |
3320 | 972 |
|readSelector col numArgs| |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
973 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
974 |
readSelector := description readSelector. |
1226 | 975 |
readSelector isNil ifTrue:[^ nil]. |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
976 |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
977 |
readSelector isBlock ifTrue:[ |
3320 | 978 |
numArgs := readSelector numArgs. |
979 |
numArgs == 0 ifTrue:[ |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
980 |
^ readSelector value |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
981 |
]. |
3320 | 982 |
numArgs == 1 ifTrue:[ |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
983 |
^ readSelector value:aRow |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
984 |
]. |
3320 | 985 |
numArgs == 2 ifTrue:[ |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
986 |
^ readSelector value:aRow value:columnNumber |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
987 |
]. |
3320 | 988 |
numArgs == 3 ifTrue:[ |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
989 |
^ readSelector value:aRow value:columnNumber value:rowNr |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
990 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
991 |
^ 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
|
992 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
993 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
994 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
995 |
^ 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
|
996 |
]. |
2635
a8add4698dea
care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents:
2613
diff
changeset
|
997 |
aRow isNil ifTrue:[^ nil]. |
a8add4698dea
care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents:
2613
diff
changeset
|
998 |
|
2444 | 999 |
col := aRow perform:readSelector withOptionalArgument:columnNumber and:rowNr and:dataSet. |
1000 |
^ col |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1001 |
! |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1002 |
|
2693 | 1003 |
storeCol:newValueArg inRow:aRow |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1004 |
|writeSelector numArgs newValue| |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1005 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1006 |
writeSelector := description writeSelector. |
1226 | 1007 |
writeSelector isNil ifTrue:[^ aRow]. |
1008 |
||
2693 | 1009 |
newValue := newValueArg. |
1010 |
(newValue isNumber) ifTrue:[ |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1011 |
minValue notNil ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1012 |
newValue < minValue ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1013 |
newValue := minValue |
2693 | 1014 |
] |
1015 |
]. |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1016 |
maxValue notNil ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1017 |
newValue > maxValue ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1018 |
newValue := maxValue |
2693 | 1019 |
] |
1020 |
]. |
|
1021 |
]. |
|
1022 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1023 |
numArgs := writeSelector numArgs. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1024 |
|
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1025 |
writeSelector isBlock ifTrue:[ |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1026 |
numArgs == 2 ifTrue:[ |
2863
c0585cbcd922
argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents:
2862
diff
changeset
|
1027 |
^ writeSelector value:newValue value:aRow |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1028 |
]. |
2863
c0585cbcd922
argument order when using write-store-blocks
Claus Gittinger <cg@exept.de>
parents:
2862
diff
changeset
|
1029 |
^ writeSelector value:newValue value:aRow value:columnNumber |
2862
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1030 |
]. |
3279303eabd8
allow for block in readselector/writeSelector
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
1031 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1032 |
columnAdaptor notNil ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1033 |
numArgs == 2 ifTrue:[ |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
1034 |
columnAdaptor perform:writeSelector with:aRow with:newValue. |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
1035 |
^ self |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1036 |
]. |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
1037 |
columnAdaptor perform:writeSelector with:aRow with:columnNumber with:newValue. |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
1038 |
^ self |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1039 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1040 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1041 |
numArgs == 1 ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1042 |
aRow perform:writeSelector with:newValue |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1043 |
] ifFalse:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1044 |
aRow perform:writeSelector with:columnNumber with:newValue |
1059 | 1045 |
]. |
621 | 1046 |
! ! |
1047 |
||
542 | 1048 |
!DataSetColumn methodsFor:'queries'! |
1049 |
||
1492 | 1050 |
canResize |
1051 |
||
1496 | 1052 |
containsText ifTrue:[ |
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
1053 |
^ descWidth == 0 or:[self hasRelativeWidth] |
1492 | 1054 |
]. |
1055 |
^ false |
|
1056 |
! |
|
1057 |
||
607 | 1058 |
canSelect:aRowNr |
3448
ef7d76d6bcfd
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3364
diff
changeset
|
1059 |
"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
|
1060 |
(possibly calls the selectSelector, if any)" |
ef7d76d6bcfd
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3364
diff
changeset
|
1061 |
|
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1062 |
|s row| |
607 | 1063 |
|
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1064 |
description canSelect ifFalse:[^ false]. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1065 |
s := description selectSelector. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1066 |
s isNil ifTrue:[^ true]. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1067 |
|
3264
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
1068 |
row := dataSet at:aRowNr ifAbsent:[^ false]. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
1069 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1070 |
^ columnAdaptor perform:s withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet |
607 | 1071 |
]. |
1072 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1073 |
^ 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
|
1074 |
|
642d79a1b0d6
care for non-exisiting columns (race condition)
Claus Gittinger <cg@exept.de>
parents:
3240
diff
changeset
|
1075 |
"Modified: / 27-10-2007 / 10:27:20 / cg" |
607 | 1076 |
! |
1077 |
||
2864
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1078 |
choicesFor:aRow at:aRowNr |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1079 |
|choicesSelector| |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1080 |
|
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1081 |
choicesSelector := description choices. |
2897 | 1082 |
choicesSelector isNil ifTrue:[^ nil]. |
2864
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1083 |
|
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1084 |
columnAdaptor notNil ifTrue:[ |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1085 |
^ 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
|
1086 |
]. |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1087 |
^ aRow perform:choicesSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1088 |
! |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1089 |
|
647 | 1090 |
containsText |
1091 |
"returns true if text might exist |
|
1092 |
" |
|
1496 | 1093 |
^ containsText |
647 | 1094 |
! |
1095 |
||
2074 | 1096 |
doubleClickOn:aRowNr |
2694 | 1097 |
|sel row| |
2074 | 1098 |
|
1099 |
(sel := self doubleClickedSelector) notNil ifTrue:[ |
|
2694 | 1100 |
row := dataSet at:aRowNr. |
2074 | 1101 |
columnAdaptor notNil ifTrue:[ |
2694 | 1102 |
^ columnAdaptor perform:sel withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet |
2074 | 1103 |
]. |
2694 | 1104 |
^ row perform:sel withOptionalArgument:columnNumber and:aRowNr and:dataSet |
2074 | 1105 |
]. |
1106 |
! |
|
1107 |
||
833 | 1108 |
hasChoices:aRowNr |
2864
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1109 |
|row| |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1110 |
|
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1111 |
row := dataSet at:aRowNr. |
a2b8598dc659
fix: choices via columnAdaptor
Claus Gittinger <cg@exept.de>
parents:
2863
diff
changeset
|
1112 |
^ (self choicesFor:row at:aRowNr) notNil |
833 | 1113 |
! |
1114 |
||
1950 | 1115 |
hasPotentialNonConstantBackground |
1116 |
(backgroundColor notNil and:[backgroundColor isImageOrForm]) ifTrue:[^ true]. |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1117 |
description backgroundSelector notNil ifTrue:[^ true]. |
1950 | 1118 |
^ false. |
1119 |
! |
|
1120 |
||
1484 | 1121 |
hasRelativeWidth |
1122 |
"returns true if width is relative |
|
1123 |
" |
|
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
1124 |
^ descWidth isLimitedPrecisionReal |
1484 | 1125 |
! |
1126 |
||
3240
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1127 |
hasRowSeparatorAt:rowNumber |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1128 |
|row bool| |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1129 |
|
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1130 |
rowSeparatorSelector isNil ifTrue:[^ true ]. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1131 |
row := dataSet at:rowNumber. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1132 |
|
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1133 |
columnAdaptor isNil ifTrue:[ |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1134 |
bool := row perform:rowSeparatorSelector. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1135 |
] ifFalse:[ |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1136 |
bool := columnAdaptor perform:rowSeparatorSelector |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1137 |
withOptionalArgument:row and:columnNumber and:rowNumber and:dataSet. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1138 |
]. |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1139 |
^ bool ~~ false |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1140 |
! |
2afa6e06b634
bugfix: columnAdapter notNil -> invoke rowSeparatorSelector
ca
parents:
3218
diff
changeset
|
1141 |
|
542 | 1142 |
heightOfHighestRow |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1143 |
"returns the height of the highest row in pixels. |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1144 |
Warning: |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1145 |
only the first numberOfRowsProbedForColumnSize are probed, |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1146 |
in case the access is expensive (dataBase apps) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1147 |
If the descriptor defines a height, that is used, and the items |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1148 |
are not probed at all. |
542 | 1149 |
" |
3505 | 1150 |
|h end bE editorType| |
542 | 1151 |
|
1496 | 1152 |
(h := description height) == 0 ifTrue:[ |
1153 |
containsText ifTrue:[ |
|
542 | 1154 |
"/ search first none empty drawable object |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1155 |
end := description numberOfRowsProbedForColumnSize min:dataSet size. |
542 | 1156 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1157 |
1 to:end do:[:rowNr| |row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1158 |
row := dataSet at:rowNr. |
2444 | 1159 |
h := h max:(self heightOfLabel:(self shownValueForRow:row rowNr:rowNr)) |
542 | 1160 |
] |
1161 |
] |
|
1162 |
]. |
|
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1163 |
(bE := buttonExtent y) = 0 ifTrue:[ |
3505 | 1164 |
editorType := description editorType. |
1165 |
(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
|
1166 |
bE := dataSet comboButtonExtent y. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1167 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1168 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1169 |
^ h max:bE |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1170 |
|
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1171 |
"Modified: / 25.2.2000 / 14:29:20 / cg" |
1113 | 1172 |
! |
1173 |
||
1147 | 1174 |
heightOfLabel:aLabel |
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1175 |
"returns the height of the label" |
1147 | 1176 |
|
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1177 |
aLabel isNil ifTrue:[ ^ 0 ]. |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1178 |
(aLabel isString) ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1179 |
"/ if multiple lines - count 'em |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1180 |
(aLabel includes:Character cr) ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1181 |
^ 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
|
1182 |
]. |
1496 | 1183 |
^ aLabel heightOn:dataSet |
1184 |
]. |
|
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1185 |
(aLabel isImageOrForm) ifTrue:[ |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1186 |
^ aLabel heightOn:dataSet |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1187 |
]. |
1147 | 1188 |
|
1496 | 1189 |
aLabel isSequenceable ifFalse:[ |
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1190 |
^ aLabel |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1191 |
perform:#heightOn: |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1192 |
with:dataSet |
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1193 |
ifNotUnderstood:[ aLabel displayString heightOn:dataSet ] |
1147 | 1194 |
]. |
1195 |
||
3462
d2df3607bfb5
mass operations: color selected-color
Claus Gittinger <cg@exept.de>
parents:
3460
diff
changeset
|
1196 |
^ aLabel inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)]. |
1147 | 1197 |
! |
1198 |
||
1937 | 1199 |
isResizeable |
1200 |
"returns true if the row is resizeable |
|
1201 |
" |
|
1202 |
^ description isResizeable |
|
1203 |
! |
|
1204 |
||
2542 | 1205 |
isRowVisible:rowNr |
1206 |
^ description rowIsVisible:(dataSet at:rowNr) |
|
1207 |
! |
|
1208 |
||
1113 | 1209 |
showColSeparator |
1210 |
"returns true if column separator is on |
|
1211 |
" |
|
1212 |
^ showColSeparator |
|
1133 | 1213 |
! |
1214 |
||
1215 |
showSelectionHighLighted |
|
1216 |
"returns true if selection is highLighted |
|
1217 |
" |
|
1218 |
^ description showSelectionHighLighted ~~ false |
|
1147 | 1219 |
! |
1220 |
||
2865 | 1221 |
translatedChoicesFor:aRow at:aRowNr |
1222 |
|translatedChoicesSelector| |
|
1223 |
||
1224 |
translatedChoicesSelector := description translatedChoices. |
|
1225 |
||
1226 |
columnAdaptor notNil ifTrue:[ |
|
1227 |
^ columnAdaptor perform:translatedChoicesSelector withOptionalArgument:aRow and:columnNumber and:aRowNr and:dataSet |
|
1228 |
]. |
|
1229 |
^ aRow perform:translatedChoicesSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
|
1230 |
! |
|
1231 |
||
1147 | 1232 |
widthOfLabel:aLabel |
1233 |
"returns the width of the label |
|
1234 |
" |
|
1496 | 1235 |
|w| |
1147 | 1236 |
|
1496 | 1237 |
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[ |
1238 |
^ aLabel widthOn:dataSet |
|
1239 |
]. |
|
1147 | 1240 |
aLabel isNil ifTrue:[ ^ 0 ]. |
1241 |
||
1496 | 1242 |
aLabel isSequenceable ifFalse:[ |
1243 |
^ aLabel perform:#widthOn: with:dataSet ifNotUnderstood:[ |
|
1244 |
aLabel displayString widthOn:dataSet |
|
1245 |
] |
|
1147 | 1246 |
]. |
1247 |
||
1496 | 1248 |
w := 0. |
1249 |
aLabel do:[:el|w := w max:(el widthOn:dataSet)]. |
|
1250 |
^ w |
|
542 | 1251 |
! ! |
1252 |
||
1253 |
!DataSetColumn methodsFor:'searching'! |
|
1254 |
||
1255 |
findRowNrStartingWithChar:aChar start:start stop:stop |
|
1256 |
"find the first row starting at start to stop, which drawable label |
|
1257 |
starts with the character, aChar. The index of the detected row is |
|
1258 |
returned or if no row is found 0. |
|
1259 |
" |
|
1260 |
|char| |
|
1261 |
||
1496 | 1262 |
containsText ifTrue:[ |
542 | 1263 |
char := aChar asLowercase. |
1264 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1265 |
start to:stop do:[:eachNr| |row lbl| |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1266 |
(dataSet isRowSelectable:eachNr) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1267 |
row := dataSet at:eachNr. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1268 |
lbl := self shownValueForRow:row rowNr:eachNr. |
1147 | 1269 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1270 |
(lbl isSequenceable and:[lbl isString not]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1271 |
lbl := lbl at:1 ifAbsent:nil |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1272 |
]. |
542 | 1273 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1274 |
(lbl respondsTo:#string) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1275 |
lbl := lbl string. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1276 |
(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
|
1277 |
^ eachNr |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1278 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1279 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1280 |
lbl isNil ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1281 |
^ 0 |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1282 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1283 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1284 |
]. |
542 | 1285 |
] |
1286 |
]. |
|
1287 |
^ 0 |
|
1288 |
! ! |
|
1289 |
||
1290 |
!DataSetColumn class methodsFor:'documentation'! |
|
1291 |
||
1292 |
version |
|
3674 | 1293 |
^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.123 2009-03-26 11:55:16 stefan Exp $' |
542 | 1294 |
! ! |