--- a/WindowBuilder.st Tue May 27 11:13:44 1997 +0200
+++ b/WindowBuilder.st Tue May 27 11:14:42 1997 +0200
@@ -186,29 +186,34 @@
!
subCanvasAt:majorKey at:minorKey
- |majorDict spec cls k|
+ "get the subCanvas specification from major and minor key
+ "
+ |spec cls dict dkey|
- k := majorKey ? #NoMajorKey.
subCanvasSpecs notNil ifTrue:[
- majorDict := subCanvasSpecs at:k ifAbsent:nil.
- majorDict notNil ifTrue:[
- spec := majorDict at:minorKey ifAbsent:nil.
+ dkey := majorKey ? #NoMajorKey.
+ dict := subCanvasSpecs at:dkey ifAbsent:nil.
+
+ dict notNil ifTrue:[
+ spec := dict at:minorKey ifAbsent:nil.
spec notNil ifTrue:[^ spec].
].
].
+
majorKey isNil ifTrue:[
- "/ I provide the spec
- application isNil ifTrue:[
- ^ nil
- ].
- spec := application specificationFor:minorKey
+ spec := self safelyPerform:#specificationFor: with:minorKey.
+
+ spec isNil ifTrue:[
+ spec := self safelyPerform:minorKey
+ ]
] ifFalse:[
cls := Smalltalk at:majorKey ifAbsent:nil.
- cls notNil ifTrue:[
+ (cls notNil and:[cls respondsTo:minorKey]) ifTrue:[
spec := cls perform:minorKey
]
].
- ^ spec
+ ^ spec
+
!
subCanvasAt:majorKey at:minorKey put:aSpec
@@ -290,6 +295,48 @@
focusSequence add:aComponent
! !
+!WindowBuilder methodsFor:'message sending'!
+
+safelyPerform:aSelector
+ "send the message aSelector to the receiver self or application;
+ the result returned from the send or nil is returned
+ "
+ |res|
+
+ (self respondsTo:aSelector) ifTrue:[
+ res := self perform:aSelector.
+ res notNil ifTrue:[
+ ^ res
+ ]
+ ].
+ application notNil ifTrue:[
+ (application respondsTo:aSelector) ifTrue:[
+ res := application perform:aSelector.
+ ]
+ ].
+ ^ res
+!
+
+safelyPerform:aSelector with:anArgument
+ "send the one-arg-message aSelector to the receiver self or application;
+ the result returned from the send or nil is returned
+ "
+ |res|
+
+ (self respondsTo:aSelector) ifTrue:[
+ res := self perform:aSelector with:anArgument.
+ res notNil ifTrue:[
+ ^ res
+ ]
+ ].
+ application notNil ifTrue:[
+ (application respondsTo:aSelector) ifTrue:[
+ res := application perform:aSelector with:anArgument.
+ ]
+ ].
+ ^ res
+! !
+
!WindowBuilder methodsFor:'spec creation aspect fetch'!
actionFor:aKey
@@ -612,5 +659,5 @@
!WindowBuilder class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.34 1997-05-20 07:06:17 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.35 1997-05-27 09:14:42 ca Exp $'
! !