--- a/DataSetColumn.st Sat Mar 17 12:38:01 2007 +0100
+++ b/DataSetColumn.st Mon Mar 26 13:27:16 2007 +0200
@@ -226,23 +226,37 @@
backgroundColorFor:aRow at:aRowNr
"return the background color for a row at list index a rowNr"
- |bgSelector bg|
+ "/ backgroundColor has already been fetched from description/dataSet (see #initialize)
+ ^ self
+ colorFor:aRow at:aRowNr
+ descriptionSelector:(description backgroundSelector)
+ descriptionColor:backgroundColor
+ dataSetDefaultColor:nil
- bgSelector := description backgroundSelector.
- bgSelector notNil ifTrue:[
+ "Modified: / 26-03-2007 / 13:27:19 / cg"
+!
+
+colorFor:aRow at:aRowNr descriptionSelector:descriptionSelector descriptionColor:descriptionColor dataSetDefaultColor:dataSetColor
+ "common code for returning a color for a row at list index a rowNr, asking both description and dataSet as fallBack"
+
+ |clr|
+
+ descriptionSelector notNil ifTrue:[
columnAdaptor notNil ifTrue:[
- bg := columnAdaptor perform:bgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
+ clr := columnAdaptor perform:descriptionSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
] ifFalse:[
- bg := aRow perform:bgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
+ clr := aRow perform:descriptionSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
].
- bg notNil ifTrue:[
- (bg isColor or:[bg isImageOrForm]) ifTrue:[
- ^ bg
+ clr notNil ifTrue:[
+ (clr isColor or:[clr isImageOrForm]) ifTrue:[
+ ^ clr
].
- self error:'unexpected background (not a color or image)'.
+ self error:'unexpected color (not a color or image)'.
]
].
- ^ backgroundColor
+ ^ descriptionColor ? dataSetColor
+
+ "Created: / 26-03-2007 / 13:05:24 / cg"
!
foregroundColor
@@ -258,76 +272,39 @@
foregroundColorFor:aRow at:aRowNr
"returns the foreground color for a row at list index a rowNr
"
- |fgSelector fg|
- fgSelector := description foregroundSelector.
- fgSelector notNil ifTrue:[
- columnAdaptor notNil ifTrue:[
- fg := columnAdaptor perform:fgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
- ] ifFalse:[
- fg := aRow perform:fgSelector withOptionalArgument:aRowNr and:dataSet
- ].
- fg notNil ifTrue:[
- (fg isColor or:[fg isImageOrForm]) ifTrue:[
- ^ fg
- ].
- self error:'unexpected foreground (not a color or image)'.
- ]
- ].
- ^ foregroundColor
+ "/ foregroundColor has already been fetched from description/dataSet (see #initialize)
+ ^ self
+ colorFor:aRow at:aRowNr
+ descriptionSelector:(description foregroundSelector)
+ descriptionColor:foregroundColor
+ dataSetDefaultColor:nil
+
+ "Modified: / 26-03-2007 / 13:27:39 / cg"
!
selectedBackgroundColorFor:aRow at:aRowNr
- "returns the selected background color for a row at list index a rowNr
- "
- |bgSelector bg|
+ "returns the selected background color for a row at list index a rowNr"
- bgSelector := description selectedBackgroundSelector.
- bgSelector notNil ifTrue:[
- columnAdaptor notNil ifTrue:[
- bg := columnAdaptor perform:bgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
- ] ifFalse:[
- bg := aRow perform:bgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
- ].
- bg notNil ifTrue:[
- (bg isColor or:[bg isImageOrForm]) ifTrue:[
- ^ bg
- ].
- self error:'unexpected background (not a color or image)'.
- ]
- ].
+ ^ self
+ colorFor:aRow at:aRowNr
+ descriptionSelector:(description selectedBackgroundSelector)
+ descriptionColor:(description selectedBackgroundColor)
+ dataSetDefaultColor:(dataSet selectionBackgroundColor)
- bg := description selectedBackgroundColor.
- bg isNil ifTrue:[
- bg := dataSet selectionBackgroundColor
- ].
- ^ bg
+ "Modified: / 26-03-2007 / 13:06:06 / cg"
!
selectedForegroundColorFor:aRow at:aRowNr
- "returns the selected foreground color for a row at list index a rowNr
- "
- |fgSelector fg|
+ "returns the selected foreground color for a row at list index a rowNr"
- fgSelector := description selectedForegroundSelector.
- fgSelector notNil ifTrue:[
- columnAdaptor notNil ifTrue:[
- fg := columnAdaptor perform:fgSelector withOptionalArgument:aRow and:aRowNr and:columnNumber and:dataSet
- ] ifFalse:[
- fg := aRow perform:fgSelector withOptionalArgument:aRowNr and:columnNumber and:dataSet
- ].
- fg notNil ifTrue:[
- (fg isColor or:[fg isImageOrForm]) ifTrue:[
- ^ fg
- ].
- self error:'unexpected foreground (not a color or image)'.
- ]
- ].
- fg := description selectedForegroundColor.
- fg isNil ifTrue:[
- fg := dataSet selectionForegroundColor
- ].
- ^ fg
+ ^ self
+ colorFor:aRow at:aRowNr
+ descriptionSelector:(description selectedForegroundSelector)
+ descriptionColor:(description selectedForegroundColor)
+ dataSetDefaultColor:(dataSet selectionForegroundColor)
+
+ "Modified: / 26-03-2007 / 13:05:31 / cg"
! !
!DataSetColumn methodsFor:'accessing-dimension'!
@@ -1208,5 +1185,5 @@
!DataSetColumn class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.104 2006-11-08 12:59:22 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.105 2007-03-26 11:27:16 cg Exp $'
! !