ApplicationModel.st
changeset 969 ac96df5a2f97
parent 967 2ddfe61c3c37
child 975 7edaf9f69ef7
--- a/ApplicationModel.st	Thu Jun 18 20:00:54 1998 +0200
+++ b/ApplicationModel.st	Thu Jun 18 21:36:52 1998 +0200
@@ -733,17 +733,11 @@
      Typically, a valueHolder is returned there."
 
     (self selfResponsibleFor:aKey) ifTrue:[
-        Object messageNotUnderstoodSignal handle:[:ex |
-            ex parameter selector ~~ aKey ifTrue:[
-                ex reject
-            ]
-        ] do:[
-            ^ self perform:aKey
-        ]
+        ^ self perform:aKey
     ].
     ^ masterApplication aspectFor:aKey
 
-    "Modified: / 18.6.1998 / 17:32:09 / cg"
+    "Modified: / 18.6.1998 / 20:33:23 / cg"
 !
 
 clientFor:aKey
@@ -758,17 +752,11 @@
      Typically, an applicationModel is returned there."
 
     (self selfResponsibleFor:aKey) ifTrue:[
-        Object messageNotUnderstoodSignal handle:[:ex |
-            ex parameter selector ~~ aKey ifTrue:[
-                ex reject
-            ]
-        ] do:[
-            ^ self perform:aKey
-        ]
+        ^ self perform:aKey
     ].
     ^ masterApplication clientFor:aKey
 
-    "Modified: / 18.6.1998 / 17:32:23 / cg"
+    "Modified: / 18.6.1998 / 20:33:30 / cg"
 !
 
 componentFor:aKey
@@ -783,17 +771,11 @@
      Typically, a view is returned there."
 
     (self selfResponsibleFor:aKey) ifTrue:[
-        Object messageNotUnderstoodSignal handle:[:ex |
-            ex parameter selector ~~ aKey ifTrue:[
-                ex reject
-            ]
-        ] do:[
-            ^ self perform:aKey
-        ]
+        ^ self perform:aKey
     ].
     ^ masterApplication componentFor:aKey
 
-    "Modified: / 18.6.1998 / 17:32:34 / cg"
+    "Modified: / 18.6.1998 / 20:33:36 / cg"
 !
 
 helpTextFor:aComponent
@@ -844,17 +826,11 @@
      Typically, a string is returned there."
 
     (self selfResponsibleFor:aKey) ifTrue:[
-        Object messageNotUnderstoodSignal handle:[:ex |
-            ex parameter selector ~~ aKey ifTrue:[
-                ex reject
-            ]
-        ] do:[
-            ^ self perform:aKey
-        ]
+        ^ self perform:aKey
     ].
     ^ masterApplication labelFor:aKey
 
-    "Modified: / 18.6.1998 / 17:32:46 / cg"
+    "Modified: / 18.6.1998 / 20:33:42 / cg"
 !
 
 listFor:aKey
@@ -874,13 +850,7 @@
     |a|
 
     (self selfResponsibleFor:aKey) ifTrue:[
-        Object messageNotUnderstoodSignal handle:[:ex |
-            ex parameter selector ~~ aKey ifTrue:[
-                ex reject
-            ]
-        ] do:[
-            ^ self perform:aKey
-        ]
+        ^ self perform:aKey
     ].
     a := self aspectFor:aKey.
     a notNil ifTrue:[
@@ -888,7 +858,7 @@
     ].
     ^ self application listFor:aKey
 
-    "Modified: / 18.6.1998 / 17:32:57 / cg"
+    "Modified: / 18.6.1998 / 20:33:50 / cg"
 !
 
 menuFor:aKey
@@ -903,17 +873,11 @@
      Typically, a menu or a menu-holding valueHolder is returned there."
 
     (self selfResponsibleFor:aKey) ifTrue:[
-        Object messageNotUnderstoodSignal handle:[:ex |
-            ex parameter selector ~~ aKey ifTrue:[
-                ex reject
-            ]
-        ] do:[
-            ^ self perform:aKey
-        ]
+        ^ self perform:aKey
     ].
     ^ masterApplication menuFor:aKey
 
