org.apache.tapestry
Class AbstractPage

java.lang.Object
  extended byorg.apache.hivemind.impl.BaseLocatable
      extended byorg.apache.tapestry.AbstractComponent
          extended byorg.apache.tapestry.BaseComponent
              extended byorg.apache.tapestry.AbstractPage
All Implemented Interfaces:
IComponent, IPage, IRender, ITemplateComponent, org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder
Direct Known Subclasses:
BasePage, Deck

public abstract class AbstractPage
extends BaseComponent
implements IPage

Abstract base class implementing the IPageinterface.

Since:
0.2.9
Author:
Howard Lewis Ship, David Solis

Constructor Summary
AbstractPage()
          Standard constructor; invokes initialize()to configure initial values for properties of the page.
 
Method Summary
 void addPageAttachListener(PageAttachListener listener)
           
 void addPageBeginRenderListener(PageBeginRenderListener listener)
           
 void addPageDetachListener(PageDetachListener listener)
           
 void addPageEndRenderListener(PageEndRenderListener listener)
           
 void addPageRenderListener(PageRenderListener listener)
          Deprecated.  
 void addPageValidateListener(PageValidateListener listener)
           
 void attach(IEngine engine, IRequestCycle cycle)
          Called by the engineto attach the page to itself.
 void beginPageRender()
          Invoked before a partial render of the page occurs (this happens when rewinding a Formwithin the page).
 void beginResponse(IMarkupWriter writer, IRequestCycle cycle)
          Deprecated. To be removed in 4.0. Implement PageRenderListenerinstead.
 void detach()
          Prepares the page to be returned to the pool.
 void endPageRender()
          Invoked after a partial render of the page occurs (this happens when rewinding a Formwithin the page).
 void firePageAttached()
          Used to explicitly fire PageAttachListeners for this page.
protected  void firePageBeginRender()
           
protected  void firePageDetached()
           
protected  void firePageEndRender()
           
protected  void firePageValidate()
           
 ChangeObserver getChangeObserver()
          Returns the object (effectively, an IPageRecorder) that is notified of any changes to persistant properties of the page.
 IEngine getEngine()
          Returns the IEnginethat the page is currently attached to.
 java.lang.String getExtendedId()
          Returns the name of the page.
 java.lang.Object getGlobal()
          Deprecated.  
 java.lang.String getIdPath()
          Pages always return null for idPath.
 java.util.Locale getLocale()
          Returns the locale for the page, which may be null if the locale is not known (null corresponds to the "default locale").
 IComponent getNestedComponent(java.lang.String path)
          Returns a particular component from within the page.
protected  java.lang.String getOutputEncoding()
          Returns the output encoding to be used when rendering this page.
 java.lang.String getPageName()
          Returns the fully qualified name of the page, including its namespace prefix, if any.
 IRequestCycle getRequestCycle()
          Returns the current IRequestCycle.
 java.lang.Object getVisit()
          Deprecated.  
protected  void initialize()
          Deprecated. To be removed in 4.1 with no replacement.
 void removePageAttachListener(PageAttachListener listener)
           
 void removePageBeginRenderListener(PageBeginRenderListener listener)
           
 void removePageDetachListener(PageDetachListener listener)
           
 void removePageEndRenderListener(PageEndRenderListener listener)
           
 void removePageRenderListener(PageRenderListener listener)
          Deprecated.  
 void removePageValidateListener(PageValidateListener listener)
           
 void renderPage(IMarkupWriter writer, IRequestCycle cycle)
           Invokes PageBeginRenderListener.pageBeginRender(PageEvent) Invokes beginResponse(IMarkupWriter, IRequestCycle) Invokes IRequestCycle.commitPageChanges()(if not rewinding) Invokes AbstractComponent.render(IMarkupWriter, IRequestCycle) Invokes PageEndRenderListener.pageEndRender(PageEvent)(this occurs even if a previous step throws an exception)
 void setChangeObserver(ChangeObserver value)
           
 void setLocale(java.util.Locale value)
          Updates the page's locale.
 void setPageName(java.lang.String pageName)
          Sets the name of the page.
 void validate(IRequestCycle cycle)
          By default, pages are not protected and this method does nothing.
 
