ApplicationModel.st
changeset 2921 8ba6636c45e4
parent 2902 c47d671282f9
child 2923 f8b4ed9ccc80
--- a/ApplicationModel.st	Wed Jul 06 18:07:44 2011 +0200
+++ b/ApplicationModel.st	Thu Jul 07 18:42:44 2011 +0200
@@ -2344,11 +2344,15 @@
 !
 
 commonPostOpen
-    "a common hook for postOpenWith: and postOpenAsSubcanvasWith:."
+    "a common hook for postOpenWith:, postOpenAsSubcanvasWith: and postOpenAsDialogWith:."
+
+    "Modified (comment): / 07-07-2011 / 17:13:39 / cg"
 !
 
 commonPreBuild
-    "a common hook for preBuildWith: and preBuildAsSubcanvasWith:."
+    "a common hook for preBuildWith:, preBuildAsSubcanvasWith: and preBuildAsDialogWith:."
+
+    "Modified (comment): / 07-07-2011 / 17:13:51 / cg"
 !
 
 postApplicationProcessCreate:newProcess windowGroup:newGroup
@@ -2362,7 +2366,7 @@
 postBuildAsSubcanvasWith:aBuilder
     "this is sent after an interface is built from a spec as subcanvas.
      Can be redefined in subclasses for additional setup after
-     the subcanvas view has been built, but not yet opened."
+     the subcanvas' view has been built, but not yet opened."
 
     |sameApp|
 
@@ -2374,10 +2378,34 @@
     sameApp ifFalse:[
         self postBuildWith:aBuilder.
     ] ifTrue:[
+        "/ I no not think, that this is a good default
+        "/ self commonPostBuild.
+    ].
+
+    "Modified (comment): / 07-07-2011 / 17:16:30 / cg"
+!
+
+postBuildDialogWith:aBuilder
+    "this is sent after an interface is built from a spec as dialog with me
+     as a source (for aspects) i.e. via openDialogInterface:.
+     Can be redefined in subclasses for additional setup after
+     the dialog's view has been built, but not yet opened."
+
+    |sameApp|
+
+    sameApp := (aBuilder application == aBuilder window topView application).
+
+    "/ If I am opened as subcanvas in another application
+    "/ then treat this like a regular open.
+    "/ otherwise ignore it.
+    sameApp ifFalse:[
+        self postBuildWith:aBuilder.
+    ] ifTrue:[
         self commonPostBuild.
     ].
 
-    "Modified: / 8.7.1998 / 18:28:55 / cg"
+    "Modified: / 08-07-1998 / 18:28:55 / cg"
+    "Created: / 07-07-2011 / 17:20:29 / cg"
 !
 
 postBuildWith:aBuilder
@@ -2390,9 +2418,19 @@
 
 postOpenAsSubcanvasWith:aBuilder
     "this is sent after the applications window is opened inside another application.
-     Can be redefined in subclasses for actions after opening the view."
+     Can be redefined in subclasses for actions after showing the canvas view."
 
     self commonPostOpen
+
+    "Modified (comment): / 07-07-2011 / 17:16:46 / cg"
+!
+
+postOpenDialogWith:aBuilder
+    "this is sent after the applications window is opened as a dialog with me
+     as a source (for aspects) i.e. via openDialogInterface:.
+     Can be redefined in subclasses for actions after opening a dialog view."
+
+    "Created: / 07-07-2011 / 17:20:37 / cg"
 !
 
 postOpenWith:aBuilder
@@ -2409,6 +2447,14 @@
     self commonPreBuild
 !
 
+preBuildDialogWith:aBuilder
+    "this is sent before an interface is built from a spec as a dialog with me
+     as a source (for aspects) i.e. via openDialogInterface:.
+     Can be redefined for apps which need to be informed about that."
+
+    "Created: / 07-07-2011 / 17:20:48 / cg"
+!
+
 preBuildWith:aBuilder
     "this is sent before an interface is built from a spec.
      Can be redefined in subclasses.
@@ -2549,60 +2595,6 @@
     "Created: 14.2.1997 / 20:17:41 / cg"
 !
 
-openDialog
-    "open the window - assumes that the builder has already setup
-     the interface."
-
-    self window beToolDialog.
-    ^ 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, given a spec-selector"
-
-    ^ SimpleDialog new 
-        openFor:self 
-        interface:aSelector 
-        withBindings:bindings
-
-    "Created: / 28.2.1997 / 14:07:45 / cg"
-    "Modified: / 23.1.1998 / 18:18:14 / cg"
-!
-
-openDialogInterfaceSpec:aSpec withBindings:bindings
-    "open a dialog, given a spec"
-
-    ^ SimpleDialog new 
-        openFor:self 
-        interfaceSpec:aSpec 
-        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.
 
@@ -2790,29 +2782,40 @@
 !
 
 openWindow
-    "open the window - assumes that the builder has already setup
-     the interface."
-
-    builder openWindow.
+    "open the window 
+     - assumes that the builder has already setup the interface."
+
+    builder "openWindow."
+        openAt:nil
+        withExtent:nil
+        andType:(self defaultWindowType)
 
     "Created: / 14-02-1997 / 20:20:39 / cg"
