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