add new attributes and help
authorca
Fri, 14 Nov 1997 10:53:23 +0100
changeset 380 42aacfc3d263
parent 379 1a24037cd490
child 381 1d1b1483270c
add new attributes and help
DataSetBuilder.st
--- a/DataSetBuilder.st	Wed Nov 12 17:26:53 1997 +0100
+++ b/DataSetBuilder.st	Fri Nov 14 10:53:23 1997 +0100
@@ -187,8 +187,8 @@
               #'collection:' 
                #(
                  #(#FramedBoxSpec
-                    #'name:' 'colorsBox'
-                    #'layout:' #(#LayoutFrame 0 0.0 24 0 0 1.0 121 0)
+                    #'name:' 'defaultColorsBox'
+                    #'layout:' #(#LayoutFrame 0 0.0 22 0 0 1.0 121 0)
                     #'component:' 
                      #(#SpecCollection
                         #'collection:' 
@@ -221,7 +221,47 @@
                           )
                         )
                     )
-                    #'label:' 'Colors:'
+                    #'label:' 'Default Colors:'
+                    #'labelPosition:' #topLeft
+                )
+                 #(#FramedBoxSpec
+                    #'name:' 'cellColorsBox'
+                    #'layout:' #(#LayoutFrame 0 0 127 0 0 1.0 226 0)
+                    #'component:' 
+                     #(#SpecCollection
+                        #'collection:' 
+                         #(
+                           #(#LabelSpec
+                              #'name:' 'fgSelLabel'
+                              #'layout:' #(#AlignmentOrigin 100 0 32 0 1 0.5)
+                              #'label:' 'FG-Color:'
+                              #'adjust:' #right
+                              #'resizeForLabel:' true
+                          )
+                           #(#InputFieldSpec
+                              #'name:' 'fgSelField'
+                              #'layout:' #(#LayoutFrame 101 0 23 0 10 1.0 45 0)
+                              #'model:' #foregroundSelector
+                              #'activeHelpKey:' #foregroundSelector
+                              #'type:' #symbolOrNil
+                          )
+                           #(#LabelSpec
+                              #'name:' 'bgSelLabel'
+                              #'layout:' #(#AlignmentOrigin 100 0 66 0 1 0.5)
+                              #'label:' 'BG-Color:'
+                              #'adjust:' #right
+                              #'resizeForLabel:' true
+                          )
+                           #(#InputFieldSpec
+                              #'name:' 'bgSelField'
+                              #'layout:' #(#LayoutFrame 101 0 57 0 10 1.0 79 0)
+                              #'model:' #backgroundSelector
+                              #'activeHelpKey:' #backgroundSelector
+                              #'type:' #symbolOrNil
+                          )
+                        )
+                    )
+                    #'label:' 'Color Selectors (Cell):'
                     #'labelPosition:' #topLeft
                 )
               )
@@ -650,6 +690,9 @@
 #backgroundColor
 'set the background color of the column if the color-checkBox is turned on. Otherwise, the column uses its default background color (which is specified in the styleSheet).'
 
+#backgroundSelector
+'selector which returns the background color for a cell (optional). If the selector is nil or returns nil, the default background color is set.'
+
 #canSelect
 'if true, each cell in the column can be selected. In case of having a menu, the menu can be opened by selecting the cell and pressing down the right or middle button of the mouse. if false, the whole line is selected. The menu opened derives from the DataSetView, which is specified in the window specification (Basics).'
 
@@ -662,6 +705,9 @@
 #foregroundColor
 'set the foreground color of the column  if the color-checkBox is turned on. Otherwise, the column uses its default foreground color (which is specified in the styleSheet).'
 
+#foregroundSelector
+'selector which returns the foreground color for a cell (optional). If the selector is nil or returns nil, the default foreground color is set.'
+
 #formatString
 'format string, which specifies the output format of a text in a cell. \ At the moment only numbers are supported. \ \ for example: 0.0000'
 
@@ -684,7 +730,7 @@
 'a selector with one argument, the DataSetView. Used to access a drawable display object. In case of nil, the value derived from the readSelector is shown in the unselected cell.\ \ Using bitmaps, the DataSetView offers three important methods:\ \ #registerImage:anImage key:aSymbol\ register an image with an unique symbol. This symbol can be used by the row object to access the image, using #registeredImageAt:. The image will be associated to the device.\ \ #registeredImageAt:aSymbol\ returns an image assigned to the symbol or nil. The image returned is associated to the device.\ \ #releaseAllRegisteredImages\ relaese all registered images'
 
 #readSelector
-'a selector, which is used to get or set the value of a cell. The value returned by the method can be a string object or a bitmap. The set operation only is performed if the column is selectable.'
+'a selector, which is used to get or set (if the write selector is undefined) the value of a cell. The value returned by the method can be a string object or a bitmap. The set operation only is performed if the column is selectable.'
 
 #rendererType
 'This type specifies, how the text of an unselected cell should be shown. As Text, CheckToggle, ComboBox, ComboList or as a RowSelector.'
@@ -707,6 +753,9 @@
 #width
 'the width of a fixed column; in case of nil or 0 the column width will be computed dependent on the contents.'
 
+#writeSelector
+'a selector, which is used to set the value of a cell. If the selector is not defined, the selector derives from the printSelector.'
+
 )
 ! !
 
@@ -1298,6 +1347,8 @@
     self generateMenuIn:cls.
     self generatePrintSelectorIn:cls.
     self generateReadSelectorIn:cls.
+    self generateBackgroundSelectorIn:cls.
+    self generateForegroundSelectorIn:cls.
     self generateSelectSelectorIn:cls.
     self generateWriteSelectorIn:cls.
 !
@@ -1546,6 +1597,29 @@
     ByteCodeCompiler compile:aCode withCRs forClass:aClass inCategory:aCategory
 !
 
+generateBackgroundSelectorIn:aClass
+    "generate code for #backgroundSelector
+    "
+    |sel catg code bCode|
+
+    catg := 'accessing colors' asSymbol.
+    code :=   '\'
+            , '    "automatically generated by DataSetBuilder ..."\'
+            , '\'
+            , '    "specific background color for a cell"\'
+            , '\'
+            .
+
+    columns do:[:aCol|
+        ((sel := aCol backgroundSelector) notNil and:[(aClass implements:sel) not]) ifTrue:[
+            bCode := sel asString, code, '    ^ nil'.
+            self compile:bCode forClass:aClass inCategory:catg
+        ]
+    ]
+
+
+!
+
 generateChoicesIn:aClass
     "generate code for #choices
     "
@@ -1571,6 +1645,29 @@
     ]
 !
 
+generateForegroundSelectorIn:aClass
+    "generate code for #foregroundSelector
+    "
+    |sel catg code bCode|
+
+    catg := 'accessing colors' asSymbol.
+    code :=   '\'
+            , '    "automatically generated by DataSetBuilder ..."\'
+            , '\'
+            , '    "specific foreground color for a cell"\'
+            , '\'
+            .
+
+    columns do:[:aCol|
+        ((sel := aCol foregroundSelector) notNil and:[(aClass implements:sel) not]) ifTrue:[
+            bCode := sel asString, code, '    ^ nil'.
+            self compile:bCode forClass:aClass inCategory:catg
+        ]
+    ]
+
+
+!
+
 generateMenuIn:aClass
     "generate code for #menu
     "
@@ -1737,6 +1834,8 @@
         minWidth
         height
         menu
+        foregroundSelector
+        backgroundSelector
         selectSelector
         printSelector
         readSelector