Yeah, I knew that component could implement PageRenderListener, but it woud
be triggered in the time when page starts to render, and not when component
starts to render.
I have 2 problems with using PageRenderListener in components as pre-render
"initialization" method :
1. parameters are not set in that moment
2. I want to perform this initialization logic *only* if this component is
about to render, which doesn't have to happen if for eg. Conditional that
surrounds it was evaluated to false
If I understood you correctly, in 4.0 it will be possible to fetch parameter
values in that moment, so problem under 1. is solved, but problem under 2.
still exists.
Overriding prepareForRender() solves both problems, thus it's really
pre-render initialization method, but as said before, it's quite ugly to
override like:
public void prepareForRender(IRequestCycle cycle) {
super.prepareForRender(cycle);
...// do initialization
}
instead of implementing some specific listener, like pages have privilege of
(PageRenderListener).
Regards,
Vjeran
----- Original Message -----
From: "Howard Lewis Ship" <[EMAIL PROTECTED]>
To: "Tapestry users" <[email protected]>
Sent: Thursday, May 05, 2005 4:18 PM
Subject: Re: "RenderListener" for both components and pages?
Well, PageRenderListener works on both components and pages.
In 4.0, there isn't such an explicit "parameters are set" stage; the
generated bytecode for connected parameter properties is smarter and
more dynamic and there's no reflection (outside of OGNL). You invoke
getMyParameter() and it gets the value from the binding object by
invoking getValue(), then (by default) caches the result until the
component finishes rendering.
Components have a prepareForRender() and cleaupAfterRender() methods
that wrap around renderComponent().
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 29.4.2005
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]