add more functionality
authorca
Sun, 06 Sep 1998 15:13:37 +0200
changeset 983 286a039ea7d1
parent 982 2dda94c7ff25
child 984 f1b6d6b68510
add more functionality specific row separator enable/disable enable/disable highlightend cell in selection mode
DataSetBuilder.st
--- a/DataSetBuilder.st	Fri Sep 04 14:05:02 1998 +0200
+++ b/DataSetBuilder.st	Sun Sep 06 15:13:37 1998 +0200
@@ -91,12 +91,14 @@
         foregroundSelector
         backgroundSelector
         doubleClickedSelector
+        rowSeparatorSelector
         selectSelector
         printSelector
         readSelector
         writeSelector
         rendererType
         showColSeparator
+        showSelectionHighLighted
         showRowSeparator
         backgroundColor
         foregroundColor
@@ -127,7 +129,7 @@
 
     <resource: #help>
 
-    ^super helpSpec addPairsFrom:#(
+    ^ super helpSpec addPairsFrom:#(
 
 #addColumn
 'Adds a new column.'
@@ -207,6 +209,9 @@
 #frameShowRowSeparator
 'Turns on/off displaying row separators.'
 
+#frameShowRowSeparatorSelector
+'An optional selector, which is used to test whether the row separator at the bottom is shown.'
+
 #generate
 'Code generation.'
 
@@ -234,6 +239,9 @@
 #selectionLabelSelectorArgument
 'An argument passed to label selection selector.'
 
+#showSelectionHighLighted
+'Show selected cell highligthened (change fg/bg color).'
+
 #valuesChoiceSelector
 'A selector returning a collection of choices for a cell having a ComboBox or a ComboList widget.'
 
@@ -805,11 +813,11 @@
           #window: 
            #(#WindowSpec
               #name: 'DataSet Dimension'
-              #layout: #(#LayoutFrame 216 0 173 0 506 0 416 0)
+              #layout: #(#LayoutFrame 44 0 255 0 368 0 602 0)
               #label: 'DataSet Dimension'
               #min: #(#Point 10 10)
               #max: #(#Point 1280 1024)
-              #bounds: #(#Rectangle 216 173 507 417)
+              #bounds: #(#Rectangle 44 255 369 603)
               #usePreferredExtent: false
           )
           #component: 
@@ -818,7 +826,7 @@
                #(
                  #(#FramedBoxSpec
                     #name: 'separatorBox'
-                    #layout: #(#LayoutFrame 0 0.0 3 0 0 1.0 95 0)
+                    #layout: #(#LayoutFrame 0 0.0 3 0 0 1.0 132 0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
@@ -831,9 +839,17 @@
                               #model: #showRowSeparator
                               #label: 'Show Row-Separator'
                           )
+                           #(#InputFieldSpec
+                              #name: 'rowSeparatorSelector'
+                              #layout: #(#LayoutFrame 29 0 41 0 2 1.0 63 0)
+                              #activeHelpKey: #frameShowRowSeparatorSelector
+                              #tabable: true
+                              #model: #rowSeparatorSelector
+                              #type: #symbolOrNil
+                          )
                            #(#CheckBoxSpec
                               #name: 'showColSeparator'
-                              #layout: #(#LayoutFrame 5 0 41 0 181 0 64 0)
+                              #layout: #(#LayoutFrame 5 0 70 0 181 0 93 0)
                               #activeHelpKey: #frameShowColumnSeparator
                               #tabable: true
                               #model: #showColSeparator
@@ -846,7 +862,7 @@
                 )
                  #(#FramedBoxSpec
                     #name: 'framedBox1'
-                    #layout: #(#LayoutFrame 0 0.0 108 0 0 1.0 225 0)
+                    #layout: #(#LayoutFrame 0 0.0 151 0 0 1.0 268 0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
@@ -904,8 +920,6 @@
               )
           )
       )
-
-    "Modified: / 13.8.1998 / 19:54:30 / cg"
 !
 
 selectionEditSpec
@@ -928,11 +942,11 @@
           #window: 
            #(#WindowSpec
               #name: 'DataSet Basic'
-              #layout: #(#LayoutFrame 216 0 173 0 504 0 428 0)
+              #layout: #(#LayoutFrame 104 0 195 0 434 0 522 0)
               #label: 'DataSet Basic'
               #min: #(#Point 10 10)
               #max: #(#Point 1280 1024)
-              #bounds: #(#Rectangle 216 173 505 429)
+              #bounds: #(#Rectangle 104 195 435 523)
               #usePreferredExtent: false
           )
           #component: 
@@ -983,14 +997,14 @@
                 )
                  #(#FramedBoxSpec
                     #name: 'framedBox2'
-                    #layout: #(#LayoutFrame 0 0.0 95 0 0 1.0 178 0)
+                    #layout: #(#LayoutFrame 0 0.0 95 0 0 1.0 205 0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
                          #(
                            #(#CheckBoxSpec
                               #name: 'canSelect'
-                              #layout: #(#Point 95 8)
+                              #layout: #(#Point 95 1)
                               #activeHelpKey: #selectionIsSelectable
                               #tabable: true
                               #model: #canSelect
@@ -998,19 +1012,27 @@
                           )
                            #(#LabelSpec
                               #name: 'selectorLabel'
-                              #layout: #(#AlignmentOrigin 95 0 44 0 1 0.5)
+                              #layout: #(#AlignmentOrigin 95 0 37 0 1 0.5)
                               #label: 'Selector:'
                               #adjust: #right
                               #resizeForLabel: true
                           )
                            #(#InputFieldSpec
                               #name: 'selectSelector'
