--- a/DataSetColumn.st Tue Nov 22 10:03:11 2016 +0100
+++ b/DataSetColumn.st Tue Nov 22 10:05:46 2016 +0100
@@ -501,11 +501,11 @@
drawLabel:aLabelToDraw atX:xLeft y:yTop
"draw aLabelToDraw; handle columnAlignment"
- |drawnLabel x space prevClip mustUndoClip cashedWidth
+ |drawnLabel x space prevClip mustUndoClip cachedWidth
labelWidth leftPart leftShift indexOfFirstDigit indexOfFirstNonDigit|
- cashedWidth := self width.
- cashedWidth isNil ifTrue:[ ^ self ].
+ cachedWidth := self width.
+ cachedWidth isNil ifTrue:[ ^ self ].
space := dataSet horizontalSpacing.
@@ -513,9 +513,9 @@
labelWidth := drawnLabel widthOn:dataSet.
(longStringCompression ~~ false
- and:[ drawnLabel isString
- and:[ labelWidth > cashedWidth]]) ifTrue:[
- drawnLabel := self class shortenedStringFor:drawnLabel on:dataSet maxWidth:cashedWidth-space.
+ and:[ drawnLabel isString
+ and:[ labelWidth > cachedWidth]]) ifTrue:[
+ drawnLabel := self class shortenedStringFor:drawnLabel on:dataSet maxWidth:cachedWidth-space.
labelWidth := drawnLabel widthOn:dataSet.
].
@@ -541,13 +541,13 @@
leftShift := leftPart widthOn:dataSet.
columnAlignment == #decimalRight ifTrue:[
"/ decimal at the right
- x := (cashedWidth) - ('9999' widthOn:dataSet) - leftShift.
+ x := cachedWidth - ('9999' widthOn:dataSet) - leftShift.
] ifFalse:[
"/ decimal at the middle
- x := (cashedWidth // 2) - leftShift.
+ x := (cachedWidth // 2) - leftShift.
].
] ifFalse:[
- x := cashedWidth - labelWidth.
+ x := cachedWidth - labelWidth.
columnAlignment == #right ifTrue:[x := x - space]
ifFalse:[x := x // 2].
@@ -561,11 +561,11 @@
"/ must clip left, if string is too large
x < xLeft ifTrue:[
"/ must clip ...
- prevClip := dataSet clippingRectangleOrNil.
+ prevClip := dataSet clippingBoundsOrNil.
mustUndoClip := true.
- dataSet clippingRectangle:(Rectangle
+ dataSet clippingBounds:(Rectangle
left:xLeft top:yTop
- width:cashedWidth height:(drawnLabel heightOn:dataSet)).
+ width:cachedWidth height:(drawnLabel heightOn:dataSet)).
].
].
@@ -585,13 +585,13 @@
dataSet displayLabel:drawnLabel x:x y:yTop.
mustUndoClip == true ifTrue:[
- dataSet clippingRectangle:prevClip
+ dataSet clippingBounds:prevClip
].
!
drawLabelsAtX:xLeft y:yTop h:h from:start to:stop
- "redraw labels from start to stop
- "
+ "redraw labels from start to stop"
+
|fg y yT x hspace lblHg bg label row isSel cachedWidth lineColor|
cachedWidth := self width.
@@ -679,21 +679,21 @@
y := y + ((h - lblHg) // 2).
dataSet paint:fg on:bg.
- label isString ifTrue:[
- (label includes:Character cr) ifTrue:[
- label := label asCollectionOfLines
- ].
+ (label isString and:[label includes:Character cr]) ifTrue:[
+ label := label asCollectionOfLines
].
- (label isSequenceable and:[label isString not]) ifFalse:[
- self drawLabel:label atX:x y:y
- ] ifTrue:[
+ (label isNonByteCollection) ifTrue:[
+ "a collection of labels"
label do:[:el|
el notNil ifTrue:[
self drawLabel:el atX:x y:y.
y := y + (el heightOn:dataSet).
]
]
+ ] ifFalse:[
+ "a single label"
+ self drawLabel:label atX:x y:y
].
]
].
@@ -863,8 +863,8 @@
self drawSeparatorsAtX:xLeft y:yTop h:rH from:start to:stop
!
-shownValueForRow:aRow rowNr:aRowNr
- |selector format value type choices translatedChoices idx converter|
+shownValueForRow:aRowOrNil rowNr:aRowNr
+ |aRow selector format value type choices translatedChoices idx converter|
rendererType == #CheckToggle ifTrue:[
^ nil
@@ -877,6 +877,11 @@
^ nil
].
+ aRow := aRowOrNil.
+ aRowOrNil isNil ifTrue:[
+ aRow := dataSet at:aRowNr.
+ ].
+
selector := description printSelector.
selector notNil ifTrue:[
^ aRow
@@ -1268,33 +1273,33 @@
|h font|
aLabel isNil ifTrue:[ ^ 0 ].
- aLabel isImageOrForm ifTrue:[ ^ aLabel heightOn:dataSet ].
+ aLabel isImageOrForm ifTrue:[
+ ^ aLabel heightOn:dataSet
+ ].
font := dataSet deviceFont.
-
- ((h := description height) == #fontHeight or:[ h isNumber and:[h < 0] ]) ifTrue:[
+ h := description height.
+ (h == #fontHeight or:[h isNumber and:[h < 0]]) ifTrue:[
^ font height
].
aLabel isString ifTrue:[
"/ if multiple lines - count 'em
(aLabel includes:Character cr) ifTrue:[
- ^ aLabel asStringCollection inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)]
+ ^ aLabel asStringCollection
+ inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)]
].
^ font heightOf:aLabel
].
- aLabel isImageOrForm ifTrue:[
- ^ font heightOf:aLabel
- ].
- aLabel isSequenceable ifFalse:[
- ^ aLabel
- perform:#heightOn:
- with:dataSet
- ifNotUnderstood:[ aLabel displayString heightOn:dataSet ]
+ aLabel isSequenceable ifTrue:[
+ ^ aLabel inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)].
].
- ^ aLabel inject:0 into:[:sumH :line | sumH + (line heightOn:dataSet)].
+ ^ aLabel
+ perform:#heightOn:
+ with:dataSet
+ ifNotUnderstood:[aLabel displayString heightOn:dataSet].
"Modified: / 20-01-2011 / 18:03:38 / cg"
!
@@ -1337,24 +1342,20 @@
!
widthOfLabel:aLabel
- "returns the width of the label
- "
- |w|
+ "returns the width of the label"
+ aLabel isNil ifTrue:[ ^ 0 ].
(aLabel isString or:[aLabel isImageOrForm]) ifTrue:[
^ aLabel widthOn:dataSet
].
- aLabel isNil ifTrue:[ ^ 0 ].
- aLabel isSequenceable ifFalse:[
- ^ aLabel perform:#widthOn: with:dataSet ifNotUnderstood:[
- aLabel displayString widthOn:dataSet
- ]
+ aLabel isSequenceable ifTrue:[
+ ^ aLabel inject:0 into:[:sumW :line | sumW max:(line widthOn:dataSet)].
].
- w := 0.
- aLabel do:[:el|w := w max:(el widthOn:dataSet)].
- ^ w
+ ^ aLabel
+ perform:#widthOn: with:dataSet
+ ifNotUnderstood:[aLabel displayString widthOn:dataSet].
! !
!DataSetColumn methodsFor:'searching'!
@@ -1374,7 +1375,7 @@
row := dataSet at:eachNr.
lbl := self shownValueForRow:row rowNr:eachNr.
- (lbl isSequenceable and:[lbl isString not]) ifTrue:[
+ lbl isNonByteCollection ifTrue:[
lbl := lbl at:1 ifAbsent:nil
].