PRAddCommand #children

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

PRAddCommand #children

Nick
Hi,

I have a container component that renders a series of subcomponents. The number of subcomponents is based on the number children within my structure.
My initial implementation cached the components and returned the cache within #children and iterated over the cache within #renderContentOn:.

A problem arises when I add a new child to my structure. The container component needs to invalidate it's cache when the structure changes or once I rendering cycle completes. I tried hooking into #initialRequest: but that didn't seem to be called each time I visited the page. I guess I could use Announcements but wonder if there is a simpler solution? Thanks in advance

Nick

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRAddCommand #children

Lukas Renggli
> I rendering cycle completes. I tried hooking into #initialRequest: but that
> didn't seem to be called each time I visited the page.

WAPresenter>>initialRequest: aRequest
        "When a new session is started, all visible presenters (components or
tasks) receive this message with the request as argument.
        ...

> I guess I could use
> Announcements but wonder if there is a simpler solution? Thanks in advance

Why don't you just enumerate and update the children with each
request? This is also what Pier does for the embedded documents.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRAddCommand #children

Nick
Why don't you just enumerate and update the children with each
request? This is also what Pier does for the embedded documents.

That's what I'd like to do. However I'm not clear how to detect the start of a request from within a component. To explain - I put a #halt in children and found that it was called five times, for one request. I was hoping that I could hook into a message that marked the start of a request - as #initialRequest isn't suitable is there some other call? Failing that, would it confuse the calling components to return a different set of objects for each of the five calls to #children?

Nick

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRAddCommand #children

Lukas Renggli
On 23 February 2010 23:24, Nick Ager <[hidden email]> wrote:

>> Why don't you just enumerate and update the children with each
>> request? This is also what Pier does for the embedded documents.
>
> That's what I'd like to do. However I'm not clear how to detect the start of
> a request from within a component. To explain - I put a #halt in children
> and found that it was called five times, for one request. I was hoping that
> I could hook into a message that marked the start of a request - as
> #initialRequest isn't suitable is there some other call? Failing that, would
> it confuse the calling components to return a different set of objects for
> each of the five calls to #children?

Pier itself does it lazily when #children is called for the first time.

Lukas


> Nick
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PRAddCommand #children

Nick
Pier itself does it lazily when #children is called for the first time.

Thanks for the pointer. I've solved my problem using PRPierFrame as the inspiration. Within PRPierFrame children are cleared in PRPierFrame>>context: and lazily constructed within PRPierFrame>>children.

In my display object I cleared my children collection cache in #onChangeContext: and lazily constructed it in #children

Thanks again for the help

Nick

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki