|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Additional IComponent
methods for components with special lifecycles.
Few components require these methods.
The advantage of these methods versus simply
overiding IRender.render(IResponseWriter, IRequestCycle)
is that
they are called just once, before and after all rendering takes place.
Components may be inside one or more Foreach
components, or something
similar, in which case render()
is invoked multiple times.
AbstractComponent
provides null implementations of these methods,
even though it does not implement the interface.
This interface is deprecated as of 1.0.5, and will be removed in 1.1. You
should use the page listener interfaces in com.primix.tapestry.event
instead. The implementation of AbstractComponent
includes
all of these methods, and adds listeners for them in
AbstractComponent.finishLoad()
.
Method Summary | |
void |
cleanupAfterRender(IRequestCycle cycle)
Deprecated. Invoked after rendering has taken place, even if an exception is thrown. |
void |
cleanupComponent()
Deprecated. Invoked from IPage.cleanupPage() to cleanup any long-held resources
(typically, stateful session EJBs) that the component may have a reference
to. |
void |
prepareForRender(IRequestCycle cycle)
Deprecated. Invoked on all lifecycle components prior to starting the rendering process. |
void |
reset()
Deprecated. Invoked from IPage.detach() , this allows
a component to reset its state so that it is equivalent to a newly
constructed instance. |
Method Detail |
public void cleanupAfterRender(IRequestCycle cycle)
A component is not guarenteed to have been sent
prepareForRender(IRequestCycle)
yet,
as an exception may be thrown while lifecycle methods are being invoked.
public void prepareForRender(IRequestCycle cycle)
public void reset()
IPage.detach()
, this allows
a component to reset its state so that it is equivalent to a newly
constructed instance.
Imagine the following scenario:
IPageSource
pool
What is the value of property x? It's the value left there by session 1,
but session 2 expects property x to have its initial value. Since session 2
has never changed property x, the IPageRecorder
for page P in session 2
has no data with which to rollback the property.
This method allows page P to set the value for property X back to its
initial value, hiding the change made by session 1. If session 1 later
reuses this same instance of page P, the IPageRecorder
will restore
the property back to the value previously stored.
Components should be designed to minimize the need for this method, and to make it easy to implement it. Initial values should usually be constants, preferably null or 0.
public void cleanupComponent()
IPage.cleanupPage()
to cleanup any long-held resources
(typically, stateful session EJBs) that the component may have a reference
to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |