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