checkin from browser
authorca
Sat, 29 Jan 2000 13:30:18 +0100
changeset 1315 8722cfe3cce1
parent 1314 f22b28597a05
child 1316 d66f0b84aa6b
checkin from browser
UISpecificationTool.st
--- a/UISpecificationTool.st	Fri Jan 28 17:10:10 2000 +0100
+++ b/UISpecificationTool.st	Sat Jan 29 13:30:18 2000 +0100
@@ -698,13 +698,21 @@
       )
 ! !
 
-!UISpecificationTool methodsFor:'accessing'!
+!UISpecificationTool methodsFor:'accessing channels'!
+
+modifiedHolder:aValueHolder
+    "set the value holder set to true in case of modifying attributes
+    "
+
+    modifiedHolder removeDependent:self.
 
-acceptChannel
-    "return the value of the instance variable 'acceptChannel' (automatically generated)"
+    (modifiedHolder := aValueHolder) notNil ifTrue:[
+        modifiedHolder addDependent:self.
+    ].
 
-    ^ masterApplication acceptChannel
-!
+! !
+
+!UISpecificationTool methodsFor:'accessing specification'!
 
 specification
     "gets current edit specification
@@ -717,17 +725,25 @@
 specification:aSpec
     "sets current edit specification
     "
-    aSpec isNil ifTrue:[
-        ^ self specificationChanged
+    aSpec notNil ifTrue:[
+        "/ same type of spec - simply change the spec;  no need to setup everything
+        specification class == aSpec class ifTrue:[
+            specification := aSpec.
+            specChannel value:specification.
+          ^ self
+        ]
     ].
-    "/ same type of spec - simply change the spec;  no need to setup everything
 
-    specification class == aSpec class ifTrue:[
-        specification := aSpec.
-      ^ specChannel value:specification.
+    "/ release resources
+    specChannel release.
+    aspects     release.
+    selection := listOfSpecViews := nil.
+    buildInView destroyAllSubSpecs.
+
+    (specification := aSpec) isNil ifTrue:[
+        aspects := specChannel := nil.
+      ^ self
     ].
-    self specificationChanged.
-    specification := aSpec.
     
     "/ some tricky specs need the builder during the addBindings phase.
     "/ This is passed down in a special UIBindingsDictionary
@@ -746,20 +762,6 @@
 
 ! !
 
-!UISpecificationTool methodsFor:'accessing channels'!
-
-modifiedHolder:aValueHolder
-    "set the value holder set to true in case of modifying attributes
-    "
-
-    modifiedHolder removeDependent:self.
-
-    (modifiedHolder := aValueHolder) notNil ifTrue:[
-        modifiedHolder addDependent:self.
-    ].
-
-! !
-
 !UISpecificationTool methodsFor:'actions'!
 
 setMaxExtent
@@ -791,6 +793,12 @@
 
 !UISpecificationTool methodsFor:'bindings'!
 
+acceptChannel
+    "return the value of the instance variable 'acceptChannel' (automatically generated)"
+
+    ^ masterApplication acceptChannel
+!
+
 aspectFor:aKey
     "returns aspect for a key or nil
     "
@@ -802,38 +810,9 @@
 !
 
 buildInView
-
-    buildInView isNil ifTrue:[
-        buildInView := BuildInView new.
-    ].
     ^ buildInView
 !
 
-specificationChanged
-
-    specChannel notNil ifTrue:[
-        specChannel release.
-        specChannel := nil.
-    ].
-    aspects notNil ifTrue:[
-        aspects release.
-        aspects := nil.
-    ].
-    selection     := nil.
-    specification := nil.
-
-    listOfSpecViews notNil ifTrue:[
-        self buildInView scrolledView:nil.
-
-        listOfSpecViews do:[:aView|
-            aView notNil ifTrue:[
-                aView destroy
-            ]
-        ].
-        listOfSpecViews := nil.
-    ].
-!
-
 specificationFor:aKey
     "this is called if our current specification contains 
      subspecifications or subcanvases.
@@ -870,6 +849,13 @@
     "Modified: / 16.7.1998 / 19:25:59 / cg"
 ! !
 
+!UISpecificationTool methodsFor:'initialization'!
+
+initialize
+    super initialize.
+    buildInView := BuildInView new.
+! !
+
 !UISpecificationTool methodsFor:'selection'!
 
 selection:something
@@ -898,24 +884,31 @@
                 listOfSpecViews at:index put:window.
             ].
         ].
-        self buildInView scrolledView:window.
+        buildInView scrolledView:window.
     ].
 ! !
 
 !UISpecificationTool::BuildInView methodsFor:'accessing'!
 
+destroyAllSubSpecs
+    "destroy all subViews which represents a specification
+    "
+    outerFrame destroySubViews.
+
+    scrolledView notNil ifTrue:[
+        scrolledView := nil.
+        self sizeChanged:nil.
+    ]
+
+
+!
+
 scrolledView:aView
     "set the view to be scrolled"
     |scr|
 
     scrolledView == aView ifTrue:[^ self].
 
-    outerFrame isNil ifTrue:[
-        outerFrame := SimpleView origin:0.0@0.0 corner:1.0@1.0 in:self.
-        outerFrame borderWidth:0; level:0.
-        realized ifTrue:[outerFrame realize].
-    ].
-
     scrolledView notNil ifTrue:[scrolledView unmap].
 
     (scrolledView := aView) isNil ifTrue:[
@@ -944,11 +937,20 @@
 
 !UISpecificationTool::BuildInView methodsFor:'initialization'!
 
+initialize
+    super initialize.
+    outerFrame := SimpleView origin:0.0@0.0 corner:1.0@1.0 in:self.
+    outerFrame borderWidth:0; level:0.
+
+
+!
+
 level:aLevel
     super level:0
 !
 
 realize
+
     super realize.
     superView notNil ifTrue:[superView level:0].
 ! !