-    "Modified: / 27-10-2006 / 11:49:00 / cg"
+    "Modified: / 07-07-2011 / 18:40:34 / cg"
 !
 
 openWindowAs:windowType
     "open the window - assumes that the builder has already setup the interface. 
      The windowType can be any of #slave, #partner, #dialog, #popUp etc."
 
-    builder openAt:nil withExtent:nil andType:windowType
+    builder 
+        openAt:nil 
+        withExtent:nil 
+        andType:windowType
+
+    "Modified (format): / 07-07-2011 / 18:40:54 / 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"
+openWindowAt:aPoint
+    "open the window 
+     - assumes that the builder has already setup the interface."
+
+    builder "openWindowAt:aLocation."
+        openAt:aPoint
+        withExtent:nil
+        andType:(self defaultWindowType)
+
+    "Created: / 14-02-1997 / 20:20:55 / cg"
 !
 
 openWindowAtCenter
@@ -2825,8 +2828,8 @@
 !
 
 openWindowModal
-    "open the window - assumes that the builder has already setup
-     the interface."
+    "open the window as a modal dialog
+     - assumes that the builder has already setup the interface."
 
 "/    builder openDialog.
     builder
@@ -2834,16 +2837,16 @@
         withExtent:nil 
         andType:#dialog
 
-    "Created: 14.2.1997 / 20:20:39 / cg"
+    "Created: / 14-02-1997 / 20:20:39 / cg"
 !
 
 openWindowModalAt:aLocation
-    "open the window modal - assumes that the builder has already setup
-     the interface."
+    "open the window as a modal dialog
+     - assumes that the builder has already setup the interface."
 
     builder openDialogAt:aLocation.
 
-    "Created: 14.2.1997 / 20:20:55 / cg"
+    "Created: / 14-02-1997 / 20:20:55 / cg"
 !
 
 openWithExtent:extPoint
@@ -2867,6 +2870,82 @@
     self postOpenWith:builder
 ! !
 
+!ApplicationModel methodsFor:'opening-dialogs'!
+
+openDialog
+    "open my window as a modal dialog 
+     - assumes that the builder has already setup the interface."
+
+    self window beToolDialog.
+    ^ builder openDialog.
+
+    "Modified: / 14-02-1997 / 20:32:52 / cg"
+    "Modified (comment): / 07-07-2011 / 17:25:45 / cg"
+!
+
+openDialogInterface:aSelector
+    "open a dialog"
+
+    "/ Notice: the opened dialog will be technically another instance
+    "/ (of SimpleDialog) but use me as aspect provider.
+    "/ It will call postOpenDialog: and postBuildDialog: as callbacks.
+
+    ^ self openDialogInterface:aSelector withBindings:nil
+
+    "Modified: / 28-02-1997 / 14:08:01 / cg"
+    "Modified (comment): / 07-07-2011 / 17:25:26 / cg"
+!
+
+openDialogInterface:aSelector withBindings:bindings
+    "open a dialog, given a spec-selector"
+
+    "/ Notice: the opened dialog will be technically another instance
+    "/ (of SimpleDialog) but use me as aspect provider.
+    "/ It will call postOpenDialog: and postBuildDialog: as callbacks.
+
+    ^ SimpleDialog new 
+        openFor:self 
+        interface:aSelector 
+        withBindings:bindings
+
+    "Created: / 28-02-1997 / 14:07:45 / cg"
+    "Modified: / 23-01-1998 / 18:18:14 / cg"
+    "Modified (comment): / 07-07-2011 / 17:25:23 / cg"
+!
+
+openDialogInterfaceSpec:aSpec withBindings:bindings
+    "open a dialog, given a spec"
+
+    "/ Notice: the opened dialog will be technically another instance
+    "/ (of SimpleDialog) but use me as aspect provider.
+    "/ It will call postOpenDialog: and postBuildDialog: as callbacks.
+
+    ^ SimpleDialog new 
+        openFor:self 
+        interfaceSpec:aSpec 
+        withBindings:bindings
+
+    "Created: / 28-02-1997 / 14:07:45 / cg"
+    "Modified: / 23-01-1998 / 18:18:14 / cg"
+    "Modified (comment): / 07-07-2011 / 17:25:20 / cg"
+!
+
+openDialogSpec:aSpec withBindings:bindings
+    "open a dialog"
+
+    "/ Notice: the opened dialog will be technically another instance
+    "/ (of SimpleDialog) but use me as aspect provider.
+    "/ It will call postOpenDialog: and postBuildDialog: as callbacks.
+
+    ^ SimpleDialog new 
+        openFor:self 
+        spec:aSpec 
+        withBindings:bindings
+
+    "Modified: / 23-01-1998 / 18:18:14 / cg"
+    "Created: / 20-05-1998 / 20:27:56 / cg"
+! !
+
 !ApplicationModel methodsFor:'opening-webInterface'!
 
 addToService
@@ -3761,12 +3840,8 @@
 
 !ApplicationModel class methodsFor:'documentation'!
 
-version
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.315 2011-03-23 18:49:16 cg Exp $'
-!
-
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.315 2011-03-23 18:49:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.316 2011-07-07 16:42:44 cg Exp $'
 ! !
 
 ApplicationModel initialize!