[Seaside] Use of #delegate w/ WADelegation or WADecorator

Rick Flower rickf at ca-flower.com
Wed May 9 13:49:22 UTC 2007


Lukas Renggli wrote:
>> I'm toying around w/ using decorators in the latest (vw) Seaside 2.7 (as
>> of a few days ago) and in trying to plug into a new decorator I tried
>> writing, I find that the #delegate instance variable is not set so that
>> causes a DNU trying to call #nextPresentersDo: after I use
>> #addDecoration: for the decorator in question..  For regular
>> delegates/decorations, how is that variable set.. I've been staring at
>> code for the past several hours and I'm afraid I just don't see who's
>> setting it in some of the examples..  I was looking at some of the code
>> in Scriptaculous as well but nothing is jumping out at me..
>
> Have a look at the senders of #delegate:, in my image these are
> #show:onAnswer: and #lightbox:. The delegation decoration is used to
> delegate rendering, callback processing, url updating, etc. to a
> different component. So the delegate is an instance of a WAComponent.
>
> When you do a #call: the receiver is wrapped with the delegation
> decoration, so that the argument is then displayed (instead of the
> receiver). When you #answer: the decoration is removed again and the
> receiver is displayed again (as you can see in #call:, #show:,
> #show:onAnswer: and #show:onAnswer:decoration:).
>
> I don't see a reason to use the WADelegation manually. This is just a
> helper to implement #call: and #answer:.
>
Thanks Lukas -- I might need to instead have my toy code have a parent 
class of WADecorator
instead of WADelegation since the usage is not likely to be used in that 
manner.. I had been
looking at other code and I guess I got a bit confused between the two.. 
I'll take another peek
and some more fiddling around.  Thanks!



More information about the seaside mailing list