public abstract class AbstractPage extends BaseComponent implements IPage
IPage
interface.Constructor and Description |
---|
AbstractPage()
Standard constructor; invokes
initialize() to configure initial values for
properties of the page. |
Modifier and Type | Method and Description |
---|---|
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
engine to attach the page to itself. |
void |
beginPageRender()
Invoked before a partial render of the page occurs (this happens when rewinding a
Form within the page). |
void |
beginResponse(IMarkupWriter writer,
IRequestCycle cycle)
Deprecated.
To be removed in 4.0. Implement
PageRenderListener instead. |
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
Form within the page). |
void |
firePageAttached()
Used to explicitly fire
PageAttachListener s 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
IEngine that 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.
|
addOuter, finishLoad, renderComponent
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getResponseContentType
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
public AbstractPage()
initialize()
to configure initial values for
properties of the page.public void detach()
PageDetachListener.pageDetached(PageEvent)
on all listeners
initialize()
to clear/reset any properties
Subclasses may override this method, but must invoke this implementation (usually, last).
detach
in interface IPage
PageDetachListener
protected void initialize()
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).
PageDetachListener
,
PageAttachListener
public IEngine getEngine()
IPage
IEngine
that the page is currently attached to.public ChangeObserver getChangeObserver()
IPage
IPageRecorder
) that
is notified of any changes to persistant properties of the page.getChangeObserver
in interface IPage
public java.lang.String getExtendedId()
getExtendedId
in interface IComponent
getExtendedId
in class AbstractComponent
AbstractComponent.getIdPath()
public java.lang.String getIdPath()
getIdPath
in interface IComponent
getIdPath
in class AbstractComponent
IComponent.getId()
public java.util.Locale getLocale()
public void setLocale(java.util.Locale value)
IPage
ApplicationRuntimeException
.public IComponent getNestedComponent(java.lang.String path)
IPage
getNestedComponent
in interface IPage
public void attach(IEngine engine, IRequestCycle cycle)
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.public void renderPage(IMarkupWriter writer, IRequestCycle cycle)
PageBeginRenderListener.pageBeginRender(PageEvent)
beginResponse(IMarkupWriter, IRequestCycle)
IRequestCycle.commitPageChanges()
(if not rewinding)
AbstractComponent.render(IMarkupWriter, IRequestCycle)
PageEndRenderListener.pageEndRender(PageEvent)
(this occurs even if a
previous step throws an exception)renderPage
in interface IPage
public void setChangeObserver(ChangeObserver value)
setChangeObserver
in interface IPage
public void setPageName(java.lang.String pageName)
IPage
setPageName
in interface IPage
pageName
- fully qualified page name (including namespace prefix, if any)public void validate(IRequestCycle cycle)
public void beginResponse(IMarkupWriter writer, IRequestCycle cycle)
PageRenderListener
instead.beginResponse
in interface IPage
public IRequestCycle getRequestCycle()
IPage
IRequestCycle
. This is set when the page is loaded (or obtained
from the pool) and attached to the engine
.getRequestCycle
in interface IPage
public java.lang.Object getVisit()
IEngine.getVisit(IRequestCycle)
.public java.lang.Object getGlobal()
IEngine.getGlobal()
.public void addPageDetachListener(PageDetachListener listener)
addPageDetachListener
in interface IPage
public void addPageRenderListener(PageRenderListener listener)
addPageRenderListener
in interface IPage
public void addPageBeginRenderListener(PageBeginRenderListener listener)
addPageBeginRenderListener
in interface IPage
public void addPageEndRenderListener(PageEndRenderListener listener)
addPageEndRenderListener
in interface IPage
public void removePageBeginRenderListener(PageBeginRenderListener listener)
removePageBeginRenderListener
in interface IPage
public void removePageEndRenderListener(PageEndRenderListener listener)
removePageEndRenderListener
in interface IPage
public void firePageAttached()
IPage
PageAttachListener
s 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.firePageAttached
in interface IPage
protected void firePageDetached()
protected void firePageBeginRender()
protected void firePageEndRender()
public void removePageDetachListener(PageDetachListener listener)
removePageDetachListener
in interface IPage
public void removePageRenderListener(PageRenderListener listener)
removePageRenderListener
in interface IPage
public void beginPageRender()
IPage
Form
within the page). The page is expected to fire
appopriate events.beginPageRender
in interface IPage
public void endPageRender()
IPage
Form
within the page). The page is expected to fire
appropriate events.endPageRender
in interface IPage
public java.lang.String getPageName()
IPage
getPageName
in interface IPage
public void addPageValidateListener(PageValidateListener listener)
addPageValidateListener
in interface IPage
public void removePageValidateListener(PageValidateListener listener)
removePageValidateListener
in interface IPage
public void addPageAttachListener(PageAttachListener listener)
addPageAttachListener
in interface IPage
public void removePageAttachListener(PageAttachListener listener)
removePageAttachListener
in interface IPage
protected void firePageValidate()
protected java.lang.String getOutputEncoding()