MUST invoke #postBuildWith: / #postBuildAsSubcanvasWith:,
authortm
Mon, 17 Apr 2000 12:00:09 +0200
changeset 3196 43d42e7c388a
parent 3195 8f3b509b6231
child 3197 65e2cd11fcd2
MUST invoke #postBuildWith: / #postBuildAsSubcanvasWith:, when a new interface is built in #client:spec:builder:. Fix bad users of this interface in case of trouble.
SimpleView.st
--- a/SimpleView.st	Mon Apr 17 10:22:54 2000 +0200
+++ b/SimpleView.st	Mon Apr 17 12:00:09 2000 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+"{ Package: 'stx:libview' }"
+
 DisplaySurface subclass:#SimpleView
 	instanceVariableNames:'superView subViews components styleSheet resources borderColor
 		borderWidth viewShape top left extentChanged originChanged
@@ -40,15 +42,15 @@
 	privateIn:SimpleView
 !
 
-SimpleView::ViewShape subclass:#RoundViewShape
-	instanceVariableNames:''
+SimpleView::ViewShape subclass:#ArbitraryViewShape
+	instanceVariableNames:'viewShapeForm borderShapeForm'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:SimpleView
 !
 
-SimpleView::ViewShape subclass:#ArbitraryViewShape
-	instanceVariableNames:'viewShapeForm borderShapeForm'
+SimpleView::ViewShape subclass:#RoundViewShape
+	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:SimpleView
@@ -3259,33 +3261,46 @@
     "release existing components and generate new components from
      the given windowSpec, using the given builder."
 
-    |builder subSpec notAnAppModel|
+    |builder subSpec notAnAppModel savedView|
 
     aWindowSpecOrSpecSymbol isNil ifTrue:[^ self].
 
     (builder := aBuilder) isNil ifTrue:[
-	"/ problem: anApplication could have no builder
-	"/          or anApplication could be a non-appModel (theoretically - only providing a spec)
-	notAnAppModel := false.
-	builder := anApplication perform:#builder ifNotUnderstood:[notAnAppModel := true. nil].
-	builder isNil ifTrue:[
-	    notAnAppModel ifTrue:[
-		 builder := UIBuilder new.    
-	    ] ifFalse:[
-		 anApplication createBuilder.
-		 builder := anApplication builder
-	    ]
-	]
+        "/ problem: anApplication could have no builder
+        "/          or anApplication could be a non-appModel (theoretically - only providing a spec)
+        notAnAppModel := false.
+        builder := anApplication perform:#builder ifNotUnderstood:[notAnAppModel := true. nil].
+        builder isNil ifTrue:[
+            notAnAppModel ifTrue:[
+                 builder := UIBuilder new.    
+            ] ifFalse:[
+                 anApplication createBuilder.
+                 builder := anApplication builder
+            ]
+        ]
     ].
 
     (subSpec := aWindowSpecOrSpecSymbol) isSymbol ifTrue:[
-	anApplication isNil ifTrue:[^ self].
-	subSpec := anApplication class interfaceSpecFor:aWindowSpecOrSpecSymbol.
-	subSpec isNil ifTrue:[
-	    ^ self
-	].
-    ].
-    builder buildFromSpec:subSpec in:self.
+        anApplication isNil ifTrue:[^ self].
+        subSpec := anApplication class interfaceSpecFor:aWindowSpecOrSpecSymbol.
+        subSpec isNil ifTrue:[
+            ^ self
+        ].
+    ].
+
+    notAnAppModel ifTrue:[
+        builder buildFromSpec:subSpec in:self.
+    ] ifFalse:[
+        savedView := builder window.
+        builder window:self.
+        [
+            anApplication buildSubCanvas:subSpec withBuilder:builder.
+        ] valueNowOrOnUnwindDo:[
+            savedView notNil ifTrue:[
+                builder window:savedView.
+            ]
+        ].
+    ].
 !
 
 controller
@@ -8680,14 +8695,6 @@
     ^ false
 ! !
 
-!SimpleView::RoundViewShape methodsFor:'queries'!
-
-isRoundShape
-    ^ true
-
-
-! !
-
 !SimpleView::ArbitraryViewShape methodsFor:'accessing'!
 
 borderShapeForm
@@ -8722,9 +8729,17 @@
     "Created: 18.9.1997 / 11:04:29 / cg"
 ! !
 
+!SimpleView::RoundViewShape methodsFor:'queries'!
+
+isRoundShape
+    ^ true
+
+
+! !
+
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.371 2000-03-28 17:40:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.372 2000-04-17 10:00:09 tm Exp $'
 ! !
 SimpleView initialize!