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