Why do I have to use #children here?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Why do I have to use #children here?

Sebastian Nozzi-2
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
WAComponent.

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.

Why?

>From the documentation of #children I thought that components that are
called/shown are *not* children.

What did I miss?


Thanks in advance!!!


Sebastian

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Seaside-Issue.st (1K) Download Attachment
MessageNotUnderstood_MainPanel__owner.htm (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Why do I have to use #children here?

Sebastian Nozzi-2
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
WAComponent.

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.

Why?

>From the documentation of #children I thought that components that are
called/shown are *not* children.

What did I miss?


Thanks in advance!!!


Sebastian

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Seaside-Issue.st (1K) Download Attachment
MessageNotUnderstood_MainPanel__owner.htm (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Why do I have to use #children here?

Sebastian Nozzi-2
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
WAComponent.

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.

Why?

>From the documentation of #children I thought that components that are
called/shown are *not* children.

What did I miss?


Thanks in advance!!!


Sebastian

P.S. Upon request, I can provide fileOuts of the classes and/or the error.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Why do I have to use #children here?

Julian Fitzell-2
In reply to this post by Sebastian Nozzi-2
Hi Sebastian,

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...

Julian

On Wed, Oct 22, 2008 at 9:08 PM, Sebastian Nozzi
<[hidden email]> 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
> WAComponent.
>
> 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.
>
> Why?
>
> >From the documentation of #children I thought that components that are
> called/shown are *not* children.
>
> What did I miss?
>
>
> Thanks in advance!!!
>
>
> Sebastian
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Why do I have to use #children here?

Julian Fitzell-2
On Thu, Oct 23, 2008 at 4:53 PM, Sebastian Nozzi
<[hidden email]> wrote:
>> And no, you don't need to worry about "leaking" memory. Any components
>> you are no longer using will get garbage collected once the stored
>> continuations that reference them are expired from the cache.
>
> And when does that happen? When the session expires?

When the continuations expire. The _k you see in the URL is the unique
ID of the continuation or "page view". The default is to keep 20
around (which is 10 pages, really: 1 continuation for callback
handling and one for rendering) to allow some backtracking and they
expire based on a Least Recently Used algorithm. Obviously when the
session expires, all of its continuations also expire.

Julian
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside