--- a/WindowBuilder.st Mon Jan 07 14:33:37 2008 +0100
+++ b/WindowBuilder.st Tue Jan 08 12:52:49 2008 +0100
@@ -749,11 +749,12 @@
"send the message aSelector to the application;
the result returned from the send or nil is returned
"
- |cls handlerBlock|
+ |handlerBlock|
aSelector notNil ifTrue:[
- handlerBlock := [:ex|
- (ex selector ~~ aSelector) ifTrue:[
+ handlerBlock := [:ex| |badSel|
+ badSel := ex selector.
+ (badSel ~~ aSelector) ifTrue:[
ex reject
]
].
@@ -762,10 +763,8 @@
MessageNotUnderstood handle:handlerBlock do:[
^ application perform:aSelector
].
- cls := application class.
-
MessageNotUnderstood handle:handlerBlock do:[
- ^ cls perform:aSelector
+ ^ application class perform:aSelector
]
].
"
@@ -778,7 +777,7 @@
]
]
].
- ^ aBlock value
+ ^ aBlock value
"Modified: / 20.6.1998 / 11:52:19 / cg"
!
@@ -787,22 +786,52 @@
"send the one-arg-message aSelector to the application;
the result returned from the send or nil is returned"
+ ^ self
+ safelyPerform:aSelector
+ withArguments:(Array with:anArgument)
+ ifNone:aBlock
+!
+
+safelyPerform:aSelector with:arg1 with:arg2 ifNone:aBlock
+ "send the two-arg-message aSelector to the application;
+ the result returned from the send or nil is returned"
+
+ ^ self
+ safelyPerform:aSelector
+ withArguments:(Array with:arg1 with:arg2)
+ ifNone:aBlock
+!
+
+safelyPerform:aSelector with:arg1 with:arg2 with:arg3 ifNone:aBlock
+ "send the 3-arg-message aSelector to the application;
+ the result returned from the send or nil is returned"
+
+ ^ self
+ safelyPerform:aSelector
+ withArguments:(Array with:arg1 with:arg2 with:arg3)
+ ifNone:aBlock
+!
+
+safelyPerform:aSelector withArguments:arguments ifNone:aBlock
+ "send the one-arg-message aSelector to the application;
+ the result returned from the send or nil is returned"
+
|handlerBlock|
aSelector notNil ifTrue:[
handlerBlock := [:ex| |badSel|
badSel := ex selector.
- (badSel ~~ aSelector and:[badSel ~~ anArgument]) ifTrue:[
+ (badSel ~~ aSelector and:[badSel ~~ arguments first]) ifTrue:[
ex reject
]
].
application notNil ifTrue:[
MessageNotUnderstood handle:handlerBlock do:[
- ^ application perform:aSelector with:anArgument
+ ^ application perform:aSelector withArguments:arguments
].
MessageNotUnderstood handle:handlerBlock do:[
- ^ application class perform:aSelector with:anArgument
+ ^ application class perform:aSelector withArguments:arguments
]
].
"
@@ -811,54 +840,13 @@
"
applicationClass notNil ifTrue:[
MessageNotUnderstood handle:handlerBlock do:[
- ^ applicationClass perform:aSelector with:anArgument
+ ^ applicationClass perform:aSelector withArguments:arguments
].
]
].
^ aBlock value
"Modified: / 4.8.1998 / 19:33:52 / cg"
-!
-
-safelyPerform:aSelector with:arg1 with:arg2 ifNone:aBlock
- "send the two-arg-message aSelector to the application;
- the result returned from the send or nil is returned"
-
- |cls handlerBlock|
-
- aSelector notNil ifTrue:[
- handlerBlock := [:ex|
- |badSel|
-
- badSel := ex selector.
- (badSel ~~ aSelector and:[badSel ~~ arg1]) ifTrue:[
- ex reject
- ]
- ].
-
- application notNil ifTrue:[
- MessageNotUnderstood handle:handlerBlock do:[
- ^ application perform:aSelector with:arg1 with:arg2
- ].
- cls := application class.
-
- MessageNotUnderstood handle:handlerBlock do:[
- ^ cls perform:aSelector with:arg1 with:arg2
- ]
- ].
- "
- WARNING:
- This is a private interface for the UIPainter to pass down the app-class
- "
- applicationClass notNil ifTrue:[
- MessageNotUnderstood handle:handlerBlock do:[
- ^ applicationClass perform:aSelector with:arg1 with:arg2
- ].
- ]
- ].
- ^ aBlock value
-
- "Modified: / 18.6.1998 / 21:40:13 / cg"
! !
!WindowBuilder methodsFor:'spec creation aspect fetch'!
@@ -897,16 +885,45 @@
b := bindings at:aKey ifAbsent:nil.
b notNil ifTrue:[
(b isBlock and:[b numArgs == 1]) ifTrue:[
- ^ [:arg | b value:arg]
+ ^ [b value:aValue]
].
^ b
].
].
- ^ self safelyPerform:#actionFor:withValue:
- with:aKey
- with:aValue
- ifNone:[ self aspectNotFound:aKey error:'no action for:'. [:dummy |] ]
+ ^ self
+ safelyPerform:#actionFor:withValue:
+ withArguments:(Array with:aKey with:aValue)
+ ifNone:[ self aspectNotFound:aKey error:'no action for:'.
+ []
+ ]
+!
+
+actionFor:aKey withValue:arg1 withValue:arg2
+ "return an action for aKey/value combination.
+ This is invoked during window building
+ (by the builder) to ask for an ActionButtons actionBlock if that button
+ specified an action with an argument value.
+ Here, first the local bindings are searched, then the application and
+ finally the applications class is asked for a corresponding action.
+ The returned object is typically a block."
+
+ |b|
+
+ bindings notNil ifTrue:[
+ b := bindings at:aKey ifAbsent:nil.
+ b notNil ifTrue:[
+ (b isBlock and:[b numArgs == 2]) ifTrue:[
+ ^ [b value:arg1 value:arg2]
+ ].
+ ^ b
+ ].
+ ].
+
+ ^ self
+ safelyPerform:#actionFor:withValue:withValue:
+ withArguments:(Array with:aKey with:arg1 with:arg2)
+ ifNone:[ self aspectNotFound:aKey error:'no action for:'. ]
!
aspectFor:aKey
@@ -1363,5 +1380,5 @@
!WindowBuilder class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.125 2008-01-07 13:33:37 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.126 2008-01-08 11:52:49 cg Exp $'
! !