com.primix.tapestry
Interface ILifecycle


Deprecated. will be removed after 1.1

public interface ILifecycle

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

Version:
$Id: ILifecycle.java,v 1.12 2001/09/16 15:09:08 hship Exp $
Author:
Howard Ship

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

cleanupAfterRender

public void cleanupAfterRender(IRequestCycle cycle)
Deprecated. 
Invoked after rendering has taken place, even if an exception is thrown.

A component is not guarenteed to have been sent prepareForRender(IRequestCycle) yet, as an exception may be thrown while lifecycle methods are being invoked.


prepareForRender

public void prepareForRender(IRequestCycle cycle)
Deprecated. 
Invoked on all lifecycle components prior to starting the rendering process. This gives components an opportunity to claim any resources needed for the duration of the render process. Lifecycle components on a page will have this method invoked in an unspecified order.

reset

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

Imagine the following scenario:

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.


cleanupComponent

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