[Seaside] Re: session variable vs. dynamic variable

Ramon Leon ramon.leon at allresnet.com
Fri Feb 8 18:00:15 UTC 2008

> "Ramon Leon" <ramon.leon at allresnet.com> wrote
> > Use announcements instead, break the coupling.
> I'd like to use announcements, but am not clear about two points:
> I have a root component (R), and a n-level deep leaf 
> component (L). A callback on L needs to cause something like:
>     html updater
>       id: R id;
>       callback: [:r |
>         self doModelStuff.
>         r render: R]
> How would you recommend getting this effect with announcements?
> Also, would requiring a custom session subclass to hold the 
> announcer make it hard to use my component elsewhere?
> Thanks!
> Sophie 

I wouldn't let a child component redraw anything on the parent or rerender
the parent.  Components should render themselves.  Off the top of my head,
I'd say if a child callback needs to refresh the parent, I'd have the
callback send an announcement with the rendering canvas as an argument, let
the parent catch the announcement and use that renderer to call any
necessary rendering methods.  The child need only be concerned with
announcing, which could be either a global session announcer, or its own
announcer that the parent registered interest in when it first created the
child.  Every object *can* be it's own announcer, this creates a simple
event system where any object can signal events.

Ramon Leon

More information about the seaside mailing list