[Seaside] Why do I have to use #children here?
jfitzell at gmail.com
Thu Oct 23 07:48:20 UTC 2008
Yes... this is not very clear. There is a functional test in Seaside
2.9 that illustrates this (WADecorationTest).
Basically the problem is, that you are usually expected to create a
new instance of a component when you call it. If you actually need to
create the component and hold onto it with an instance variable (as
you would when embedding), then you need to somehow make sure it has
#updateStates: called on it.
To do this, you can either implement #children, or implement
#updateStates: and call "otherPanel visiblePresentersDo: [ :each |
each updateStates: aSnapshot ]". Which is cleaner is, I guess, a
matter of debate. I was actually looking at this in 2.9 just yesterday
and filed this issue:
http://code.google.com/p/seaside/issues/detail?id=219 so hopefully we
can get some comments from other developers.
Hope that helps a bit...
On Wed, Oct 22, 2008 at 9:08 PM, Sebastian Nozzi
<sebnozzi at googlemail.com> wrote:
> Hello Seasiders!
> I run into following issue, for which I found an (unexpected!)
> solution. I have to use #children, but I didn't think I had to,
> according to the documentation... Here's how to reproduce it:
> Let's say MainPanel (root component) and OtherPanel are subclasses of
> MainPanel has an otherPanel instance variable refering to an
> OtherPanel (always the same).
> MainPanel renders an anchor which "shows" the OtherPanel held in the
> instance variable.
> OtherPanel renders an anchor with "self answer".
> MainPanel does NOT implement #children.
> Now, this causes an error:
> 1) from the MainPanel, click on the link which leads to the OtherPanel
> 2) press the browser's back button
> 3) again, click on the link which leads to the OtherPanel
> 4) click on the back LINK (of OtherPanel)
> 5) Error: MessageNotUnderstood: MainPanel>>owner
> Now, if I implement #children in MainPanel and return a collection
> with otherPanel, everything works fine.
> >From the documentation of #children I thought that components that are
> called/shown are *not* children.
> What did I miss?
> Thanks in advance!!!
> seaside mailing list
> seaside at lists.squeakfoundation.org
More information about the seaside