You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Shawn Church <sh...@boxity.com> on 2004/07/30 23:40:40 UTC

Component page listeners

I have a set of components which are contained in a single page, each 
of which are conditionally rendered depending on the application 
state.  Each of these components implements PageRenderListener, and I 
have realized that pageBeginRender is invoked in each component on 
every page cycle, regardless of whether the component is ultimately 
rendered or not (based on the conditions in the containing page).

I'm sure this is happening since each of the components are contained 
by a parent page, and they are registered as page listeners.  I found 
an archived message about this (someone wanting a 
componentRenderListener), but I'm not sure how/if it was resolved.

I tried replacing pageRenderListener with prepareForRender, but the 
page is locked by this point so I'm not able to change any of the page 
properties (or properties of my components which are contained by the 
page).

Any ideas?  I am really just trying to initialize my component 
properties, but only if the component will actually get rendered.

Thanks,
Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Component page listeners

Posted by Shawn Church <sh...@boxity.com>.
No, since the problem is not related to rewind.  The problem is that if 
I have 10 components contained by a page, and each component is 
registered as a page listener, the pageBeginRender of each of the 10 
components are invoked, even if the component itself is not rendered in 
the page (due to a conditional, etc.).

Shawn


Quoting "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>:

> Would something like
> 
>     public void pageBeginRender(PageEvent event) {
>         if (!event.getRequestCycle().isRewinding()) {
>             // do your thing here
>         }        
>     }
> 
> do the trick?
> 
> -----Original Message-----
> From: Shawn Church [mailto:shawn@boxity.com] 
> Sent: Friday, July 30, 2004 11:41 PM
> To: Tapestry users
> Subject: Component page listeners
> 
> [...]
> 
> Any ideas?  I am really just trying to initialize my component 
> properties, but only if the component will actually get rendered.
> 
> Thanks,
> Shawn
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Component page listeners

Posted by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>.
Would something like

    public void pageBeginRender(PageEvent event) {
        if (!event.getRequestCycle().isRewinding()) {
            // do your thing here
        }        
    }

do the trick?

-----Original Message-----
From: Shawn Church [mailto:shawn@boxity.com] 
Sent: Friday, July 30, 2004 11:41 PM
To: Tapestry users
Subject: Component page listeners

[...]

Any ideas?  I am really just trying to initialize my component 
properties, but only if the component will actually get rendered.

Thanks,
Shawn



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org