another convenient method: #listAspectFor:
authorClaus Gittinger <cg@exept.de>
Fri, 09 Jul 1999 21:22:01 +0200
changeset 1198 b10129322a0c
parent 1197 8e88ffde4374
child 1199 623c4cfe253d
another convenient method: #listAspectFor:
WinBuilder.st
WindowBuilder.st
--- a/WinBuilder.st	Thu Jul 08 11:28:22 1999 +0200
+++ b/WinBuilder.st	Fri Jul 09 21:22:01 1999 +0200
@@ -559,6 +559,23 @@
     "Modified: 28.7.1997 / 12:53:57 / cg"
 !
 
+listAspectFor:aKey
+    "helper (common code) to generate a list model aspect if required.
+     If no binding exists for aKey, a new List is
+     created and added to the bindings.
+     Otherwise, the existing binding is returned."
+
+    |list|
+
+    (list := self bindingAt:aKey) isNil ifTrue:[
+        self aspectAt:aKey put:(list := List new).
+    ].
+    ^ list
+
+    "Created: 28.7.1997 / 12:53:45 / cg"
+    "Modified: 28.7.1997 / 12:54:13 / cg"
+!
+
 nilValueAspectFor:aKey
     "helper (common code) to generate a valueHolder aspect if required.
      If no binding exists for aKey, a valueHolder holding nil is
@@ -777,7 +794,12 @@
 
     bindings notNil ifTrue:[
         b := bindings at:aKey ifAbsent:nil.
-        b notNil ifTrue:[^ b].
+        b notNil ifTrue:[
+            (b isBlock and:[b numArgs == 1]) ifTrue:[
+                ^ [:arg | b value:arg]
+            ].
+            ^ b
+        ].
     ].
 
     ^ self safelyPerform:#actionFor:withValue:
@@ -1183,5 +1205,5 @@
 !WindowBuilder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Attic/WinBuilder.st,v 1.77 1999-04-01 13:34:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/WinBuilder.st,v 1.78 1999-07-09 19:22:01 cg Exp $'
 ! !
--- a/WindowBuilder.st	Thu Jul 08 11:28:22 1999 +0200
+++ b/WindowBuilder.st	Fri Jul 09 21:22:01 1999 +0200
@@ -559,6 +559,23 @@
     "Modified: 28.7.1997 / 12:53:57 / cg"
 !
 
+listAspectFor:aKey
+    "helper (common code) to generate a list model aspect if required.
+     If no binding exists for aKey, a new List is
+     created and added to the bindings.
+     Otherwise, the existing binding is returned."
+
+    |list|
+
+    (list := self bindingAt:aKey) isNil ifTrue:[
+        self aspectAt:aKey put:(list := List new).
+    ].
+    ^ list
+
+    "Created: 28.7.1997 / 12:53:45 / cg"
+    "Modified: 28.7.1997 / 12:54:13 / cg"
+!
+
 nilValueAspectFor:aKey
     "helper (common code) to generate a valueHolder aspect if required.
      If no binding exists for aKey, a valueHolder holding nil is
@@ -777,7 +794,12 @@
 
     bindings notNil ifTrue:[
         b := bindings at:aKey ifAbsent:nil.
-        b notNil ifTrue:[^ b].
+        b notNil ifTrue:[
+            (b isBlock and:[b numArgs == 1]) ifTrue:[
+                ^ [:arg | b value:arg]
+            ].
+            ^ b
+        ].
     ].
 
     ^ self safelyPerform:#actionFor:withValue:
@@ -1183,5 +1205,5 @@
 !WindowBuilder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.77 1999-04-01 13:34:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.78 1999-07-09 19:22:01 cg Exp $'
 ! !