--- a/WindowBuilder.st Thu Feb 05 13:49:55 1998 +0100
+++ b/WindowBuilder.st Thu Feb 05 13:55:30 1998 +0100
@@ -293,9 +293,9 @@
!
subCanvasAt:majorKey at:minorKey
- "get the subCanvas specification from major and minor key.
+ "get the subCanvas or subSpec specification from major and minor key.
Here, we first look for a spec in the private subCanvasSpecs dictionary,
- which can be filled via #subCanvasAt:put: messages.
+ which can be filled via #specificationAt:at:put: messages.
If not present, or none is found there, we bounce back trying
#specificationFor: (if majorKey is nil) or by sending the minorKey
message to the class named as majorKey.
@@ -303,7 +303,7 @@
application classes namespace - allowing private classes as majorKey.
"
- |spec cls app dict dkey|
+ |spec cls dict dkey|
subCanvasSpecs notNil ifTrue:[
dkey := majorKey ? #NoMajorKey.
@@ -316,39 +316,54 @@
].
majorKey isNil ifTrue:[
- spec := self safelyPerform:#specificationFor: with:minorKey.
-
+ spec := self specificationFor:minorKey.
+ "/ try if application or applicationClass respond to minorKey
+ "/ (possible if not a subclass of ApplicationModel)
spec isNil ifTrue:[
- spec := self safelyPerform:minorKey
- ]
+ application messageNotUnderstoodSignal handle:[:ex |
+ ] do:[
+ application notNil ifTrue:[
+ spec := application perform:minorKey.
+ ].
+ applicationClass notNil ifTrue:[
+ spec := applicationClass perform:minorKey.
+ ].
+ ].
+ ].
] ifFalse:[
- "/ look for class in applications namespace ...
- app := self application.
- app isNil ifTrue:[
+ application notNil ifTrue:[
+ "/ look for class in applications namespace ...
+ cls := application resolveName:majorKey.
+ ] ifFalse:[
"/ fallBack - use that global, if it exists
cls := Smalltalk at:majorKey.
cls isNil ifTrue:[
- Transcript showCR:('missing application when fetching majorKey:' , majorKey).
- ]
- ] ifFalse:[
- cls := app resolveName:majorKey.
+ Transcript showCR:('WindowBuilder[warning]: missing application when fetching majorKey:' , majorKey).
+ ].
].
- (cls notNil and:[cls respondsTo:minorKey]) ifTrue:[
- spec := cls perform:minorKey
- ]
+ cls notNil ifTrue:[
+ Object messageNotUnderstoodSignal handle:[:ex |
+ ] do:[
+ spec := cls specificationFor:minorKey.
+ spec isNil ifTrue:[
+ spec := cls perform:minorKey.
+ ].
+ ].
+ ].
].
^ spec
"Modified: / 27.1.1998 / 12:17:13 / cg"
- "Modified: / 4.2.1998 / 17:26:48 / stefan"
+ "Modified: / 5.2.1998 / 12:25:32 / stefan"
!
subCanvasAt:majorKey at:minorKey put:aSpec
- "deposit a subCanvas specification for major and minor key
+ "deposit an interfaceSpecification for major and minor key
in my private subCanvasSpecs dictionary.
- This will be used later, when building subcanvases, to provide
- (or possibly override an application provided subcanvas) the
- spec for a subcanvas. (see #subCanvasAt:at:)."
+ This will be used later, when building,
+ to provide an interfaceSpec for a subcanvas or subSpecification
+ (or possibly override an application provided interfaceSpec).
+ See #subCanvasAt:at:."
|dict key|
@@ -366,6 +381,7 @@
dict at:minorKey put:aSpec
"Modified: / 27.1.1998 / 12:21:27 / cg"
+ "Modified: / 5.2.1998 / 12:05:32 / stefan"
!
visualAt:name
@@ -481,47 +497,53 @@
!WindowBuilder methodsFor:'message sending'!
safelyPerform:aSelector
- "send the message aSelector to the receiver self or application;
+ "send the message aSelector to the application;
the result returned from the send or nil is returned
"
|res|
aSelector isSymbol ifTrue:[
- Object messageNotUnderstoodSignal handle:[:ex |
- ] do:[
- (res := self perform:aSelector) notNil ifTrue:[^ res]
- ].
-
application notNil ifTrue:[
- Object messageNotUnderstoodSignal handle:[:ex |
+ application messageNotUnderstoodSignal handle:[:ex |
] do:[
(res := application perform:aSelector) notNil ifTrue:[^ res]
]
+ ].
+ applicationClass notNil ifTrue:[
+ applicationClass messageNotUnderstoodSignal handle:[:ex |
+ ] do:[
+ (res := applicationClass perform:aSelector) notNil ifTrue:[^ res]
+ ]
]
].
^ nil
+
+ "Modified: / 5.2.1998 / 12:28:23 / stefan"
!
safelyPerform:aSelector with:anArgument
- "send the one-arg-message aSelector to the receiver self or application;
+ "send the one-arg-message aSelector to the application;
the result returned from the send or nil is returned
"
|res|
aSelector isSymbol ifTrue:[
- Object messageNotUnderstoodSignal handle:[:ex |
- ] do:[
- (res := self perform:aSelector with:anArgument) notNil ifTrue:[^ res]
- ].
-
application notNil ifTrue:[
- Object messageNotUnderstoodSignal handle:[:ex |
+ application messageNotUnderstoodSignal handle:[:ex |
] do:[
(res := application perform:aSelector with:anArgument) notNil ifTrue:[^ res]
]
- ]
+ ].
+ applicationClass notNil ifTrue:[
+ applicationClass messageNotUnderstoodSignal handle:[:ex |
+ ] do:[
+ (res := applicationClass perform:aSelector with:anArgument) notNil ifTrue:[^ res]
+ ]
+ ].
].
^ nil
+
+ "Modified: / 5.2.1998 / 12:28:54 / stefan"
! !
!WindowBuilder methodsFor:'spec creation aspect fetch'!
@@ -707,6 +729,34 @@
"Created: / 17.1.1997 / 21:08:45 / cg"
"Modified: / 28.10.1997 / 12:54:32 / cg"
+!
+
+specificationFor:aKey
+ "return a specification for aKey. This is invoked during window building
+ (by the builder) to ask for the interfaceSpec for a subCanvas or subSpecification.
+ Here, first the local bindings are searched, then the application and
+ finally the applications class is asked for a corresponding interfaceSPec.
+ The returned object is typically an interfaceSpec array."
+
+ |spec|
+
+ application notNil ifTrue:[
+ application messageNotUnderstoodSignal handle:[:ex |
+ ] do:[
+ spec := application specificationFor:aKey.
+ ].
+ spec notNil ifTrue:[^ spec].
+ ].
+ applicationClass notNil ifTrue:[
+ (applicationClass respondsTo:#specificationFor:) ifTrue:[
+ ^ applicationClass specificationFor:aKey
+ ]
+ ].
+ ^ self aspectAt:aKey
+
+ "Modified: / 20.6.1997 / 11:40:22 / cg"
+ "Created: / 5.2.1998 / 10:47:46 / stefan"
+ "Modified: / 5.2.1998 / 12:25:08 / stefan"
! !
!WindowBuilder methodsFor:'spec creation callbacks'!
@@ -927,5 +977,5 @@
!WindowBuilder class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.56 1998-02-04 23:07:10 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.57 1998-02-05 12:55:30 stefan Exp $'
! !