-                              #layout: #(#LayoutFrame 98 0 33 0 3 1.0 55 0)
+                              #layout: #(#LayoutFrame 98 0 26 0 3 1.0 48 0)
                               #activeHelpKey: #selectionCellClickSelector
                               #tabable: true
                               #model: #selectSelector
                               #type: #symbolOrNil
                           )
+                           #(#CheckBoxSpec
+                              #name: 'showSelectionHighLightened'
+                              #layout: #(#LayoutFrame 95 0 53 0 3 1.0 77 0)
+                              #activeHelpKey: #showSelectionHighLighted
+                              #tabable: true
+                              #model: #showSelectionHighLighted
+                              #label: 'Show Selection HighLightened'
+                          )
                         )
                     )
                     #label: 'Cell Selection:'
@@ -1018,7 +1040,7 @@
                 )
                  #(#FramedBoxSpec
                     #name: 'framedBox3'
-                    #layout: #(#LayoutFrame 0 0.0 186 0 0 1.0 243 0)
+                    #layout: #(#LayoutFrame 0 0.0 217 0 0 1.0 274 0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
@@ -1046,8 +1068,6 @@
               )
           )
       )
-
-    "Modified: / 13.8.1998 / 19:54:49 / cg"
 !
 
 slices
@@ -1762,9 +1782,15 @@
 
 !
 
+resolveRowClass
+    "returns the resolved row class
+    "
+    ^ Smalltalk resolveName:rowClass inClass:self class
+!
+
 rowClassName
 
-    ^(Smalltalk resolveName:rowClass inClass:self class) notNil ifTrue:[rowClass] ifFalse:[nil]
+    ^ self resolveRowClass notNil ifTrue:[rowClass] ifFalse:[nil]
 !
 
 rowClassName:aClassName
@@ -1774,7 +1800,7 @@
     rowSuperClass := nil.
 
     (rowClass := aClassName) notNil ifTrue:[
-        (cls := self resolveClassNamed) notNil 
+        (cls := self resolveRowClass) notNil 
             ifTrue: [rowSuperClass := cls superclass name asString] 
             ifFalse:[rowSuperClass := 'Object']
     ]
@@ -2006,9 +2032,9 @@
     code :=   '\'
             , '    "automatically generated by DataSetBuilder ..."\'
             , '\'
-            , '    "get choices for visual editor; (a list of labels)\'
+            , '    "get choices for visual editor; (a list of labels)..."\'
             , '\'
-            , '    ^nil'
+            , '    ^ #( foo bar baz )'
             .
 
     columns do:
@@ -2165,6 +2191,32 @@
     ]
 !
 
+generateRowSeparatorSelectorIn:aClass
+    "generate code for #rowSeparatorSelector"
+
+    |sel catg code bCode|
+
+    catg := 'accessing look' asSymbol.
+    code :=   '\'
+            , '    "automatically generated by DataSetBuilder ..."\'
+            , '\'
+            , '    "specific row separator visibility for a cell"\'
+            , '\'
+            .
+
+    columns do:
+    [:aColumn|
+        ((sel := aColumn rowSeparatorSelector) notNil and:[(aClass implements:sel) not]) 
+        ifTrue:
+        [
+            bCode := sel asString, code, '    ^true'.
+            self compile:bCode forClass:aClass inCategory:catg
+        ]
+    ]
+
+
+!
+
 generateSelectSelectorIn:aClass
     "generate code for #selectSelector
     "
@@ -2210,8 +2262,9 @@
     columns do:
     [:aColumn|
         ((sel := aColumn writeSelector) notNil
+         and:[aColumn editorType ~~ #None
          and:[aColumn canSelect
-         and:[(aClass implements:sel) not]]) 
+         and:[(aClass implements:sel) not]]]) 
         ifTrue:
         [
             sel numArgs == 1 
@@ -2281,6 +2334,7 @@
                     writeSelector: #at:put:;
                     backgroundSelector:nil;
                     foregroundSelector:nil;
+                    rowSeparatorSelector:nil;
                     selectSelector: nil;
                     doubleClickedSelector: nil;
                     printSelector: nil;
@@ -2448,7 +2502,7 @@
 
     |cls|
 
-    (cls := self resolveClassNamed) notNil 
+    (cls := self resolveRowClass) notNil 
         ifTrue: [SystemBrowser openInClass:cls] 
         ifFalse:[self information:'No class defined !!']
 
@@ -2519,7 +2573,7 @@
         rowClass notNil 
         ifTrue:
         [
-            (cls := self resolveClassNamed) notNil 
+            (cls := self resolveRowClass) notNil 
             ifTrue:
             [
                 rowSuperClass := cls superclass name asString
@@ -2553,7 +2607,7 @@
         ] 
         ifFalse: 
         [
-            cls := self resolveClassNamed.
+            cls := self resolveRowClass.
 
             cls notNil ifTrue:[cls := cls superclass name asString].
 
@@ -2608,7 +2662,7 @@
     |cls superclass|
 
     rowClass isNil ifTrue:[^self information:'No class defined!!'].
-    cls := self resolveClassNamed.
+    cls := self resolveRowClass.
 
     cls isNil 
     ifTrue:
@@ -2633,6 +2687,7 @@
     self generateSelectSelectorIn:cls.
     self generateWriteSelectorIn:cls.
     self generateDoubleClickSelectorIn:cls.
+    self generateRowSeparatorSelectorIn:cls.
 !
 
 doMoveColumn:upOrDown
@@ -2709,6 +2764,7 @@
     (columns size ~~ 0 and:[super doSave]) ifFalse:[
         ^ nil
     ].
+
     cls := self resolveName:specClass.
     dst := columns collect:[:aCol| aCol literalArrayEncoding ].
     spc := WriteStream on:String new.