DataSetColumn.st
changeset 614 8316c869d4df
parent 607 a5e0c2bf1370
child 621 620553e6a537
--- a/DataSetColumn.st	Wed Nov 12 17:26:33 1997 +0100
+++ b/DataSetColumn.st	Wed Nov 12 17:27:30 1997 +0100
@@ -56,7 +56,6 @@
         form            <Form>                  a form drawn when a cell is unselected
         form2           <Form>                  a second form (used by Toggle off).
         label           <misc>                  cellLabel on device
-        writeSelector   <Selector>              to write back a value
 
     [author:]
         Claus Atzkern
@@ -75,15 +74,13 @@
 at:aRowNr
     "get the value of the raw at an index, aRowNr
     "
-    ^ (dataSet at:aRowNr) perform:(description readSelector)
+    ^ description row:(dataSet at:aRowNr) at:columnNumber
 !
 
 at:aRowNr put:something
     "set the value of the raw at an index, aRowNr
     "
-    writeSelector notNil ifTrue:[
-        (dataSet at:aRowNr) perform:writeSelector with:something
-    ]
+    description row:(dataSet at:aRowNr) at:columnNumber put:something
 !
 
 backgroundColor
@@ -346,6 +343,19 @@
 
 ! !
 
+!DataSetColumn methodsFor:'editing'!
+
+editorAt:aRowNr in:aView with:fg bg:bg
+
+    ^ description editorOn:(dataSet at:aRowNr)
+                     value:(self at:aRowNr)
+                        in:aView
+                      with:fg
+                        bg:bg.
+
+
+! !
+
 !DataSetColumn methodsFor:'event handling'!
 
 doesNotUnderstand:aMessage
@@ -429,7 +439,7 @@
 on:aDSVColumnView description:aDescription columnNumber:aNumber
     "instance creation; set attributes dependent on the description
     "
-    |rendererType device selector formatStr idx|
+    |rendererType device selector format idx type|
 
     columnNumber    := aNumber.
     dataSet         := aDSVColumnView.
@@ -439,7 +449,6 @@
     device          := dataSet device.
     label           := description rawLabel.
     drawableAction  := nil.
-    writeSelector   := description writeSelector.
     backgroundColor := description backgroundColor.
     foregroundColor := description foregroundColor.
 
@@ -473,54 +482,30 @@
 
     selector notNil ifTrue:[
         drawableAction := [:aRowNr|
-            (dataSet list at:aRowNr) perform:selector with:dataSet
+            (dataSet at:aRowNr) perform:selector with:dataSet
         ].
         ^ self
     ].
 
-    selector  := description readSelector.
-    formatStr := description formatString.
-
-    (formatStr notNil and:[description type == #number]) ifTrue:[
-
+    (     (format := description formatString) notNil
+     and:[(type   := description type) == #number or:[type == #numberOrNil]]
+    ) ifTrue:[
         "/ has a format string for number (supports only floats)
 
-        (idx := formatStr indexOf:$.) ~~ 0 ifTrue:[
-            idx := formatStr size - idx
+        (idx := format indexOf:$.) ~~ 0 ifTrue:[
+            idx := format size - idx
         ].
-        formatStr := '%0.', idx printString, 'f'.
+        format := '%0.', idx printString, 'f'.
 
         drawableAction := [:aRowNr||num|
-            num := (dataSet list at:aRowNr) perform:selector.
-            
-            num isReal ifTrue:[
-                num := num asFloat printfPrintString:formatStr.
+            (num := self at:aRowNr) isReal ifTrue:[
+                num := num asFloat printfPrintString:format.
             ].
             num
-        ].
-        ^ self
-    ].
-
-    "/ default: no format string
-
-    drawableAction := [:aRowNr|
-        (dataSet list at:aRowNr) perform:selector
-    ].
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+        ]
+    ] ifFalse:[                                         "/ default: no format string
+        drawableAction := [:aRowNr| self at:aRowNr ]
+    ]
 
 
 ! !
@@ -601,5 +586,5 @@
 !DataSetColumn class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.9 1997-11-07 13:27:44 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.10 1997-11-12 16:27:30 ca Exp $'
 ! !