Methods inherited from class org.apache.tapestry.BaseComponent
addOuter, finishLoad, renderComponent
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, cleanupAfterRender, enterActiveState, finishLoad, format, format, format, format, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getComponent, getComponents, getContainedComponent, getContainer, getId, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isInActiveState, isParameterBound, isRendering, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setProperty, toString
 
Methods inherited from class org.apache.hivemind.impl.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.IPage
getResponseContentType
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainedComponent, getContainer, getId, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, isRendering, renderBody, setBinding, setContainedComponent, setContainer, setId, setNamespace, setPage, setProperty
 
Methods inherited from interface org.apache.tapestry.IRender
render
 
Methods inherited from interface org.apache.hivemind.LocationHolder
setLocation
 
Methods inherited from interface org.apache.hivemind.Locatable
getLocation
 

Constructor Detail

AbstractPage

public AbstractPage()
Standard constructor; invokes initialize()to configure initial values for properties of the page.

Since:
2.2
Method Detail

detach

public void detach()
Prepares the page to be returned to the pool.

Subclasses may override this method, but must invoke this implementation (usually, last).

Specified by:
detach in interface IPage
See Also:
PageDetachListener

initialize

protected void initialize()
Deprecated. To be removed in 4.1 with no replacement.

Method invoked from the constructor, and from detach()to (re-)initialize properties of the page. This is most useful when properties have non-null initial values.

Subclasses may override this implementation (which is empty).

Since:
2.2
See Also:
PageDetachListener, PageAttachListener

getEngine

public IEngine getEngine()
Description copied from interface: IPage
Returns the IEnginethat the page is currently attached to.

Specified by:
getEngine in interface IPage

getChangeObserver

public ChangeObserver getChangeObserver()
Description copied from interface: IPage
Returns the object (effectively, an IPageRecorder) that is notified of any changes to persistant properties of the page.

Specified by:
getChangeObserver in interface IPage

getExtendedId

public java.lang.String getExtendedId()
Returns the name of the page.

Specified by:
getExtendedId in interface IComponent
Overrides:
getExtendedId in class AbstractComponent
See Also:
AbstractComponent.getIdPath()

getIdPath

public java.lang.String getIdPath()
Pages always return null for idPath.

Specified by:
getIdPath in interface IComponent
Overrides:
getIdPath in class AbstractComponent

getLocale

public java.util.Locale getLocale()
Returns the locale for the page, which may be null if the locale is not known (null corresponds to the "default locale").

Specified by:
getLocale in interface IPage

setLocale

public void setLocale(java.util.Locale value)
Description copied from interface: IPage
Updates the page's locale. This is write-once, a subsequent attempt will throw an ApplicationRuntimeException.

Specified by:
setLocale in interface IPage

getNestedComponent

public IComponent getNestedComponent(java.lang.String path)
Description copied from interface: IPage
Returns a particular component from within the page. The path is a dotted name sequence identifying the component. It may be null in which case the page returns itself.

Specified by:
getNestedComponent in interface IPage

attach

public void attach(IEngine engine,
                   IRequestCycle cycle)
Called by the engineto attach the page to itself. Does not change the locale, but since a page is selected from the IPageSourcepool based on its locale matching the engine's locale, they should match anyway.

Specified by:
attach in interface IPage

renderPage

public void renderPage(IMarkupWriter writer,
                       IRequestCycle cycle)

setChangeObserver

public void setChangeObserver(ChangeObserver value)
Specified by:
setChangeObserver in interface IPage

setPageName

public void setPageName(java.lang.String pageName)
Description copied from interface: IPage
Sets the name of the page.

Specified by:
setPageName in interface IPage
Parameters:
pageName - fully qualified page name (including namespace prefix, if any)
Since:
3.0 *

validate

public void validate(IRequestCycle cycle)
By default, pages are not protected and this method does nothing.

Specified by:
validate in interface IPage

beginResponse

public void beginResponse(IMarkupWriter writer,
                          IRequestCycle cycle)
Deprecated. To be removed in 4.0. Implement PageRenderListenerinstead.

Does nothing, subclasses may override as needed.

