change mechanism for opening the dataset builder (step 3)
authortz
Wed, 13 May 1998 23:54:07 +0200
changeset 827 aa8f49da0f22
parent 826 6c879f404dfe
child 828 12090f74be53
change mechanism for opening the dataset builder (step 3)
UIPainter.st
--- a/UIPainter.st	Wed May 13 23:51:23 1998 +0200
+++ b/UIPainter.st	Wed May 13 23:54:07 1998 +0200
@@ -1825,28 +1825,49 @@
 openDataSetColumnEditor
     "opens a Table Column Editor on current widget"
 
-    |cls editor|
+    |cls loadedFromClass loadedFromSpec editor tableColumnsOrSelector|
 
     (cls := self resolveName:specClass) isNil ifTrue:[
         self askForSaving ifFalse: [^self]
     ].
 
+    loadedFromSpec := loadedFromClass := false.
     editor := DataSetBuilder new.
     editor masterApplication:self.
     editor specClass: cls.
-"/    editor columns:self specTool specification columns.
     editor rowClassName:(self specTool specification rowClassName).
-    editor openModalOnResourceSpec:(self specTool specification columns).
-"/    editor openModal.
-
-    editor hasSaved ifFalse:[
+    ((tableColumnsOrSelector := self specTool specification columnHolder) notNil and: 
+    [cls class implements: tableColumnsOrSelector]) ifTrue: [
+        editor openModalOnClass: cls andSelector: tableColumnsOrSelector.
+        loadedFromClass := true.
+    ] ifFalse: [       
+        (tableColumnsOrSelector := self specTool specification columns) isNil ifTrue: [
+            editor openModal
+        ] ifFalse: [         
+            editor openModalOnResourceSpec:tableColumnsOrSelector.
+            loadedFromSpec := true
+        ].
+    ].
+
+    loadedFromClass ifTrue: [
+        self specTool specification columns:nil.
+        self specTool specification rowClassName:nil.
+        self modifiedChannel value:true.
+        self accept.
+    ].
+
+    (loadedFromSpec not and: [editor hasSaved and:[editor specSelector ~= tableColumnsOrSelector]]) ifTrue:[
+        self specTool specification columnHolder:editor specSelector.
+        self modifiedChannel value:true.
+        self accept.
+        ^self
+    ].
+    loadedFromClass ifFalse: [
         self specTool specification columns:(editor columns).
         self specTool specification rowClassName:(editor rowClassName).
-    ] ifTrue: [
-        self specTool specification columns:nil.
-        self specTool specification rowClassName:nil.
+        self modifiedChannel value: editor modified.
     ].
-    self modifiedChannel value: editor modified.
+
 
 !