UIPainterView.st
changeset 568 7c4482bf37cf
parent 511 082c077ff0c7
child 588 daead6079de7
equal deleted inserted replaced
567:2406b6193e93 568:7c4482bf37cf
   500     "Created: / 25.10.1997 / 18:58:25 / cg"
   500     "Created: / 25.10.1997 / 18:58:25 / cg"
   501     "Modified: / 26.10.1997 / 15:06:18 / cg"
   501     "Modified: / 26.10.1997 / 15:06:18 / cg"
   502 !
   502 !
   503 
   503 
   504 generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
   504 generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
   505     |selector args showIt code alreadyInSuperclass|
   505     |selector args showIt code alreadyInSuperclass numArgs method|
   506 
   506 
   507     selector := aspect asSymbol.
   507     selector := aspect asSymbol.
   508 
   508 
   509     alreadyInSuperclass := targetClass superclass canUnderstand:selector.
   509     alreadyInSuperclass := targetClass superclass canUnderstand:selector.
   510 
   510 
   511     (selector numArgs) == 1 ifFalse:[
   511     numArgs := selector numArgs.
       
   512     method  := aspect.
       
   513 
       
   514     numArgs == 1 ifTrue:[
       
   515         args := 'anArgument'.
       
   516         showIt := ''' , anArgument printString , '' ...''.\'.
       
   517     ] ifFalse:[    
   512         args := ''.
   518         args := ''.
   513         showIt := ' ...''.\'.
   519         showIt := ' ...''.\'.
   514     ] ifTrue:[
   520 
   515         args := 'anArgument'.
   521         numArgs ~~ 0 ifTrue:[
   516         showIt := ''' , anArgument printString , '' ...''.\'.
   522             method := ''.
       
   523 
       
   524             selector keywords keysAndValuesDo:[:i :key|
       
   525                 method := method, key, 'arg', i printString, ' '
       
   526             ]
       
   527         ]
   517     ].
   528     ].
   518 
   529 
   519     code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
   530     code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
   520                 aspect , args , '\' ,
   531                 method , args , '\' ,
   521                 '    "automatically generated by UIPainter ..."\\' ,
   532                 '    "automatically generated by UIPainter ..."\\' ,
   522                 '    "*** the code below performs no action"\' ,
   533                 '    "*** the code below performs no action"\' ,
   523                 '    "*** (except for some feedback on the Transcript)"\' ,
   534                 '    "*** (except for some feedback on the Transcript)"\' ,
   524                 '    "*** Please change as required and accept in the browser."\' ,
   535                 '    "*** Please change as required and accept in the browser."\' ,
   525                 '\' .
   536                 '\' .