Specified by:
beginResponse in interface IPage

getRequestCycle

public IRequestCycle getRequestCycle()
Description copied from interface: IPage
Returns the current IRequestCycle. This is set when the page is loaded (or obtained from the pool) and attached to the engine.

Specified by:
getRequestCycle in interface IPage

getVisit

public java.lang.Object getVisit()
Deprecated.  

Returns the visit object obtained from the engine via IEngine.getVisit(IRequestCycle).

Specified by:
getVisit in interface IPage

getGlobal

public java.lang.Object getGlobal()
Deprecated.  

Convienience methods, simply invokes IEngine.getGlobal().

Specified by:
getGlobal in interface IPage
Since:
2.3

addPageDetachListener

public void addPageDetachListener(PageDetachListener listener)
Specified by:
addPageDetachListener in interface IPage

addPageRenderListener

public void addPageRenderListener(PageRenderListener listener)
Deprecated.  

Specified by:
addPageRenderListener in interface IPage

addPageBeginRenderListener

public void addPageBeginRenderListener(PageBeginRenderListener listener)
Specified by:
addPageBeginRenderListener in interface IPage
Since:
4.0

addPageEndRenderListener

public void addPageEndRenderListener(PageEndRenderListener listener)
Specified by:
addPageEndRenderListener in interface IPage
Since:
4.0

removePageBeginRenderListener

public void removePageBeginRenderListener(PageBeginRenderListener listener)
Specified by:
removePageBeginRenderListener in interface IPage
Since:
4.0

removePageEndRenderListener

public void removePageEndRenderListener(PageEndRenderListener listener)
Specified by:
removePageEndRenderListener in interface IPage
Since:
4.0

firePageAttached

public void firePageAttached()
Description copied from interface: IPage
Used to explicitly fire PageAttachListeners for this page. This is used when a page is first loaded; The page loader attaches the newly created page instance before the rest of the page and components is loaded. In order to have meaningful event notifications when a page is first loaded (rather than pulled from the pool), it is necessary to fire page attach listeners at the end of the load.

Specified by:
firePageAttached in interface IPage
Since:
4.0

firePageDetached

protected void firePageDetached()
Since:
1.0.5

firePageBeginRender

protected void firePageBeginRender()
Since:
1.0.5

firePageEndRender

protected void firePageEndRender()
Since:
1.0.5

removePageDetachListener

public void removePageDetachListener(PageDetachListener listener)
Specified by:
removePageDetachListener in interface IPage
Since:
2.1-beta-2

removePageRenderListener

public void removePageRenderListener(PageRenderListener listener)
Deprecated.  

Specified by:
removePageRenderListener in interface IPage

beginPageRender

public void beginPageRender()
Description copied from interface: IPage
Invoked before a partial render of the page occurs (this happens when rewinding a Formwithin the page). The page is expected to fire appopriate events.

Specified by:
beginPageRender in interface IPage
Since:
2.2 *

endPageRender

public void endPageRender()
Description copied from interface: IPage
Invoked after a partial render of the page occurs (this happens when rewinding a Formwithin the page). The page is expected to fire appropriate events.

Specified by:
endPageRender in interface IPage
Since:
2.2 *

getPageName

public java.lang.String getPageName()
Description copied from interface: IPage
Returns the fully qualified name of the page, including its namespace prefix, if any.

Specified by:
getPageName in interface IPage
Since:
3.0 *

addPageValidateListener

public void addPageValidateListener(PageValidateListener listener)
Specified by:
addPageValidateListener in interface IPage

removePageValidateListener

public void removePageValidateListener(PageValidateListener listener)
Specified by:
removePageValidateListener in interface IPage

addPageAttachListener

public void addPageAttachListener(PageAttachListener listener)
Specified by:
addPageAttachListener in interface IPage
Since:
4.0

removePageAttachListener

public void removePageAttachListener(PageAttachListener listener)
Specified by:
removePageAttachListener in interface IPage
Since:
4.0

firePageValidate

protected void firePageValidate()

getOutputEncoding

protected java.lang.String getOutputEncoding()
Returns the output encoding to be used when rendering this page. This value is usually cached from the Engine.

Since:
3.0