-    "Modified: / 18.6.1998 / 17:31:08 / cg"
+    "Modified: / 18.6.1998 / 20:33:56 / cg"
 !
 
 specificationFor:aKey
@@ -930,13 +894,7 @@
      |app|
 
     (self selfResponsibleFor:aKey) ifTrue:[
-        Object messageNotUnderstoodSignal handle:[:ex |
-            ex parameter selector ~~ aKey ifTrue:[
-                ex reject
-            ]
-        ] do:[
-            ^ self perform:aKey
-        ]
+        ^ self perform:aKey
     ].
     ((app := self application) respondsTo:aKey) ifTrue:[
         ^ app perform:aKey
@@ -944,7 +902,7 @@
     ^ masterApplication specificationFor:aKey
 
     "Modified: / 5.2.1998 / 00:31:39 / stefan"
-    "Modified: / 18.6.1998 / 17:33:12 / cg"
+    "Modified: / 18.6.1998 / 20:34:02 / cg"
 !
 
 visualFor:aKey
@@ -1272,181 +1230,6 @@
 
 !ApplicationModel methodsFor:'opening'!
 
-openDialog
-    "open the window - assumes that the builder has already setup
-     the interface."
-
-    ^ builder openDialog.
-
-    "Modified: 14.2.1997 / 20:32:52 / cg"
-!
-
-openDialogInterface:aSelector
-    "open a dialog"
-
-    ^ self openDialogInterface:aSelector withBindings:nil
-
-    "Modified: 28.2.1997 / 14:08:01 / cg"
-!
-
-openDialogInterface:aSelector withBindings:bindings
-    "open a dialog"
-
-    ^ SimpleDialog new 
-        openFor:self 
-        interface:aSelector 
-        withBindings:bindings
-
-    "Created: / 28.2.1997 / 14:07:45 / cg"
-    "Modified: / 23.1.1998 / 18:18:14 / cg"
-!
-
-openDialogSpec:aSpec withBindings:bindings
-    "open a dialog"
-
-    ^ SimpleDialog new 
-        openFor:self 
-        spec:aSpec 
-        withBindings:bindings
-
-    "Modified: / 23.1.1998 / 18:18:14 / cg"
-    "Created: / 20.5.1998 / 20:27:56 / cg"
-!
-
-openWindow
-    "open the window - assumes that the builder has already setup
-     the interface."
-
-    builder open.
-
-    "Created: 14.2.1997 / 20:20:39 / cg"
-!
-
-openWindowAt:aLocation
-    "open the window - assumes that the builder has already setup
-     the interface."
-
-    builder openWindowAt:aLocation.
-
-    "Created: 14.2.1997 / 20:20:55 / cg"
-!
-
-openWindowModal
-    "open the window - assumes that the builder has already setup
-     the interface."
-
-    builder openModal.
-
-    "Created: 14.2.1997 / 20:20:39 / cg"
-! !
-
-!ApplicationModel methodsFor:'private'!
-
-opened:whichTopView
-    "the topView has been opened.
-     This is sent by my topView when its really open
-     (i.e. finally visible)"
-
-    self addTopViewsToCurrentProject.
-    self postOpenWith:builder
-
-!
-
-selfResponsibleFor:aKey
-    ^ (aKey isNil or:[masterApplication isNil or:[self respondsTo:aKey]])
-! !
-
-!ApplicationModel methodsFor:'queries'!
-
-defaultWindowType
-    "Applications come up non-modal, by default"
-
-    ^ #normal
-
-    "Created: 17.1.1997 / 19:57:34 / cg"
-!
-
-graphicsDevice
-    "return the device I want to open my views on.
-     The default (if not created with #onDevice:) is the currently
-     active screen."
-
-    ^ device
-
-    "Created: 5.7.1996 / 17:51:31 / cg"
-!
-
-interfaceSpecFor:aSelector
-    "return an interface spec.
-     Here, the query is forwarded to my class.
-     Can be refefined in subclasses which want to provide per-instance specs."
-
-    ^ self class interfaceSpecFor:aSelector
-
-    "Created: / 25.1.1998 / 19:45:12 / cg"
-    "Modified: / 25.1.1998 / 19:47:09 / cg"
-!
-
-processName
-    "return a name to be shown for me in the process monitor"
-
-    self class == ApplicationModel ifTrue:[
-        ^ 'Application'
-    ].
-    ^ self class nameWithoutPrefix
-
-    "Modified: / 4.12.1997 / 12:39:14 / cg"
-!
-
-resolveClassNamed:something inClass:aClass
-    "return the class from something, a class, symbol, string or nil.
-     first we are looking in the namespace of the application, than of the
-     current namespace and than in Smalltalk
-    "
-
-    ^ Smalltalk resolveName:something inClass:aClass.
-!
-
-resolveName:something
-    "return the class from something, a class, symbol, string or nil.
-     first we are looking in the namespace of the application, than of the
-     current namespace and than in Smalltalk
-    "
-    ^ self resolveName:something inClass:self class
-!
-
-resolveName:something inClass:aClass
-    "return the class from something, a class, symbol, string or nil.
-     first we are looking in the namespace of the application, than of the
-     current namespace and than in Smalltalk
-    "
-    |cls|
-
-    aClass notNil ifTrue:[
-        (cls := Smalltalk resolveName:something inClass:aClass) notNil ifTrue:[
-            ^ cls
-        ].
-
-        masterApplication notNil ifTrue:[
-            ^ masterApplication resolveName:something
-        ]
-    ].
-    ^ nil
-!
-
-topApplication
-    "return the top-master application"
-
-    masterApplication isNil ifTrue:[
-        ^ self
-    ].
-    ^ masterApplication topApplication
-
-    "Created: / 6.6.1998 / 19:40:42 / cg"
-! !
-
-!ApplicationModel methodsFor:'startup / release'!
-
 allButOpenFrom:aSpec
     "create my views but do not open the main window.
      The argument is a spec which defines the interface."
@@ -1498,82 +1281,19 @@
     "Modified: / 20.5.1998 / 20:07:18 / cg"
 !
 
-close
-    "this is sent by my topView when about to be closed
-     by the program (not by the windowManager).
-     Could be redefined in subclasses."
-
-    self closeDownViews
-!
-
-closeDownViews
-    "close down the applications view(s)"
-
-    |wg views|
-
-    (wg := self windowGroup) notNil ifTrue:[
-        views := wg topViews.
-        views notNil ifTrue:[
-            views copy do:[:aView |
-                aView notNil ifTrue:[aView destroy]
-            ]
-        ]
-    ]
-!
-
-closeRequest
-    "this is sent by my topView when about to be closed
-     by the windowManager.
-     Could be redefined in subclasses to suppress close or confirm."
-
-    |sav|
-
-    masterApplication notNil ifTrue:[
-
-        "/ temporary clear my masterApplication to prevent
-        "/ endless recursion, in case the master sends me
-        "/ a closeRequest (although, it is supposed to
-        "/ send me a closeDownViews ...)
+buildSubCanvas:spec withBuilder:aBuilder
+    "build a subcanvases spec into aSubcanvas"
 
-        sav := masterApplication.
-        masterApplication := nil.
-        sav closeRequestFor:(self window).
-
-        "/ restore - in case master did not want me to close ...
-        masterApplication := sav.
-    ] ifFalse:[
-        self closeDownViews
+    builder isNil ifTrue:[
+        builder := aBuilder
     ].
-
-    "Modified: 4.3.1997 / 00:48:15 / cg"
-!
+    aBuilder source:self.
+    self preBuildWith:aBuilder.
+    aBuilder buildFromSpec:spec.
+    self postBuildWith:aBuilder.
+    ^ aBuilder
 
-closeRequestFor:aTopView
-    "this is sent by any of my topViews when about to be closed by the
-     windowmanager. For backward compatibility with single-view applications,
-     this is forwarded here to a simple (non topView-specific) closeRequest,
-     effectively closing all of my views.
-     MultiView applications should redefine this method if closing of individual
-     views closing is to be caught and/or should not close all of them."
-
-    |sav|
-
-    masterApplication notNil ifTrue:[
-
-        "/ temporary clear my masterApplication to prevent
-        "/ endless recursion, in case the master sends me
-        "/ a closeRequest (although, it is supposed to
-        "/ send me a closeDownViews ...)
-
-        sav := masterApplication.
-        masterApplication := nil.
-        sav closeRequestFor:(self window).
-
-        "/ restore - in case master did not want me to close ...
-        masterApplication := sav.
-    ] ifFalse:[
-        self closeRequest
-    ]
+    "Created: / 18.6.1998 / 20:08:45 / cg"
 !
 
 open
@@ -1593,6 +1313,47 @@
     "Created: 14.2.1997 / 20:17:41 / cg"
 !
 
+openDialog
+    "open the window - assumes that the builder has already setup
+     the interface."
+
+    ^ builder openDialog.
+
+    "Modified: 14.2.1997 / 20:32:52 / cg"
+!
+
+openDialogInterface:aSelector
+    "open a dialog"
+
+    ^ self openDialogInterface:aSelector withBindings:nil
+
+    "Modified: 28.2.1997 / 14:08:01 / cg"
+!
+
+openDialogInterface:aSelector withBindings:bindings
+    "open a dialog"
+
+    ^ SimpleDialog new 
+        openFor:self 
+        interface:aSelector 
+        withBindings:bindings
+
+    "Created: / 28.2.1997 / 14:07:45 / cg"
+    "Modified: / 23.1.1998 / 18:18:14 / cg"
+!
+
+openDialogSpec:aSpec withBindings:bindings
+    "open a dialog"
+
+    ^ SimpleDialog new 
+        openFor:self 
+        spec:aSpec 
+        withBindings:bindings
+
+    "Modified: / 23.1.1998 / 18:18:14 / cg"
+    "Created: / 20.5.1998 / 20:27:56 / cg"
+!
+
 openInterface
     "open a standard interface.
 
@@ -1717,6 +1478,33 @@
     "Created: / 20.5.1998 / 20:20:21 / cg"
 !
 
+openWindow
+    "open the window - assumes that the builder has already setup
+     the interface."
+
+    builder open.
+
+    "Created: 14.2.1997 / 20:20:39 / cg"
+!
+
+openWindowAt:aLocation
+    "open the window - assumes that the builder has already setup
+     the interface."
+
+    builder openWindowAt:aLocation.
+
+    "Created: 14.2.1997 / 20:20:55 / cg"
+!
+
+openWindowModal
+    "open the window - assumes that the builder has already setup
+     the interface."
+
+    builder openModal.
+
+    "Created: 14.2.1997 / 20:20:39 / cg"
+!
+
 postBuildWith:aBuilder
     "this is sent after an interface is built from a spec.
      Can be redefined in subclasses for additional setup after
@@ -1734,6 +1522,191 @@
     "this is sent before an interface is built from a spec.
      Can be redefined in subclasses.
      mhmh - what should this do here ?"
+! !
+
+!ApplicationModel methodsFor:'private'!
+
+opened:whichTopView
+    "the topView has been opened.
+     This is sent by my topView when its really open
+     (i.e. finally visible)"
+
+    self addTopViewsToCurrentProject.
+    self postOpenWith:builder
+
+!
+
+selfResponsibleFor:aKey
+    ^ (aKey isNil or:[masterApplication isNil or:[self respondsTo:aKey]])
+! !
+
+!ApplicationModel methodsFor:'queries'!
+
+defaultWindowType
+    "Applications come up non-modal, by default"
+
+    ^ #normal
+
+    "Created: 17.1.1997 / 19:57:34 / cg"
+!
+
+graphicsDevice
+    "return the device I want to open my views on.
+     The default (if not created with #onDevice:) is the currently
+     active screen."
+
+    ^ device
+
+    "Created: 5.7.1996 / 17:51:31 / cg"
+!
+
+interfaceSpecFor:aSelector
+    "return an interface spec.
+     Here, the query is forwarded to my class.
+     Can be refefined in subclasses which want to provide per-instance specs."
+
+    ^ self class interfaceSpecFor:aSelector
+
+    "Created: / 25.1.1998 / 19:45:12 / cg"
+    "Modified: / 25.1.1998 / 19:47:09 / cg"
+!
+
+processName
+    "return a name to be shown for me in the process monitor"
+
+    self class == ApplicationModel ifTrue:[
+        ^ 'Application'
+    ].
+    ^ self class nameWithoutPrefix
+
+    "Modified: / 4.12.1997 / 12:39:14 / cg"
+!
+
+resolveClassNamed:something inClass:aClass
+    "return the class from something, a class, symbol, string or nil.
+     first we are looking in the namespace of the application, than of the
+     current namespace and than in Smalltalk
+    "
+
+    ^ Smalltalk resolveName:something inClass:aClass.
+!
+
+resolveName:something
+    "return the class from something, a class, symbol, string or nil.
+     first we are looking in the namespace of the application, than of the
+     current namespace and than in Smalltalk
+    "
+    ^ self resolveName:something inClass:self class
+!
+
+resolveName:something inClass:aClass
+    "return the class from something, a class, symbol, string or nil.
+     first we are looking in the namespace of the application, than of the
+     current namespace and than in Smalltalk
+    "
+    |cls|
+
+    aClass notNil ifTrue:[
+        (cls := Smalltalk resolveName:something inClass:aClass) notNil ifTrue:[
+            ^ cls
+        ].
+
+        masterApplication notNil ifTrue:[
+            ^ masterApplication resolveName:something
+        ]
+    ].
+    ^ nil
+!
+
+topApplication
+    "return the top-master application"
+
+    masterApplication isNil ifTrue:[
+        ^ self
+    ].
+    ^ masterApplication topApplication
+
+    "Created: / 6.6.1998 / 19:40:42 / cg"
+! !
+
+!ApplicationModel methodsFor:'startup / release'!
+
+close
+    "this is sent by my topView when about to be closed
+     by the program (not by the windowManager).
+     Could be redefined in subclasses."
+
+    self closeDownViews
+!
+
+closeDownViews
+    "close down the applications view(s)"
+
+    |wg views|
+
+    (wg := self windowGroup) notNil ifTrue:[
+        views := wg topViews.
+        views notNil ifTrue:[
+            views copy do:[:aView |
+                aView notNil ifTrue:[aView destroy]
+            ]
+        ]
+    ]
+!
+
+closeRequest
+    "this is sent by my topView when about to be closed
+     by the windowManager.
+     Could be redefined in subclasses to suppress close or confirm."
+
+    |sav|
+
+    masterApplication notNil ifTrue:[
+
+        "/ temporary clear my masterApplication to prevent
+        "/ endless recursion, in case the master sends me
+        "/ a closeRequest (although, it is supposed to
+        "/ send me a closeDownViews ...)
+
+        sav := masterApplication.
+        masterApplication := nil.
+        sav closeRequestFor:(self window).
+
+        "/ restore - in case master did not want me to close ...
+        masterApplication := sav.
+    ] ifFalse:[
+        self closeDownViews
+    ].
+
+    "Modified: 4.3.1997 / 00:48:15 / cg"
+!
+
+closeRequestFor:aTopView
+    "this is sent by any of my topViews when about to be closed by the
+     windowmanager. For backward compatibility with single-view applications,
+     this is forwarded here to a simple (non topView-specific) closeRequest,
+     effectively closing all of my views.
+     MultiView applications should redefine this method if closing of individual
+     views closing is to be caught and/or should not close all of them."
+
+    |sav|
+
+    masterApplication notNil ifTrue:[
+
+        "/ temporary clear my masterApplication to prevent
+        "/ endless recursion, in case the master sends me
+        "/ a closeRequest (although, it is supposed to
+        "/ send me a closeDownViews ...)
+
+        sav := masterApplication.
+        masterApplication := nil.
+        sav closeRequestFor:(self window).
+
+        "/ restore - in case master did not want me to close ...
+        masterApplication := sav.
+    ] ifFalse:[
+        self closeRequest
+    ]
 !
 
 restarted
@@ -1798,6 +1771,6 @@
 !ApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.85 1998-06-18 17:16:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.86 1998-06-18 19:36:52 cg Exp $'
 ! !
 ApplicationModel initialize!