org.apache.tapestry
Class AbstractPage

java.lang.Object
  extended by org.apache.hivemind.impl.BaseLocatable
      extended by org.apache.tapestry.AbstractComponent
          extended by org.apache.tapestry.BaseComponent
              extended by org.apache.tapestry.AbstractPage
All Implemented Interfaces:
org.apache.hivemind.Locatable, org.apache.hivemind.LocationHolder, IComponent, IDirectEvent, Component, IPage, IRender, ITemplateComponent
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

Field Summary
 
Fields inherited from class org.apache.tapestry.AbstractComponent
_body, _bodyCount
 
Constructor Summary
AbstractPage()
          Standard constructor.
 
Method Summary
 void addPageAttachListener(PageAttachListener listener)
           
 void addPageBeginRenderListener(PageBeginRenderListener listener)
           
 void addPageDetachListener(PageDetachListener listener)
           
 void addPageEndRenderListener(PageEndRenderListener listener)
           
 void addPageValidateListener(PageValidateListener listener)
           
 void attach(IEngine engine, IRequestCycle cycle)
          Called by the engine to attach the page to itself.
 void beginPageRender()
          Invoked before a partial render of the page occurs (this happens when rewinding a Formwithin the page).
protected  void cleanupAfterRender(IRequestCycle cycle)
          Invoked by AbstractComponent.render(IMarkupWriter, IRequestCycle)after the component renders.
 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.
 String getExtendedId()
          Returns the name of the page.
 String getIdPath()
          Pages always return null for idPath.
 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(String path)
          Returns a particular component from within the page.
protected  String getOutputEncoding()
          Returns the output encoding to be used when rendering this page.
 String getPageName()
          Returns the fully qualified name of the page, including its namespace prefix, if any.
 IRequestCycle getRequestCycle()
          Returns the current IRequestCycle.
 boolean hasFormComponents()
          Whether or not this page contains IForm instances.
 boolean hasWidgets()
          Whether or not this page contains IWidget instances.
 void removePageAttachListener(PageAttachListener listener)
           
 void removePageBeginRenderListener(PageBeginRenderListener listener)
           
 void removePageDetachListener(PageDetachListener listener)
           
 void removePageEndRenderListener(PageEndRenderListener listener)
           
 void removePageValidateListener(PageValidateListener listener)
           
 void renderPage(ResponseBuilder builder, IRequestCycle cycle)
          Renders the page.
 void setChangeObserver(ChangeObserver value)
           
 void setHasFormComponents(boolean value)
          Sets whether or not page has forms.
 void setHasWidgets(boolean value)
          Sets whether or not page has widgets.
 void setLocale(Locale value)
          Updates the page's locale.
 void setPageName(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, getContainedRenderers, getInnerRenderers, renderComponent
 
Methods inherited from class org.apache.tapestry.AbstractComponent
addAsset, addBody, addComponent, checkActiveLock, enterActiveState, equals, finishLoad, generateClientId, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getBoundId, getClientId, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getId, getListeners, getMessages, getNamespace, getPage, getRenderWorker, getSpecification, getSpecifiedId, getTemplateTagName, hasEvents, hashCode, isInActiveState, isParameterBound, isRendering, isStateful, pageEndRender, peekClientId, prepareForRender, render, renderBody, renderIdAttribute, renderInformalParameters, setBinding, setClientId, setContainedComponent, setContainer, setHasEvents, setId, setNamespace, setPage, setTemplateTagName, toString, triggerEvent
 
Methods inherited from class org.apache.hivemind.impl.BaseLocatable
getLocation, setLocation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.IPage
getPropertyChangeObserver, getResponseContentType
 
Methods inherited from interface org.apache.tapestry.IComponent
addAsset, addBody, addComponent, enterActiveState, finishLoad, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getClientId, getComponent, getComponents, getContainedComponent, getContainer, getEventInvoker, getId, getListeners, getMessages, getNamespace, getPage, getSpecification, getSpecifiedId, getTemplateTagName, isRendering, peekClientId, renderBody, setBinding, setClientId, setContainedComponent, setContainer, setId, setNamespace, setPage, setTemplateTagName
 
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. Does nothing.

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

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 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 String getIdPath()
Pages always return null for idPath.

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

getLocale

public 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(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(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 engine to attach the page to itself. Does not change the locale, but since a page is selected from the IPageSource pool based on its locale matching the engine's locale, they should match anyway.

Specified by:
attach in interface IPage

renderPage

public void renderPage(ResponseBuilder builder,
                       IRequestCycle cycle)
Renders the page.

Specified by:
renderPage in interface IPage

setChangeObserver

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

setPageName

public void setPageName(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

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

addPageDetachListener

public void addPageDetachListener(PageDetachListener listener)
Specified by:
addPageDetachListener 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

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 *

cleanupAfterRender

protected void cleanupAfterRender(IRequestCycle cycle)
Description copied from class: AbstractComponent
Invoked by AbstractComponent.render(IMarkupWriter, IRequestCycle)after the component renders.

Overrides:
cleanupAfterRender in class AbstractComponent

getPageName

public 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 String getOutputEncoding()
Returns the output encoding to be used when rendering this page. This value is usually cached from the Engine.

Since:
3.0

hasFormComponents

public boolean hasFormComponents()
Description copied from interface: IPage
Whether or not this page contains IForm instances.

Specified by:
hasFormComponents in interface IPage
Returns:
True if page contains forms, false otherwise.

setHasFormComponents

public void setHasFormComponents(boolean value)
Description copied from interface: IPage
Sets whether or not page has forms.

Specified by:
setHasFormComponents in interface IPage
Parameters:
value - Indicator of containing forms.

hasWidgets

public boolean hasWidgets()
Description copied from interface: IPage
Whether or not this page contains IWidget instances.

Specified by:
hasWidgets in interface IPage
Returns:
True if page contains widgets, false otherwise.

setHasWidgets

public void setHasWidgets(boolean value)
Description copied from interface: IPage
Sets whether or not page has widgets.

Specified by:
setHasWidgets in interface IPage
Parameters:
value - Indicator of containing widgets.


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.