--- a/UIPainterView.st Mon Mar 06 09:49:13 2006 +0100
+++ b/UIPainterView.st Mon Mar 06 09:49:20 2006 +0100
@@ -777,125 +777,125 @@
cls := self targetClass.
cls isNil ifTrue:[
- ^ nil
+ ^ nil
].
codePieces := OrderedCollection new.
definedMethodSelectors := IdentitySet new.
treeView propertiesDo:[:aProp|
- |modelSelector|
-
- protoSpec := aProp spec.
-
- (modelSelector := aProp model) notNil ifTrue:[
- self generateCodeFrom:(Array with:modelSelector) in:cls
- do:[:aSel|
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- skip := false.
-
- (cls isSubclassOf:SimpleDialog) ifTrue:[
- skip := SimpleDialog includesSelector:aSel
- ].
- (definedMethodSelectors includes:aSel) ifTrue:[
- skip := true.
- ].
-
- skip ifFalse:[
- "/ kludge ..
- "/ (protoSpec isKindOf:ActionButtonSpec)
- (protoSpec defaultModelIsCallBackMethodSelector:aSel)
- ifTrue:[
- thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
- ] ifFalse:[
- thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
- ].
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'code generated for aspect: ' , aSel
- ] ifTrue:[
- Transcript showCR:'*** no code generated for aspect: ' , aSel , ' (method already exists)'
- ].
- ].
- ].
- ].
-
- "/ for each aspect, generate getter (if not yet implemented)
- self generateCodeFrom:(aProp spec aspectSelectors) in:cls
- do:[:aSel|
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- (definedMethodSelectors includes:aSel) ifFalse:[
- thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'code generated for aspect: ' , aSel
- ]
- ]
- ].
-
- "/ exported aspects - need setter methods
- exportSels := (treeView exportedAspects ? #()) collect:[:entry | (entry subAspect , ':') asSymbol].
- self generateCodeFrom:exportSels in:cls
- do:[:aSel|
- |aspect|
-
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- (definedMethodSelectors includes:aSel) ifFalse:[
- aspect := (aSel copyWithoutLast:1) asSymbol.
- thisCode := (self generateAspectSetMethodFor:aspect spec:protoSpec inClass:cls).
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'export code generated for aspect: ' , aSel
- ]
- ]
- ].
-
- self generateCodeFrom:(aProp spec actionSelectors) in:cls
- do:[:aSel|
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- (definedMethodSelectors includes:aSel) ifFalse:[
- thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'action generated for aspect: ' , aSel
- ]
- ]
- ].
-
- self generateCodeFrom:(aProp spec valueSelectors) in:cls
- do:[:aSel|
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- (definedMethodSelectors includes:aSel) ifFalse:[
- "/ uppercase: - assume its a globals name.
- aSel first isUppercase ifFalse:[
- thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'code generated for aspect: ' , aSel
- ]
- ]
- ]
- ].
+ |modelSelector|
+
+ protoSpec := aProp spec.
+
+ (modelSelector := aProp model) notNil ifTrue:[
+ self generateCodeFrom:(Array with:modelSelector) in:cls
+ do:[:aSel|
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ skip := false.
+
+ (cls isSubclassOf:SimpleDialog) ifTrue:[
+ skip := SimpleDialog includesSelector:aSel
+ ].
+ (definedMethodSelectors includes:aSel) ifTrue:[
+ skip := true.
+ ].
+
+ skip ifFalse:[
+ "/ kludge ..
+ "/ (protoSpec isKindOf:ActionButtonSpec)
+ (protoSpec defaultModelIsCallBackMethodSelector:aSel)
+ ifTrue:[
+ thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
+ ] ifFalse:[
+ thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
+ ].
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'code generated for aspect: ' , aSel
+ ] ifTrue:[
+ Transcript showCR:'*** no code generated for aspect: ' , aSel , ' (method already exists)'
+ ].
+ ].
+ ].
+ ].
+
+ "/ for each aspect, generate getter (if not yet implemented)
+ self generateCodeFrom:(aProp spec aspectSelectors) in:cls
+ do:[:aSel|
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ (definedMethodSelectors includes:aSel) ifFalse:[
+ thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'code generated for aspect: ' , aSel
+ ]
+ ]
+ ].
+
+ "/ exported aspects - need setter methods
+ exportSels := (treeView exportedAspects ? #()) collect:[:entry | (entry subAspect , ':') asSymbol].
+ self generateCodeFrom:exportSels in:cls
+ do:[:aSel|
+ |aspect|
+
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ (definedMethodSelectors includes:aSel) ifFalse:[
+ aspect := (aSel copyWithoutLast:1) asSymbol.
+ thisCode := (self generateAspectSetMethodFor:aspect spec:protoSpec inClass:cls).
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'export code generated for aspect: ' , aSel
+ ]
+ ]
+ ].
+
+ self generateCodeFrom:(aProp spec actionSelectors) in:cls
+ do:[:aSel|
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ (definedMethodSelectors includes:aSel) ifFalse:[
+ thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'action generated for aspect: ' , aSel
+ ]
+ ]
+ ].
+
+ self generateCodeFrom:(aProp spec valueSelectors) in:cls
+ do:[:aSel|
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ (definedMethodSelectors includes:aSel) ifFalse:[
+ "/ uppercase: - assume its a globals name.
+ aSel isUppercaseFirst ifFalse:[
+ thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'code generated for aspect: ' , aSel
+ ]
+ ]
+ ]
+ ].
].
AspectsAsInstances ifTrue:[
- iVars := cls instVarNames asOrderedCollection.
- definedMethodSelectors do:[:ivar |
- (iVars includes:ivar) ifFalse:[
- iVars add:ivar
- ]
- ].
- iVars := iVars asArray.
- t := cls shallowCopy.
- t setInstanceVariableString:iVars asStringCollection asString.
- codePieces addFirst:(t definition , '!!\' withCRs).
+ iVars := cls instVarNames asOrderedCollection.
+ definedMethodSelectors do:[:ivar |
+ (iVars includes:ivar) ifFalse:[
+ iVars add:ivar
+ ]
+ ].
+ iVars := iVars asArray.
+ t := cls shallowCopy.
+ t setInstanceVariableString:iVars asStringCollection asString.
+ codePieces addFirst:(t definition , '!!\' withCRs).
].
^ String
- streamContents:
- [:codeStream |
- codePieces do:[:eachPiece | codeStream nextPutAll:eachPiece].
- ].
+ streamContents:
+ [:codeStream |
+ codePieces do:[:eachPiece | codeStream nextPutAll:eachPiece].
+ ].
"Modified: / 29.7.1998 / 12:21:19 / cg"
!