support of hierarchical list editor
authorca
Tue, 02 Sep 1997 14:51:05 +0200
changeset 301 131f874fc2a2
parent 300 2a35cb573365
child 302 26cdfd3e1773
support of hierarchical list editor
UIPainter.st
--- a/UIPainter.st	Tue Sep 02 14:49:58 1997 +0200
+++ b/UIPainter.st	Tue Sep 02 14:51:05 1997 +0200
@@ -493,11 +493,11 @@
           #'window:' 
            #(#WindowSpec
               #'name:' 'Tree-View'
-              #'layout:' #(#LayoutFrame 135 0 129 0 648 0 589 0)
+              #'layout:' #(#LayoutFrame 143 0 224 0 656 0 684 0)
               #'label:' 'Tree-View'
               #'min:' #(#Point 10 10)
               #'max:' #(#Point 1160 870)
-              #'bounds:' #(#Rectangle 135 129 649 590)
+              #'bounds:' #(#Rectangle 143 224 657 685)
           )
           #'component:' 
            #(#SpecCollection
@@ -647,8 +647,12 @@
                                                   #'enableChannel:' #enableChannel
                                                   #'tabable:' true
                                                   #'menu:' #tabList
+                                                  #'style:' 
+                                                   #(#FontDescription
+                                                      #helvetica #medium
+                                                      #roman 10
+                                                  )
                                                   #'model:' #tabModel
-                                                  #'tabWidget:' #Window
                                                   #'canvas:' #noteBookView
                                               )
                                                #(#HorizontalPanelViewSpec
@@ -1436,6 +1440,53 @@
     ]
 
     "Modified: 31.7.1997 / 14:26:13 / cg"
+!
+
+openHierarchicalListEditor
+    "opens a hierarchical list editor editor on current widget
+    "
+    |cls aspect editor|
+
+    specClass isNil ifTrue:[
+        ^ self information:'no application class defined yet'.
+    ].
+    (cls := specClass) isBehavior ifFalse:[
+        cls := Smalltalk at:specClass asSymbol.
+        cls isNil ifTrue:[
+            ^ self information:'no application class defined yet'
+        ]
+    ].
+
+    cls notNil ifTrue:[
+        (aspect := self specTool specification modelSelector) notNil ifTrue:[
+            aspect := aspect asSymbol
+        ] ifFalse:[
+            "/ cg: q&d hack ...
+
+            aspect := treeView propertySelected.
+            aspect notNil ifTrue:[
+                Object errorSignal handle:[:ex |
+                    aspect := nil.
+                ] do:[
+                    aspect := aspect view asMenu.
+                ]
+            ].
+        ].
+        
+        editor := HierarchicalListEditor new.
+        editor masterApplication:self.
+        editor openModalOnClass:cls andSelector:aspect.
+
+        editor selectorName ~= aspect ifTrue:[
+            editor didInstall ifTrue:[
+                self specTool specification modelSelector:editor selectorName asSymbol.
+                self modifiedChannel value:true.
+                self accept
+            ]
+        ].
+    ]
+
+    "Modified: 31.7.1997 / 14:26:13 / cg"
 ! !
 
 !UIPainter methodsFor:'aspects'!
@@ -1916,7 +1967,9 @@
         view := self painter topView.
     ] ifFalse:[
         (property := treeView propertySelected) notNil ifTrue:[
-            view := property view.
+            treeView canResizeSelectedWidget ifTrue:[
+                view := property view.
+            ].
             spec := property spec copy.
         ]
     ].
@@ -1928,10 +1981,16 @@
         self helpTool helpKey:(spec activeHelpKey).
         slices := spec class slices.
         size   := slices size.
-        list   := Array new:(size + 2).
+
+        view notNil ifTrue:[
+            list := Array new:(size + 2).
+            list at:(size + 2) put:(UILayoutTool label).
+        ] ifFalse:[
+            list := Array new:(size + 1).
+        ].
         1 to:size do:[:i| list at:i put:((slices at:i) first asString)].
         list at:(size + 1) put:(UIHelpTool   label).
-        list at:(size + 2) put:(UILayoutTool label).
+
         self tabList value:list.
         self show:(spec class name).
         tabComponent enabled:true.
@@ -3040,6 +3099,20 @@
   ^ true
 !
 
+canResizeSelectedWidget
+    "returns true in case of one widget selected and is contained
+     within a widget which allows to resize sub components
+    "
+    |n|
+
+    (n := self selectedNode) notNil ifTrue:[
+        (n := n parent) notNil ifTrue:[
+            ^ (n parent isNil or:[n contents spec class canResizeSubComponents])
+        ]
+    ].
+    ^ false
+!
+
 hasOneSelectionOtherThanCanvas
     "returns true in case that one selection exists other than the canvas
     "