com.primix.tapestry
Class AbstractPage

java.lang.Object
  |
  +--com.primix.tapestry.AbstractComponent
        |
        +--com.primix.tapestry.BaseComponent
              |
              +--com.primix.tapestry.AbstractPage
All Implemented Interfaces:
IComponent, IPage, IRender
Direct Known Subclasses:
BasePage, Deck

public abstract class AbstractPage
extends BaseComponent
implements IPage

Abstract base class implementing the IPage interface.

Since:
0.2.9
Version:
$Id: AbstractPage.java,v 1.10 2001/08/28 20:33:41 hship Exp $
Author:
Howard Ship, David Solis

Field Summary
protected  IEngine engine
          The IEngine the page is currently attached to.
protected  java.lang.String name
          The name of this page.
 
Fields inherited from class com.primix.tapestry.BaseComponent
outer, OUTER_INIT_SIZE, outerCount
 
Fields inherited from class com.primix.tapestry.AbstractComponent
id, page, specification, wrapped, wrappedCount
 
Constructor Summary
AbstractPage()
           
 
Method Summary
 void addPageCleanupListener(PageCleanupListener listener)
           
 void addPageDetachListener(PageDetachListener listener)
           
 void addPageRenderListener(PageRenderListener listener)
           
 void attach(IEngine value)
          Called by the engine to attach the page to itself.
 void beginResponse(IResponseWriter writer, IRequestCycle cycle)
          Does nothing, subclasses may override as needed.
 void cleanupPage()
          Invokes PageCleanupListener.pageCleanup(PageEvent) on any listener.
 void detach()
          Prepares the page to be returned to the pool.
protected  void firePageBeginRender()
           
protected  void firePageCleanup()
           
protected  void firePageDetached()
           
protected  void firePageEndRender()
           
 ChangeObserver getChangeObserver()
          Returns the object (effectively, an IPageRecorder) that is notified of any changes to persistant properties of the page.
 IEngine getEngine()
          Returns the IEngine that the page is currently attached to.
 java.lang.String getExtendedId()
          Returns the name of the page.
 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").
 java.lang.String getName()
          The logical name is the name given by the application.
 IComponent getNestedComponent(java.lang.String path)
          Returns a particular component from within the page.
 IPage getPage()
          Returns the page which ultimately contains the receiver.
 IRequestCycle getRequestCycle()
          Returns the current IRequestCycle.
abstract  IResponseWriter getResponseWriter(java.io.OutputStream out)
          Implemented in subclasses to provide a particular kind of response writer (and therefore, a particular kind of content).
 java.lang.Object getVisit()
          Returns the visit object obtained from the engine via IEngine.getVisit(IRequestCycle).
 void renderPage(IResponseWriter writer, IRequestCycle cycle)
           Invokes PageRenderListener.pageBeginRender(PageEvent) Invokes beginResponse(IResponseWriter, IRequestCycle) Invokes IRequestCycle.commitPageChanges() (if not rewinding) Invokes BaseComponent.render(IResponseWriter, IRequestCycle) Invokes PageRenderListener.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 setName(java.lang.String value)
           
 void setRequestCycle(IRequestCycle value)
          Invoked by the IRequestCycle to inform the page of the cycle, as it is loaded.
 void validate(IRequestCycle cycle)
          By default, pages are not protected and this method does nothing.
 
Methods inherited from class com.primix.tapestry.BaseComponent
addOuter, finishLoad, readTemplate, render
 
Methods inherited from class com.primix.tapestry.AbstractComponent
addAsset, addComponent, addWrapped, cleanupAfterRender, cleanupComponent, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getId, getListeners, getSpecification, prepareForRender, renderWrapped, reset, setBinding, setContainer, setId, setPage, setSpecification, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.primix.tapestry.IComponent
addAsset, addComponent, addWrapped, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getId, getSpecification, renderWrapped, setBinding, setContainer, setId, setPage, setSpecification
 
Methods inherited from interface com.primix.tapestry.IRender
render
 

Field Detail

engine

protected IEngine engine
The IEngine the page is currently attached to. This may be read, but not changed, but subclasses.

name

protected java.lang.String name
The name of this page. This may be read, but not changed, by subclasses.
Constructor Detail

AbstractPage

public AbstractPage()
Method Detail

getResponseWriter

public abstract IResponseWriter getResponseWriter(java.io.OutputStream out)
Implemented in subclasses to provide a particular kind of response writer (and therefore, a particular kind of content).
Specified by:
getResponseWriter in interface IPage

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
Following copied from interface: com.primix.tapestry.IPage
See Also:
IPageSource.releasePage(IPage)

getEngine

public IEngine getEngine()
Description copied from interface: IPage
Returns the IEngine that 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
Overrides:
getChangeObserver in class AbstractComponent
Following copied from class: com.primix.tapestry.AbstractComponent
See Also:
IPage.getChangeObserver()

getExtendedId

public java.lang.String getExtendedId()
Returns the name of the page.
Specified by:
getExtendedId in interface IComponent
Overrides:
getExtendedId in class AbstractComponent
Following copied from interface: com.primix.tapestry.IComponent
See Also:
IComponent.getIdPath()

getIdPath

public java.lang.String getIdPath()
Pages always return null for idPath.
Specified by:
getIdPath in interface IComponent
Overrides:
getIdPath in class AbstractComponent
Following copied from interface: com.primix.tapestry.IComponent
See Also:
IComponent.getId()

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

getName

public java.lang.String getName()
Description copied from interface: IPage
The logical name is the name given by the application.
Specified by:
getName in interface IPage

getPage

public IPage getPage()
Description copied from interface: IComponent
Returns the page which ultimately contains the receiver. A page will return itself.
Specified by:
getPage in interface IComponent
Overrides:
getPage in class AbstractComponent

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
Following copied from interface: com.primix.tapestry.IPage
Throws:
NoSuchComponentException - runtime exception thrown if the path does not identify a component.

attach

public void attach(IEngine value)
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(IResponseWriter writer,
                       IRequestCycle cycle)
                throws RequestCycleException

setChangeObserver

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

setName

public void setName(java.lang.String value)
Specified by:
setName in interface IPage

validate

public void validate(IRequestCycle cycle)
              throws RequestCycleException
By default, pages are not protected and this method does nothing.
Specified by:
validate in interface IPage

beginResponse

public void beginResponse(IResponseWriter writer,
                          IRequestCycle cycle)
                   throws RequestCycleException
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

setRequestCycle

public void setRequestCycle(IRequestCycle value)
Description copied from interface: IPage
Invoked by the IRequestCycle to inform the page of the cycle, as it is loaded.
Specified by:
setRequestCycle in interface IPage

cleanupPage

public void cleanupPage()
Invokes PageCleanupListener.pageCleanup(PageEvent) on any listener.

Subclasses may override, but should invoke this implementation.

Specified by:
cleanupPage in interface IPage

getVisit

public java.lang.Object getVisit()
Returns the visit object obtained from the engine via IEngine.getVisit(IRequestCycle).
Specified by:
getVisit in interface IPage

addPageDetachListener

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

addPageRenderListener

public void addPageRenderListener(PageRenderListener listener)
Specified by:
addPageRenderListener in interface IPage

addPageCleanupListener

public void addPageCleanupListener(PageCleanupListener listener)
Specified by:
addPageCleanupListener in interface IPage

firePageDetached

protected void firePageDetached()
Since:
1.0.5

firePageBeginRender

protected void firePageBeginRender()
Since:
1.0.5

firePageEndRender

protected void firePageEndRender()
Since:
1.0.5

firePageCleanup

protected void firePageCleanup()