ApplicationModel.st
changeset 429 3311c88f2a0e
parent 428 25f3b4964f14
child 432 ba589e89a829
--- a/ApplicationModel.st	Fri Feb 14 20:35:37 1997 +0100
+++ b/ApplicationModel.st	Fri Feb 14 21:34:49 1997 +0100
@@ -48,7 +48,7 @@
     Since many ST-80 classes are subclasses of ApplicationModel, this class
     is provided here to allow easier porting of ST-80 code.
 
-    It does not (currently) provide much functionality and is NOT
+    It does not (currently) provide all functionality and is NOT
     compatible to the corresponding ST80 class; therefore, manual
     changes have to be made to get those applications to run under ST/X.
     (but at least, this enables you to fileIn that code and have a superclass
@@ -780,6 +780,51 @@
 
 ! !
 
+!ApplicationModel methodsFor:'easy bindings'!
+
+registerInterestIn: aValueModel using: aSelectorOrArray
+    "Register interest in a change in aValueModel using information in aSelectorOrArray.
+     aSelectorOrArray can be one of three things:  
+
+            1) nil                  in which case no interest is registered
+            2) a selector           in which case the receiver is understood to be self
+            3) an Array             in which case the size is two where the first element is the
+                                            message to be sent and the second element is the receiver."
+
+    aSelectorOrArray isNil ifTrue: [^ aValueModel].
+
+    (aSelectorOrArray isKindOf:Array) ifTrue:[
+        aValueModel onChangeSend:(aSelectorOrArray at: 1) to:(aSelectorOrArray at: 2)
+    ] ifFalse: [
+        aValueModel onChangeSend:aSelectorOrArray to:self
+    ].
+    ^aValueModel
+
+
+!
+
+valueHolderFor:aSelector initialValue:anObject
+    "Return a ValueHolder on anObject." 
+
+    ^ self valueHolderFor:aSelector initialValue:anObject changeMessage:nil
+
+
+!
+
+valueHolderFor: aSelector initialValue: anObject changeMessage: aSelectorOrArray
+    "Return a ValueHolder on anObject.  aSelectorOrArray is the change information 
+     for the ValueHolder.  This argument is either a Symbol or an Array of two elements.  
+     If it is a Symbol, then it is the change message and the interested object is understood
+     to be the reciever.  If it is an Array, then the first element is the change message and 
+     the second element is the interested object. " 
+
+    (self builder bindings includesKey:aSelector) ifFalse:[
+        ^ self registerInterestIn:(ValueHolder with:anObject) using:aSelectorOrArray
+    ].
+    ^ self builder aspectAt:aSelector
+
+! !
+
 !ApplicationModel methodsFor:'initialization'!
 
 addTopViewsToCurrentProject
@@ -917,6 +962,12 @@
     "Modified: 14.2.1997 / 20:32:52 / cg"
 !
 
+openDialogInterface:aSelector
+    "open a dialog"
+
+    SimpleDialog new openFor:self interface:aSelector
+!
+
 openWindow
     "open the window - assumes that the builder has already setup
      the interface."
@@ -1051,22 +1102,6 @@
     "Modified: 3.5.1996 / 13:39:15 / cg"
 !
 
-openAsDialogInterface:aSymbol
-    "open a specific interface as a modal dialog. 
-     The argument, aSymbol specifies which interface. The concrete
-     application subclass must provide a method with that name,
-     which must return an interfaceSpec. This is forwarded to
-     the builder to create the views.
-     Typically, applications only use one interface, 
-     returned by the #windowSpec method."
-
-    self allButOpenInterface:aSymbol.
-    self openDialog.
-    ^ builder
-
-    "Modified: 14.2.1997 / 20:31:27 / cg"
-!
-
 openAt:aPoint
     "open a standard interface at some point"
 
@@ -1202,6 +1237,6 @@
 !ApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.38 1997-02-14 19:35:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.39 1997-02-14 20:34:38 ca Exp $'
 ! !
 ApplicationModel initialize!