562 |
562 |
563 "Modified: / 25.10.1997 / 19:18:50 / cg" |
563 "Modified: / 25.10.1997 / 19:18:50 / cg" |
564 ! |
564 ! |
565 |
565 |
566 generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass |
566 generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass |
567 |modelClass modelValue modelGen| |
567 |modelClass modelValue modelGen code| |
568 |
568 |
569 modelClass := protoSpec defaultModelClassFor:aspect. |
569 modelClass := protoSpec defaultModelClassFor:aspect. |
570 modelValue := protoSpec defaultModelValueFor:aspect. |
570 modelValue := protoSpec defaultModelValueFor:aspect. |
571 |
571 |
572 modelValue isNil ifTrue:[ |
572 modelValue isNil ifTrue:[ |
573 modelGen := modelClass name , ' new' |
573 modelGen := modelClass name , ' new' |
574 ] ifFalse:[ |
574 ] ifFalse:[ |
575 modelGen := modelValue storeString , ' asValue' |
575 modelGen := modelValue storeString , ' asValue' |
576 ]. |
576 ]. |
577 |
577 |
578 ^ ('!!' , targetClass name , ' methodsFor:''aspects''!!\\' , |
578 code := '!!' , targetClass name , ' methodsFor:''aspects''!!\\' , |
579 aspect , '\' , |
579 aspect , '\' , |
580 ' "automatically generated by UIPainter ..."\\' , |
580 ' "automatically generated by UIPainter ..."\\' , |
581 ' "*** the code below creates a default model when invoked."\' , |
581 ' "*** the code below creates a default model when invoked."\' , |
582 ' "*** (which may not be the one you wanted)"\' , |
582 ' "*** (which may not be the one you wanted)"\' , |
583 ' "*** Please change as required and accept in the browser."\' , |
583 ' "*** Please change as required and accept in the browser."\'. |
|
584 |
|
585 code := (code , |
584 '\' , |
586 '\' , |
585 ' |holder|\' , |
587 ' |holder|\' , |
586 '\' , |
588 '\' , |
587 ' (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' , |
589 ' (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' , |
588 ' builder aspectAt:#' , aspect , ' put:(holder := ' , ' ' , modelGen , ').\' , |
590 ' builder aspectAt:#' , aspect , ' put:(holder := ' , ' ' , modelGen , ').\' , |
589 ' ].\' , |
591 ' ].\' , |
590 ' ^ holder\' , |
592 ' ^ holder\' , |
591 '!! !!\\') withCRs |
593 '!! !!\\') withCRs. |
|
594 ^ code |
592 |
595 |
593 "Modified: / 26.10.1997 / 19:01:15 / cg" |
596 "Modified: / 26.10.1997 / 19:01:15 / cg" |
594 ! |
597 ! |
595 |
598 |
596 generateAspectMethods |
599 generateAspectMethods |
801 , methodName , '\' |
804 , methodName , '\' |
802 , ' "this window spec was automatically generated by the ST/X UIPainter"\\' |
805 , ' "this window spec was automatically generated by the ST/X UIPainter"\\' |
803 , ' "do not manually edit this - the painter/builder may not be able to\' |
806 , ' "do not manually edit this - the painter/builder may not be able to\' |
804 , ' handle the specification if its corrupted."\\' |
807 , ' handle the specification if its corrupted."\\' |
805 , ' "\' |
808 , ' "\' |
806 , ' UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\' |
809 , (' UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\') |
807 , ' ' , className , ' new openInterface:#' , methodName , '\' |
810 , (' ' , className , ' new openInterface:#' , methodName , '\') |
808 , ' "\'. |
811 , ' "\'. |
809 |
812 |
810 methodName = 'windowSpec' ifTrue:[ |
813 methodName = 'windowSpec' ifTrue:[ |
811 code := code , ' "' , className , ' open"\' |
814 code := code , ' "' , className , ' open"\' |
812 ]. |
815 ]. |