author | Claus Gittinger <cg@exept.de> |
Tue, 11 May 2004 14:50:21 +0200 | |
changeset 2704 | 0a09fd78eb54 |
parent 2694 | 82289374e92e |
child 2710 | fcfa161492ae |
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 |
" |
|
12 |
||
13 |
||
14 |
||
15 |
||
1818 | 16 |
"{ Package: 'stx:libwidg2' }" |
17 |
||
542 | 18 |
Object subclass:#DataSetColumn |
2444 | 19 |
instanceVariableNames:'columnNumber dataSet width description buttonExtent rendererType |
20 |
backgroundColor foregroundColor rowSeparatorSelector |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
21 |
showColSeparator showRowSeparator columnAlignment label |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
22 |
containsText columnAdaptor descWidth descMinWidth |
2693 | 23 |
longStringCompression minValue maxValue' |
1712 | 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 |
|
1088 | 60 |
description <DataSetColumnSpec> the column description |
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) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
105 |
Notice, if its expensive to fetch rows |
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 |
|
2221 | 126 |
|widthOf3Dots wRest shortenedLabel lUsed lMin lMax| |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
127 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
128 |
aString isString ifFalse:[^ aString]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
129 |
(aString widthOn:aGC) > maxWidth ifFalse:[aString]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
130 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
131 |
widthOf3Dots := '...' widthOn:aGC. |
2221 | 132 |
|
133 |
lMin := 1. |
|
134 |
lMax := aString size. |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
135 |
[ |
2221 | 136 |
lUsed := (lMax + lMin) // 2. |
137 |
wRest := aString widthFrom:1 to:lUsed on:aGC. |
|
138 |
wRest > (maxWidth-widthOf3Dots) ifTrue:[ |
|
139 |
lMax := lUsed - 1. |
|
140 |
] ifFalse:[ |
|
141 |
lMin := lUsed + 1. |
|
142 |
]. |
|
143 |
lMin < lMax |
|
144 |
] whileTrue. |
|
145 |
shortenedLabel := aString copyFrom:1 to:lUsed. |
|
146 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
147 |
shortenedLabel isEmpty ifTrue:[ |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
148 |
((aString first asString , '..') widthOn:aGC) < maxWidth ifTrue:[ |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
149 |
"/ only two dots and the first character |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
150 |
^ (aString first asString , '..') |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
151 |
] |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
152 |
]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
153 |
^ (shortenedLabel , '...'). |
542 | 154 |
! ! |
155 |
||
156 |
!DataSetColumn methodsFor:'accessing'! |
|
157 |
||
158 |
at:aRowNr |
|
159 |
"get the value of the raw at an index, aRowNr |
|
160 |
" |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
161 |
|
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
162 |
|row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
163 |
|
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
164 |
row := dataSet at:aRowNr. |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
165 |
^ self extractColFromRow:row rowNr:aRowNr. |
542 | 166 |
! |
167 |
||
168 |
at:aRowNr put:something |
|
169 |
"set the value of the raw at an index, aRowNr |
|
170 |
" |
|
1059 | 171 |
|row newRow| |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
172 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
173 |
row := dataSet at:aRowNr. |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
174 |
self storeCol:something inRow:row. |
542 | 175 |
! |
176 |
||
1558
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
177 |
columnAdaptor |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
178 |
^ columnAdaptor |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
179 |
! |
00b34d71898a
columnAdaptor also used when retrieving a ComboBoxes list.
Claus Gittinger <cg@exept.de>
parents:
1526
diff
changeset
|
180 |
|
1712 | 181 |
columnAdaptor:anAdapter |
182 |
columnAdaptor := anAdapter. |
|
183 |
! |
|
184 |
||
807 | 185 |
description |
186 |
"returns the column description |
|
187 |
" |
|
188 |
^ description |
|
189 |
||
190 |
||
191 |
! |
|
192 |
||
542 | 193 |
label |
194 |
"get the label assigned to the column |
|
195 |
" |
|
891 | 196 |
^ label |
542 | 197 |
|
198 |
||
199 |
! |
|
200 |
||
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
201 |
longStringCompression:aBoolean |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
202 |
^ longStringCompression ? true |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
203 |
! |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
204 |
|
1487 | 205 |
rendererType |
206 |
"returns my renderer type |
|
207 |
" |
|
208 |
^ rendererType |
|
209 |
! ! |
|
210 |
||
1818 | 211 |
!DataSetColumn methodsFor:'accessing-colors'! |
1565 | 212 |
|
213 |
backgroundColor |
|
214 |
"returns the background color or nil |
|
215 |
" |
|
216 |
^ backgroundColor == dataSet backgroundColor ifTrue:[nil] |
|
217 |
ifFalse:[backgroundColor] |
|
218 |
||
219 |
! |
|
220 |
||
2693 | 221 |
backgroundColor: aColor |
222 |
backgroundColor := aColor |
|
223 |
! |
|
224 |
||
1565 | 225 |
backgroundColorAt:aRowNr |
226 |
"returns the background color for a row at list index a rowNr |
|
227 |
" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
228 |
description backgroundSelector notNil ifTrue:[ |
1565 | 229 |
^ self backgroundColorFor:(dataSet at:aRowNr) at:aRowNr |
230 |
]. |
|
231 |
^ backgroundColor |
|
232 |
! |
|
233 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
234 |
backgroundColorFor:aRow at:aRowNr |
1565 | 235 |
"returns the background color for a row at list index a rowNr |
236 |
" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
237 |
|bgSelector bg| |
1565 | 238 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
239 |
bgSelector := description backgroundSelector. |
1565 | 240 |
bgSelector notNil ifTrue:[ |
1924 | 241 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
242 |
bg := columnAdaptor perform:bgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet |
1565 | 243 |
] ifFalse:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
244 |
bg := aRow perform:bgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet |
1565 | 245 |
]. |
1928
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
246 |
bg notNil ifTrue:[ |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
247 |
(bg isColor or:[bg isImageOrForm]) ifTrue:[ |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
248 |
^ bg |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
249 |
]. |
1950 | 250 |
self halt:'unexpected bg (not 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
|
251 |
] |
1565 | 252 |
]. |
253 |
^ backgroundColor |
|
254 |
! |
|
255 |
||
256 |
foregroundColor |
|
257 |
"returns the foreground color or nil |
|
258 |
" |
|
259 |
^ foregroundColor == dataSet foregroundColor ifTrue:[nil] |
|
260 |
ifFalse:[foregroundColor] |
|
261 |
||
262 |
! |
|
263 |
||
2693 | 264 |
foregroundColor: aColor |
265 |
foregroundColor := aColor |
|
266 |
! |
|
267 |
||
1565 | 268 |
foregroundColorFor:aRow at:aRowNr |
269 |
"returns the foreground color for a row at list index a rowNr |
|
270 |
" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
271 |
|fgSelector fg| |
1565 | 272 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
273 |
fgSelector := description foregroundSelector. |
1565 | 274 |
fgSelector notNil ifTrue:[ |
1924 | 275 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
276 |
fg := columnAdaptor perform:fgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet |
1565 | 277 |
] ifFalse:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
278 |
fg := aRow perform:fgSelector withOptionalArgument:aRowNr and:dataSet |
1565 | 279 |
]. |
1928
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
280 |
fg notNil ifTrue:[ |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
281 |
(fg isColor or:[fg isImageOrForm]) ifTrue:[ |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
282 |
^ fg |
2dcf8e62af64
debug: care for non-color to be returned from fg/bg message.
Claus Gittinger <cg@exept.de>
parents:
1924
diff
changeset
|
283 |
]. |
1950 | 284 |
self halt:'unexpected fg (not 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
|
285 |
] |
1565 | 286 |
]. |
287 |
^ foregroundColor |
|
288 |
! ! |
|
289 |
||
1818 | 290 |
!DataSetColumn methodsFor:'accessing-dimension'! |
1487 | 291 |
|
1484 | 292 |
minWidth |
1490 | 293 |
"get the minimum width required by the column |
1484 | 294 |
" |
1490 | 295 |
descMinWidth notNil ifTrue:[ |
296 |
^ descMinWidth |
|
297 |
]. |
|
298 |
width := nil. |
|
299 |
^ self width |
|
1484 | 300 |
|
1490 | 301 |
! |
302 |
||
1492 | 303 |
minimumRequiredWidth |
304 |
"returns the minimum required width |
|
305 |
" |
|
306 |
|minWidth| |
|
307 |
||
1940 | 308 |
descMinWidth notNil ifTrue:[ |
309 |
minWidth := DSVLabelView tabSpacing max:2. |
|
310 |
^ minWidth // 2 + minWidth |
|
311 |
]. |
|
1492 | 312 |
|
1940 | 313 |
minWidth := dataSet separatorSize + (2 * dataSet horizontalSpacing). |
314 |
^ minWidth + label preferredWidth. |
|
1492 | 315 |
! |
316 |
||
1490 | 317 |
setDescWidth:aWidth |
318 |
"set a fixed width |
|
319 |
" |
|
1940 | 320 |
descMinWidth := 1. |
321 |
descMinWidth := width := descWidth := self minimumRequiredWidth max:aWidth. |
|
1484 | 322 |
! |
323 |
||
542 | 324 |
width |
325 |
"returns the width in pixels |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
326 |
Warning: |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
327 |
only the first numberOfRowsProbedForColumnSize are probed, |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
328 |
in case the access is expensive (dataBase apps) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
329 |
If the descriptor defines a width, that is used, and the items |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
330 |
are not probed at all." |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
331 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
332 |
|max "{ Class:SmallInteger }" |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
333 |
listSize "{ Class:SmallInteger }"| |
542 | 334 |
|
1484 | 335 |
width notNil ifTrue:[^ width]. "/ already computed |
542 | 336 |
|
1490 | 337 |
descMinWidth notNil ifTrue:[ |
338 |
width := descMinWidth. |
|
339 |
^ width |
|
1484 | 340 |
]. |
1482 | 341 |
|
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
342 |
(descWidth ~~ 0 and:[descWidth isLimitedPrecisionReal not]) ifTrue:[ |
1493 | 343 |
width := descMinWidth := descWidth. |
344 |
^ width |
|
345 |
]. |
|
346 |
||
1490 | 347 |
width := description minWidth max:(label preferredWidth). |
348 |
||
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
349 |
descWidth isLimitedPrecisionReal ifTrue:[ |
2093 | 350 |
width := width max:(descWidth * dataSet innerWidth) rounded. |
1490 | 351 |
^ width |
1482 | 352 |
]. |
353 |
||
1496 | 354 |
containsText ifTrue:[ |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
355 |
"/ take maximum numberOfRowsProbedForColumnSize entries to calculate the width; |
1484 | 356 |
"/ can be resized later if neccessary |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
357 |
listSize := dataSet size. |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
358 |
max := listSize min:description numberOfRowsProbedForColumnSize. |
542 | 359 |
|
1526 | 360 |
max ~~ 0 ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
361 |
1 to:max do:[:rowNr| |row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
362 |
row := dataSet at:rowNr. |
2444 | 363 |
width := width max:(self widthOfLabel:(self shownValueForRow:row rowNr:rowNr)) |
1526 | 364 |
]. |
2444 | 365 |
width := width max:(self widthOfLabel:(self shownValueForRow:(dataSet at:listSize) rowNr:listSize)) |
1484 | 366 |
]. |
367 |
description editorType ~~ #None ifTrue:[ |
|
368 |
width := width + (dataSet font widthOn:dataSet device) |
|
542 | 369 |
]. |
1493 | 370 |
] ifFalse:[ |
371 |
max := 1 |
|
1484 | 372 |
]. |
1490 | 373 |
width := width + buttonExtent x + dataSet separatorSize + (2 * dataSet horizontalSpacing). |
1493 | 374 |
|
375 |
max ~~ 0 ifTrue:[ |
|
1526 | 376 |
descMinWidth := width. |
377 |
description usePreferredWidth ifTrue:[ |
|
378 |
descWidth := width |
|
379 |
] |
|
1493 | 380 |
]. |
1490 | 381 |
^ width |
1484 | 382 |
|
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
383 |
"Modified: / 25.2.2000 / 14:29:16 / cg" |
542 | 384 |
! ! |
385 |
||
386 |
!DataSetColumn methodsFor:'drawing'! |
|
387 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
388 |
drawLabel:aLabelToDraw atX:xLeft y:yTop |
2420
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
389 |
"draw aLabelToDraw; handle columnAlignment" |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
390 |
|
2581
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
391 |
|drawnLabel x space prevClip mustUndoClip |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
392 |
labelWidth leftPart leftShift indexOfFirstDigit indexOfFirstNonDigit| |
1147 | 393 |
|
394 |
space := dataSet horizontalSpacing. |
|
395 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
396 |
drawnLabel := aLabelToDraw. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
397 |
labelWidth := drawnLabel widthOn:dataSet. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
398 |
|
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
399 |
(longStringCompression ~~ false |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
400 |
and:[ drawnLabel isString |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
401 |
and:[ labelWidth > width]]) ifTrue:[ |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
402 |
drawnLabel := self class shortenedStringFor:drawnLabel on:dataSet maxWidth:width-space. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
403 |
labelWidth := drawnLabel widthOn:dataSet. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
404 |
]. |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
405 |
|
1147 | 406 |
columnAlignment == #left ifTrue:[ |
407 |
x := xLeft + space. |
|
408 |
] ifFalse:[ |
|
2420
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
409 |
columnAlignment == #decimal ifTrue:[ |
2581
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
410 |
(drawnLabel includes:$.) ifTrue:[ |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
411 |
leftPart := drawnLabel upTo:$.. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
412 |
] ifFalse:[ |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
413 |
leftPart := drawnLabel. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
414 |
|
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
415 |
indexOfFirstDigit := drawnLabel findFirst:[:char | char isDigit]. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
416 |
indexOfFirstDigit ~~ 0 ifTrue:[ |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
417 |
indexOfFirstNonDigit := drawnLabel findFirst:[:char | char isDigit not] startingAt:indexOfFirstDigit+1. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
418 |
indexOfFirstNonDigit ~~ 0 ifTrue:[ |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
419 |
leftPart := drawnLabel copyTo:indexOfFirstNonDigit-1. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
420 |
]. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
421 |
]. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
422 |
]. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
423 |
leftShift := leftPart widthOn:dataSet. |
2b6656c0b046
care for numbers without decimal point in decimal adjust
Claus Gittinger <cg@exept.de>
parents:
2578
diff
changeset
|
424 |
x := (width // 2) - leftShift. |
2420
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
425 |
] ifFalse:[ |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
426 |
x := width - labelWidth. |
1147 | 427 |
|
2420
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
428 |
columnAlignment == #right ifTrue:[x := x - space] |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
429 |
ifFalse:[x := x // 2]. |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
430 |
]. |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
431 |
"/ cg: old code (did not right-align if string is larger than width |
9b4e4333004a
added #decimal columnAlignment.
Claus Gittinger <cg@exept.de>
parents:
2419
diff
changeset
|
432 |
"/ x := xLeft + (x max:0). |
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
433 |
|
1587 | 434 |
"/ new code: always right-align. |
435 |
x := xLeft + x. |
|
436 |
||
437 |
"/ must clip left, if string is too large |
|
438 |
x < xLeft ifTrue:[ |
|
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
439 |
"/ must clip ... |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
440 |
prevClip := dataSet clippingRectangleOrNil. |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
441 |
mustUndoClip := true. |
1591
6996391ee3ba
Avoid obsolete method. (stefan)
Claus Gittinger <cg@exept.de>
parents:
1590
diff
changeset
|
442 |
dataSet clippingRectangle:(Rectangle |
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
443 |
left:xLeft top:yTop |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
444 |
width:width height:(drawnLabel heightOn:dataSet)). |
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
445 |
]. |
1147 | 446 |
]. |
1447 | 447 |
|
2443
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
448 |
"/ drawnLabel isImageOrForm ifTrue:[ |
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
449 |
"/ y := yTop. |
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
450 |
"/ ] ifFalse:[ |
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
451 |
"/ y := (yTop + dataSet rowFontAscent) |
e88b4123061a
changes to allow for Object>>displayOn:x:y: to work correctly
Claus Gittinger <cg@exept.de>
parents:
2424
diff
changeset
|
452 |
"/ ]. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
453 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
454 |
"/ drawnLabel isString ifFalse:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
455 |
"/ y := yTop + (drawnLabel ascentOn:dataSet). |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
456 |
"/ ] ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
457 |
"/ y := yTop + dataSet rowFontAscent |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
458 |
"/ ]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
459 |
"/ drawnLabel displayOn:dataSet x:x y:y. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
460 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2581
diff
changeset
|
461 |
dataSet displayLabel:drawnLabel x:x y:yTop. |
1147 | 462 |
|
1586
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
463 |
mustUndoClip == true ifTrue:[ |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
464 |
dataSet clippingRectangle:prevClip |
c87e9c9b298f
always right-align a right-aligned field
Claus Gittinger <cg@exept.de>
parents:
1565
diff
changeset
|
465 |
]. |
1147 | 466 |
! |
467 |
||
1132 | 468 |
drawLabelsAtX:xLeft y:yTop h:h from:start to:stop |
469 |
"redraw labels from start to stop |
|
1088 | 470 |
" |
2613
2de5a812418b
nomore win-workaround for drawbug when filling a rectangle
ca
parents:
2592
diff
changeset
|
471 |
|fg y yT x hspace lblHg bg label row isSel| |
2578 | 472 |
|
1132 | 473 |
yT := yTop. |
474 |
hspace := dataSet horizontalSpacing. |
|
1100 | 475 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
476 |
start to:stop do:[:aRowNr| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
477 |
row := dataSet at:aRowNr. |
1132 | 478 |
y := yT. |
479 |
x := xLeft. |
|
480 |
||
481 |
"/ GET BACKGROUND AND FOREGROUND-COLOR |
|
482 |
"/ =================================== |
|
483 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
484 |
isSel := dataSet isSelected:aRowNr inColumn:columnNumber. |
1132 | 485 |
|
2578 | 486 |
isSel ifTrue:[ |
1132 | 487 |
( description editorType ~~ #None |
488 |
and:[dataSet selectedColIndex == columnNumber] |
|
489 |
) ifTrue:[ |
|
490 |
isSel := false |
|
1115 | 491 |
] |
1113 | 492 |
]. |
493 |
||
1132 | 494 |
(isSel and:[description showSelectionHighLighted]) ifTrue:[ |
495 |
"/ SHOW SELECTED( MUST REDRAW BACKGROUND ) |
|
496 |
"/ ======================================= |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
497 |
fg := dataSet selectionForegroundColor. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
498 |
bg := dataSet selectionBackgroundColor. |
2578 | 499 |
|
1132 | 500 |
dataSet paint:bg. |
2613
2de5a812418b
nomore win-workaround for drawbug when filling a rectangle
ca
parents:
2592
diff
changeset
|
501 |
dataSet fillRectangleX:x y:y width:width height:h. |
1113 | 502 |
] ifFalse:[ |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
503 |
description backgroundSelector notNil ifTrue:[ |
1132 | 504 |
"/ MUST REDRAW BACKGROUND |
505 |
"/ ====================== |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
506 |
bg := self backgroundColorFor:row at:aRowNr. |
1565 | 507 |
|
508 |
bg ~~ backgroundColor ifTrue:[ |
|
1132 | 509 |
bg := dataSet colorOnDevice:bg |
510 |
]. |
|
511 |
dataSet paint:bg. |
|
512 |
dataSet fillRectangleX:x y:y width:width height:h. |
|
513 |
] ifFalse:[ |
|
514 |
bg := backgroundColor |
|
515 |
]. |
|
1100 | 516 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
517 |
fg := self foregroundColorFor:row at:aRowNr. |
1565 | 518 |
|
519 |
fg ~~ foregroundColor ifTrue:[ |
|
1132 | 520 |
fg := dataSet colorOnDevice:fg |
1565 | 521 |
]. |
1132 | 522 |
]. |
833 | 523 |
|
1132 | 524 |
"/ GET AND DRAW LABEL |
525 |
"/ ================== |
|
2542 | 526 |
(self isRowVisible:aRowNr) ifTrue:[ |
527 |
rendererType == #rowSelector ifTrue:[ |
|
528 |
isSel ifTrue:[ |
|
529 |
label := dataSet rowSelectorForm. |
|
530 |
x := x + hspace. |
|
531 |
] ifFalse:[ |
|
532 |
label := nil |
|
533 |
] |
|
1132 | 534 |
] ifFalse:[ |
2542 | 535 |
(isSel and:[dataSet hasOpenEditor]) ifTrue:[ |
536 |
label := nil |
|
537 |
] ifFalse:[ |
|
538 |
label := self shownValueForRow:row rowNr:aRowNr |
|
539 |
] |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
540 |
]. |
2542 | 541 |
label notNil ifTrue:[ |
542 |
"/ care for a dark-colored label, |
|
543 |
"/ with a dark selection-bg color |
|
544 |
(isSel and:[label isString and:[label hasChangeOfEmphasis]]) ifTrue:[ |
|
545 |
"/ take away the labels own color info |
|
546 |
label := label emphasisAllRemove:#color. |
|
547 |
]. |
|
548 |
||
549 |
lblHg := self heightOfLabel:label. |
|
1589
8bb71707b51a
remove any color emphasis when displaying the selection.
Claus Gittinger <cg@exept.de>
parents:
1587
diff
changeset
|
550 |
|
2542 | 551 |
lblHg ~~ 0 ifTrue:[ |
552 |
y := y + (h - lblHg // 2). |
|
553 |
dataSet paint:fg on:bg. |
|
1113 | 554 |
|
2542 | 555 |
(label isSequenceable and:[label isString not]) ifFalse:[ |
556 |
self drawLabel:label atX:x y:y |
|
557 |
] ifTrue:[ |
|
558 |
label do:[:el| |
|
559 |
el notNil ifTrue:[ |
|
560 |
self drawLabel:el atX:x y:y. |
|
561 |
y := y + (el heightOn:dataSet). |
|
562 |
] |
|
1147 | 563 |
] |
2542 | 564 |
]. |
565 |
] |
|
566 |
]. |
|
1132 | 567 |
]. |
568 |
yT := yT + h |
|
569 |
] |
|
833 | 570 |
! |
571 |
||
1132 | 572 |
drawSeparatorsAtX:xLeft y:yTop h:h from:start to:stop |
573 |
"redraw separators for cells between start and stop |
|
1088 | 574 |
" |
1132 | 575 |
|is3D |
576 |
xL "{ Class:SmallInteger }" |
|
1113 | 577 |
xR "{ Class:SmallInteger }" |
578 |
yB "{ Class:SmallInteger }" |
|
579 |
yT "{ Class:SmallInteger }" |
|
1132 | 580 |
times "{ Class:SmallInteger }" |
1088 | 581 |
| |
1132 | 582 |
(showColSeparator or:[showRowSeparator]) ifFalse:[ |
583 |
^ self |
|
584 |
]. |
|
585 |
is3D := dataSet has3Dseparators. |
|
586 |
||
1113 | 587 |
is3D ifTrue:[dataSet paint:(dataSet separatorDarkColor)] |
2638
f2b2ecc2c851
use user defined color for drawing separators in OneD mode
ca
parents:
2636
diff
changeset
|
588 |
ifFalse:[dataSet paint:(dataSet separatorOneDColor)]. |
1088 | 589 |
|
1132 | 590 |
times := stop - start + 1. |
591 |
xL := xLeft. |
|
592 |
xR := xL - 1 + width. |
|
1088 | 593 |
|
1113 | 594 |
showRowSeparator ifTrue:[ |
1132 | 595 |
"/ DRAW SEPARATORS AT BOTTOM( DARK COLOR ) |
596 |
"/ ======================================= |
|
597 |
yB := yTop - 1 + h. |
|
598 |
||
599 |
rowSeparatorSelector isNil ifTrue:[ |
|
600 |
times timesRepeat:[ |
|
601 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB. |
|
602 |
yB := yB + h. |
|
603 |
] |
|
604 |
] ifFalse:[ |
|
605 |
start to:stop do:[:idx| |
|
606 |
((dataSet at:idx) perform:rowSeparatorSelector) ~~ false ifTrue:[ |
|
607 |
dataSet displayLineFromX:xL y:yB toX:xR y:yB |
|
608 |
]. |
|
609 |
yB := yB + h. |
|
610 |
] |
|
1113 | 611 |
] |
612 |
]. |
|
1132 | 613 |
|
1113 | 614 |
showColSeparator ifTrue:[ |
1132 | 615 |
"/ DRAW SEPARATORS AT RIGHT( DARK COLOR ) |
616 |
"/ ====================================== |
|
617 |
yT := yTop. |
|
618 |
||
619 |
times timesRepeat:[ |
|
620 |
dataSet displayLineFromX:xR y:yT toX:xR y:(yT - 1 + h). |
|
621 |
yT := yT + h. |
|
622 |
] |
|
1113 | 623 |
]. |
1089 | 624 |
|
1113 | 625 |
is3D ifFalse:[ |
626 |
^ self |
|
627 |
]. |
|
1088 | 628 |
|
1113 | 629 |
dataSet paint:(dataSet separatorLightColor). |
1040
c8e6a2ed7928
use the same background color for a selected rowSelector
ca
parents:
1007
diff
changeset
|
630 |
|
1113 | 631 |
( columnNumber == 1 |
632 |
or:[(dataSet columnAt:(columnNumber - 1)) showColSeparator] |
|
633 |
) ifTrue:[ |
|
1132 | 634 |
|
635 |
"/ DRAW SEPARATORS AT LEFT( LIGHT COLOR ) |
|
636 |
"/ ====================================== |
|
637 |
yT := yTop. |
|
638 |
||
639 |
times timesRepeat:[ |
|
640 |
dataSet displayLineFromX:xL y:yT toX:xL y:(yT - 1 + h). |
|
641 |
yT := yT + h. |
|
642 |
]. |
|
1113 | 643 |
] ifFalse:[ |
1132 | 644 |
xL := xL - 1 |
1113 | 645 |
]. |
1092 | 646 |
|
1113 | 647 |
showRowSeparator ifTrue:[ |
1132 | 648 |
"/ DRAW SEPARATORS AT TOP( LIGHT COLOR ) |
649 |
"/ ===================================== |
|
650 |
yT := yTop. |
|
651 |
||
652 |
rowSeparatorSelector isNil ifTrue:[ |
|
653 |
times timesRepeat:[ |
|
654 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
|
655 |
yT := yT + h. |
|
656 |
] |
|
657 |
] ifFalse:[ |
|
658 |
"/ CHECK WHETHER PREVIOUS ROW HAS A SEPARATOR AT BOTTOM |
|
659 |
"/ ==================================================== |
|
660 |
start to:stop do:[:idx| |
|
661 |
( idx == 1 |
|
662 |
or:[((dataSet at:(idx - 1)) perform:rowSeparatorSelector) ~~ false] |
|
663 |
) ifTrue:[ |
|
664 |
dataSet displayLineFromX:xL y:yT toX:xR y:yT. |
|
665 |
]. |
|
666 |
yT := yT + h. |
|
667 |
] |
|
1088 | 668 |
] |
542 | 669 |
]. |
607 | 670 |
! |
671 |
||
542 | 672 |
invalidate |
1484 | 673 |
"invalidate width of column; forces a recomputation |
542 | 674 |
" |
1484 | 675 |
width := nil. |
542 | 676 |
|
1088 | 677 |
! |
678 |
||
1132 | 679 |
redrawX:xLeft y:yTop h:h from:start to:stop |
1088 | 680 |
"redraw rows between start and stop |
681 |
" |
|
1132 | 682 |
|rH "{ Class:SmallInteger }" |
683 |
y "{ Class:SmallInteger }" |
|
1088 | 684 |
| |
1132 | 685 |
rH := dataSet rowHeight. |
1088 | 686 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
687 |
description backgroundSelector isNil ifTrue:[ |
1132 | 688 |
dataSet paint:backgroundColor. |
689 |
dataSet fillRectangleX:xLeft y:yTop width:width height:h |
|
1115 | 690 |
]. |
691 |
||
1132 | 692 |
"/ DRAW CELLS: BACKGROUND/FOREGROUND/LABEL |
693 |
"/ ======================================= |
|
694 |
self drawLabelsAtX:xLeft y:yTop h:rH from:start to:stop. |
|
1113 | 695 |
|
696 |
"/ DRAW INDICATORS |
|
697 |
"/ =============== |
|
698 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
1132 | 699 |
y := yTop. |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
700 |
start to:stop do:[:rowNr| |
2542 | 701 |
(self isRowVisible:rowNr) ifTrue:[ |
702 |
(self hasChoices:rowNr) ifTrue:[ |
|
703 |
dataSet drawComboButtonAtX:xLeft y:y w:width |
|
704 |
]. |
|
1113 | 705 |
]. |
1132 | 706 |
y := y + rH. |
1113 | 707 |
] |
708 |
] ifFalse:[ |
|
709 |
rendererType == #CheckToggle ifTrue:[ |
|
1132 | 710 |
y := yTop. |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
711 |
start to:stop do:[:rowNr| |state| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
712 |
state := self at:rowNr. |
2542 | 713 |
(self isRowVisible:rowNr) ifTrue:[ |
714 |
dataSet drawCheckToggleAtX:xLeft y:y w:width state:state. |
|
715 |
]. |
|
1132 | 716 |
y := y + rH. |
1113 | 717 |
] |
718 |
] |
|
1088 | 719 |
]. |
720 |
||
721 |
"/ DRAW SEPARATORS |
|
1113 | 722 |
"/ =============== |
1132 | 723 |
self drawSeparatorsAtX:xLeft y:yTop h:rH from:start to:stop |
2693 | 724 |
! |
725 |
||
726 |
shownValueForRow:aRow rowNr:aRowNr |
|
727 |
|selector format value| |
|
728 |
||
729 |
rendererType == #CheckToggle ifTrue:[ |
|
730 |
^ nil |
|
731 |
]. |
|
732 |
||
733 |
rendererType == #rowSelector ifTrue:[ |
|
734 |
^ nil |
|
735 |
]. |
|
736 |
||
737 |
selector := description printSelector. |
|
738 |
selector notNil ifTrue:[ |
|
739 |
^ aRow |
|
740 |
perform:selector |
|
741 |
withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet. |
|
742 |
]. |
|
743 |
||
744 |
value := self extractColFromRow:aRow rowNr:aRowNr. |
|
745 |
||
746 |
selector := description formatSelector. |
|
747 |
selector notNil ifTrue:[ |
|
748 |
format := aRow |
|
749 |
perform:selector |
|
750 |
withOptionalArgument:dataSet and:columnNumber and:aRowNr and:dataSet. |
|
751 |
] ifFalse:[ |
|
752 |
format := description formatString. |
|
753 |
]. |
|
754 |
format notNil ifTrue:[ |
|
755 |
"/ cannot remember what this was used for ... |
|
756 |
"/ (idx := format indexOf:$.) ~~ 0 ifTrue:[ |
|
757 |
"/ idx := format size - idx |
|
758 |
"/ ]. |
|
759 |
"/ format := '%0.', idx printString, 'f'. |
|
760 |
||
761 |
value isLimitedPrecisionReal ifTrue:[ |
|
762 |
value := value asFloat. |
|
763 |
]. |
|
764 |
value := value printfPrintString:format |
|
765 |
]. |
|
766 |
||
767 |
^ value |
|
542 | 768 |
! ! |
769 |
||
614 | 770 |
!DataSetColumn methodsFor:'editing'! |
771 |
||
833 | 772 |
editorAt:aRowNr |
1268 | 773 |
|val row| |
614 | 774 |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
775 |
row := (dataSet at:aRowNr). |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
776 |
val := self extractColFromRow:row rowNr:aRowNr. |
614 | 777 |
|
833 | 778 |
val isText ifTrue:[val := val string]. |
1984
ccdfdf1c89af
fetch editor from adaptor if not nil.
Claus Gittinger <cg@exept.de>
parents:
1950
diff
changeset
|
779 |
^ description editorOn:row column:self value:val usingAdaptor:columnAdaptor. |
2693 | 780 |
! ! |
781 |
||
782 |
!DataSetColumn methodsFor:'event handling'! |
|
783 |
||
784 |
doesNotUnderstand:aMessage |
|
785 |
||
786 |
(description respondsTo:(aMessage selector)) ifTrue:[ |
|
787 |
^ aMessage sendTo:description |
|
788 |
]. |
|
789 |
^ super doesNotUnderstand:aMessage |
|
790 |
||
791 |
! ! |
|
792 |
||
793 |
!DataSetColumn methodsFor:'grow & shrink'! |
|
794 |
||
795 |
growWidth:n |
|
796 |
"grow the width for n pixels |
|
797 |
" |
|
798 |
width := self width + n. |
|
799 |
||
800 |
||
801 |
! ! |
|
802 |
||
803 |
!DataSetColumn methodsFor:'initialization'! |
|
542 | 804 |
|
1147 | 805 |
on:aDSVColumnView description:aDescription columnNumber:aNumber label:aLabel |
542 | 806 |
"instance creation; set attributes dependent on the description |
807 |
" |
|
1089 | 808 |
columnNumber := aNumber. |
809 |
dataSet := aDSVColumnView. |
|
1147 | 810 |
label := aLabel. |
1487 | 811 |
|
1089 | 812 |
description := aDescription. |
813 |
rendererType := description rendererType. |
|
1496 | 814 |
containsText := ( rendererType ~~ #CheckToggle |
815 |
and:[rendererType ~~ #rowSelector] |
|
816 |
). |
|
1490 | 817 |
descWidth := description width. |
2424
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
818 |
longStringCompression := description longStringCompression. |
1526 | 819 |
|
820 |
description usePreferredWidth ifTrue:[ |
|
821 |
descWidth := 0 |
|
822 |
]. |
|
823 |
||
1565 | 824 |
width := nil. |
825 |
||
2693 | 826 |
minValue := description minValue. |
827 |
maxValue := description maxValue. |
|
1113 | 828 |
rowSeparatorSelector := description rowSeparatorSelector. |
1565 | 829 |
|
1113 | 830 |
showColSeparator := description showColSeparator. |
831 |
showRowSeparator := description showRowSeparator. |
|
1089 | 832 |
columnAdaptor := dataSet columnAdaptor. |
833 |
buttonExtent := 0 @ 0. |
|
834 |
columnAlignment := #left. |
|
584 | 835 |
|
1132 | 836 |
(backgroundColor := description backgroundColor) isNil ifTrue:[ |
837 |
backgroundColor := dataSet backgroundColor |
|
838 |
] ifFalse:[ |
|
1480 | 839 |
backgroundColor := backgroundColor onDevice:dataSet device |
584 | 840 |
]. |
1113 | 841 |
|
842 |
(foregroundColor := description foregroundColor) isNil ifTrue:[ |
|
843 |
foregroundColor := dataSet foregroundColor |
|
844 |
] ifFalse:[ |
|
1480 | 845 |
foregroundColor := foregroundColor onDevice:dataSet device |
584 | 846 |
]. |
542 | 847 |
|
848 |
rendererType == #CheckToggle ifTrue:[ |
|
1113 | 849 |
buttonExtent := dataSet checkToggleExtent. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
850 |
^ self |
542 | 851 |
]. |
852 |
||
853 |
rendererType == #rowSelector ifTrue:[ |
|
807 | 854 |
buttonExtent := dataSet rowSelectorExtent. |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
855 |
^ self |
542 | 856 |
]. |
857 |
||
858 |
(rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[ |
|
807 | 859 |
buttonExtent := dataSet comboButtonExtent. |
883 | 860 |
] ifFalse:[ |
861 |
columnAlignment := description columnAlignment |
|
542 | 862 |
]. |
863 |
||
2444 | 864 |
"Modified: / 25.2.2000 / 14:25:56 / cg" |
2424
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
865 |
! ! |
576621beeacb
Care for #longStringCompression
Stefan Vogel <sv@exept.de>
parents:
2420
diff
changeset
|
866 |
|
621 | 867 |
!DataSetColumn methodsFor:'private'! |
868 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
869 |
extractColFromRow:aRow rowNr:rowNr |
2444 | 870 |
|readSelector col| |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
871 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
872 |
readSelector := description readSelector. |
1226 | 873 |
readSelector isNil ifTrue:[^ nil]. |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
874 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
875 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
876 |
^ 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
|
877 |
]. |
2635
a8add4698dea
care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents:
2613
diff
changeset
|
878 |
aRow isNil ifTrue:[^ nil]. |
a8add4698dea
care for nil rows when extracting columns
Claus Gittinger <cg@exept.de>
parents:
2613
diff
changeset
|
879 |
|
2444 | 880 |
col := aRow perform:readSelector withOptionalArgument:columnNumber and:rowNr and:dataSet. |
881 |
^ col |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
882 |
! |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
883 |
|
2693 | 884 |
storeCol:newValueArg inRow:aRow |
885 |
|writeSelector numArgs newValue min max| |
|
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
886 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
887 |
writeSelector := description writeSelector. |
1226 | 888 |
writeSelector isNil ifTrue:[^ aRow]. |
889 |
||
2693 | 890 |
newValue := newValueArg. |
891 |
(newValue isNumber) ifTrue:[ |
|
892 |
(min := self minValue) notNil ifTrue:[ |
|
893 |
newValue < min ifTrue:[ |
|
894 |
newValue := min |
|
895 |
] |
|
896 |
]. |
|
897 |
(max := self maxValue) notNil ifTrue:[ |
|
898 |
newValue > max ifTrue:[ |
|
899 |
newValue := max |
|
900 |
] |
|
901 |
]. |
|
902 |
]. |
|
903 |
||
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
904 |
numArgs := writeSelector numArgs. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
905 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
906 |
columnAdaptor notNil ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
907 |
numArgs == 2 ifTrue:[ |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
908 |
columnAdaptor perform:writeSelector with:aRow with:newValue. |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
909 |
^ self |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
910 |
]. |
2419
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
911 |
columnAdaptor perform:writeSelector with:aRow with:columnNumber with:newValue. |
e0121908fffe
added longStringCompression flag
Claus Gittinger <cg@exept.de>
parents:
2222
diff
changeset
|
912 |
^ self |
1007
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
913 |
]. |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
914 |
|
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
915 |
numArgs == 1 ifTrue:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
916 |
aRow perform:writeSelector with:newValue |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
917 |
] ifFalse:[ |
4ea1ecf23596
added support for columndAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
918 |
aRow perform:writeSelector with:columnNumber with:newValue |
1059 | 919 |
]. |
621 | 920 |
! ! |
921 |
||
542 | 922 |
!DataSetColumn methodsFor:'queries'! |
923 |
||
1492 | 924 |
canResize |
925 |
||
1496 | 926 |
containsText ifTrue:[ |
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
927 |
^ descWidth == 0 or:[self hasRelativeWidth] |
1492 | 928 |
]. |
929 |
^ false |
|
930 |
! |
|
931 |
||
607 | 932 |
canSelect:aRowNr |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
933 |
"returns true if the cell in column is selectable |
607 | 934 |
" |
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
935 |
|s row| |
607 | 936 |
|
2067
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
937 |
description canSelect ifFalse:[^ false]. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
938 |
s := description selectSelector. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
939 |
s isNil ifTrue:[^ true]. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
940 |
|
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
941 |
row := dataSet at:aRowNr. |
cda10b41aa0f
use new #perform:withOptionalArg
Claus Gittinger <cg@exept.de>
parents:
2017
diff
changeset
|
942 |
columnAdaptor notNil ifTrue:[ |
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
943 |
^ columnAdaptor perform:s withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet |
607 | 944 |
]. |
945 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
946 |
^ row perform:s withOptionalArgument:columnNumber and:aRowNr and:dataSet |
607 | 947 |
! |
948 |
||
647 | 949 |
containsText |
950 |
"returns true if text might exist |
|
951 |
" |
|
1496 | 952 |
^ containsText |
647 | 953 |
! |
954 |
||
2074 | 955 |
doubleClickOn:aRowNr |
2694 | 956 |
|sel row| |
2074 | 957 |
|
958 |
(sel := self doubleClickedSelector) notNil ifTrue:[ |
|
2694 | 959 |
row := dataSet at:aRowNr. |
2074 | 960 |
columnAdaptor notNil ifTrue:[ |
2694 | 961 |
^ columnAdaptor perform:sel withOptionalArgument:row and:columnNumber and:aRowNr and:dataSet |
2074 | 962 |
]. |
2694 | 963 |
^ row perform:sel withOptionalArgument:columnNumber and:aRowNr and:dataSet |
2074 | 964 |
]. |
965 |
! |
|
966 |
||
833 | 967 |
hasChoices:aRowNr |
968 |
^ (description choicesFor:(dataSet at:aRowNr)) notNil |
|
969 |
! |
|
970 |
||
1950 | 971 |
hasPotentialNonConstantBackground |
972 |
(backgroundColor notNil and:[backgroundColor isImageOrForm]) ifTrue:[^ true]. |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
973 |
description backgroundSelector notNil ifTrue:[^ true]. |
1950 | 974 |
^ false. |
975 |
! |
|
976 |
||
1484 | 977 |
hasRelativeWidth |
978 |
"returns true if width is relative |
|
979 |
" |
|
2017
5cbe1d46c01d
isReal -> isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents:
1984
diff
changeset
|
980 |
^ descWidth isLimitedPrecisionReal |
1484 | 981 |
! |
982 |
||
542 | 983 |
heightOfHighestRow |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
984 |
"returns the height of the highest row in pixels. |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
985 |
Warning: |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
986 |
only the first numberOfRowsProbedForColumnSize are probed, |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
987 |
in case the access is expensive (dataBase apps) |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
988 |
If the descriptor defines a height, that is used, and the items |
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
989 |
are not probed at all. |
542 | 990 |
" |
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
991 |
|h end bE editor| |
542 | 992 |
|
1496 | 993 |
(h := description height) == 0 ifTrue:[ |
994 |
containsText ifTrue:[ |
|
542 | 995 |
"/ search first none empty drawable object |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
996 |
end := description numberOfRowsProbedForColumnSize min:dataSet size. |
542 | 997 |
|
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
998 |
1 to:end do:[:rowNr| |row| |
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
999 |
row := dataSet at:rowNr. |
2444 | 1000 |
h := h max:(self heightOfLabel:(self shownValueForRow:row rowNr:rowNr)) |
542 | 1001 |
] |
1002 |
] |
|
1003 |
]. |
|
1559
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1004 |
(bE := buttonExtent y) = 0 ifTrue:[ |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1005 |
((editor := description editorType) == #ComboList |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1006 |
or:[ editor == #ComboBox]) ifTrue:[ |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1007 |
bE := dataSet comboButtonExtent y. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1008 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1009 |
]. |
1e7f30057e22
care for renderer==Text and editor==Comboxxx in
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
1010 |
^ h max:bE |
1725
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1011 |
|
897453804fa8
made numberOfRowsProbedForSize a variable;
Claus Gittinger <cg@exept.de>
parents:
1712
diff
changeset
|
1012 |
"Modified: / 25.2.2000 / 14:29:20 / cg" |
1113 | 1013 |
! |
1014 |
||
1147 | 1015 |
heightOfLabel:aLabel |
1016 |
"returns the height of the label |
|
1017 |
" |
|
1496 | 1018 |
|h| |
1147 | 1019 |
|
1496 | 1020 |
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[ |
1021 |
^ aLabel heightOn:dataSet |
|
1022 |
]. |
|
1147 | 1023 |
aLabel isNil ifTrue:[ ^ 0 ]. |
1024 |
||
1496 | 1025 |
aLabel isSequenceable ifFalse:[ |
1026 |
^ aLabel perform:#heightOn: with:dataSet ifNotUnderstood:[ |
|
1027 |
aLabel displayString heightOn:dataSet |
|
1028 |
] |
|
1147 | 1029 |
]. |
1030 |
||
1496 | 1031 |
h := 0. |
1032 |
aLabel do:[:el|h := h + (el heightOn:dataSet)]. |
|
1033 |
^ h |
|
1147 | 1034 |
|
1035 |
! |
|
1036 |
||
1937 | 1037 |
isResizeable |
1038 |
"returns true if the row is resizeable |
|
1039 |
" |
|
1040 |
^ description isResizeable |
|
1041 |
! |
|
1042 |
||
2542 | 1043 |
isRowVisible:rowNr |
1044 |
^ description rowIsVisible:(dataSet at:rowNr) |
|
1045 |
! |
|
1046 |
||
1113 | 1047 |
showColSeparator |
1048 |
"returns true if column separator is on |
|
1049 |
" |
|
1050 |
^ showColSeparator |
|
1133 | 1051 |
! |
1052 |
||
1053 |
showSelectionHighLighted |
|
1054 |
"returns true if selection is highLighted |
|
1055 |
" |
|
1056 |
^ description showSelectionHighLighted ~~ false |
|
1147 | 1057 |
! |
1058 |
||
1059 |
widthOfLabel:aLabel |
|
1060 |
"returns the width of the label |
|
1061 |
" |
|
1496 | 1062 |
|w| |
1147 | 1063 |
|
1496 | 1064 |
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[ |
1065 |
^ aLabel widthOn:dataSet |
|
1066 |
]. |
|
1147 | 1067 |
aLabel isNil ifTrue:[ ^ 0 ]. |
1068 |
||
1496 | 1069 |
aLabel isSequenceable ifFalse:[ |
1070 |
^ aLabel perform:#widthOn: with:dataSet ifNotUnderstood:[ |
|
1071 |
aLabel displayString widthOn:dataSet |
|
1072 |
] |
|
1147 | 1073 |
]. |
1074 |
||
1496 | 1075 |
w := 0. |
1076 |
aLabel do:[:el|w := w max:(el widthOn:dataSet)]. |
|
1077 |
^ w |
|
542 | 1078 |
! ! |
1079 |
||
1080 |
!DataSetColumn methodsFor:'searching'! |
|
1081 |
||
1082 |
findRowNrStartingWithChar:aChar start:start stop:stop |
|
1083 |
"find the first row starting at start to stop, which drawable label |
|
1084 |
starts with the character, aChar. The index of the detected row is |
|
1085 |
returned or if no row is found 0. |
|
1086 |
" |
|
1087 |
|char| |
|
1088 |
||
1496 | 1089 |
containsText ifTrue:[ |
542 | 1090 |
char := aChar asLowercase. |
1091 |
||
2211
f14db8e094b9
pass rowNr and dataSet as additional args to
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1092 |
start to:stop do:[:eachNr| |row lbl| |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1093 |
(dataSet isRowSelectable:eachNr) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1094 |
row := dataSet at:eachNr. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1095 |
lbl := self shownValueForRow:row rowNr:eachNr. |
1147 | 1096 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1097 |
(lbl isSequenceable and:[lbl isString not]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1098 |
lbl := lbl at:1 ifAbsent:nil |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1099 |
]. |
542 | 1100 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1101 |
(lbl respondsTo:#string) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1102 |
lbl := lbl string. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1103 |
(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
|
1104 |
^ eachNr |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1105 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1106 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1107 |
lbl isNil ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1108 |
^ 0 |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1109 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1110 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2635
diff
changeset
|
1111 |
]. |
542 | 1112 |
] |
1113 |
]. |
|
1114 |
^ 0 |
|
1115 |
! ! |
|
1116 |
||
1117 |
!DataSetColumn class methodsFor:'documentation'! |
|
1118 |
||
1119 |
version |
|
2694 | 1120 |
^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.96 2004-04-02 14:42:29 werner Exp $' |
542 | 1121 |
! ! |