[Seaside] embedding components questions

Philippe Marschall philippe.marschall at gmail.com
Wed Nov 28 05:57:43 UTC 2007


2007/11/28, Alexandre Paes <alex.paes at streetdogstudio.com>:
> Hi fellow seasider's,
>
> My first production application developed in seaside is almost ready,
> but even now i'm still fighting about how to correctly embed components
> in each other. For instance in the following scheme:
>
> Presenter A
>         |
>         ----- Presenter B (Header)
>         |
>         ----- Presenter C (Main application content)
>         |           |
>         |           ------ Presenter D (rendered inside Presenter C
> render routine)
>         |
>         ----- Presenter E (Footer)
>
>
> How can i go about having Presenter C or even Presenter A react to
> events in Presenter D? i've been trying to use #onAnswer: but i must
> admit all has been in vain so far.

http://onsmalltalk.com/programming/smalltalk/maintaining-loose-coupling-in-seaside-components/
Just remember to unsubscribe your components once you don't need them
anymore. Yes, this is kinda like manual memory managemnt. It would be
much easier if we had reliable weak references. An other option would
be to scope announcers to components and not the session.

> Another question i have is about differences between #children and
> #states methods in WAComponent. I've read on some post that #states
> behaves like the old #registerObjectForBacktracking but since i have
> never used this one either i'm having quite a hard time figuring this
> out.

#children returns all the direct child components of a component. That
is every component you directly #render:.

#states returns the state to be backtracked by Seaisde if the user
uses the back button. If the contents of #children can change over
time then you need #states to make the back button work. The easiest
way is to return a collection (mostly Array) with only self. If you
have your children in a collection you can simply return this
collection.

Cheers
Philippe


More information about the seaside mailing list