[Seaside] Use of #delegate w/ WADelegation or WADecorator
renggli at gmail.com
Wed May 9 06:39:00 UTC 2007
> 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:.
More information about the seaside