public abstract class Page extends MarkupContainer implements IRequestablePage, IQueueRegion
MarkupContainer
subclass, a Page can contain a
component hierarchy and markup in some markup language such as HTML. Users of the framework
should not attempt to subclass Page directly. Instead they should subclass a subclass of Page
that is appropriate to the markup type they are using, such as WebPage
(for HTML markup).
Page has the following differences to Component
s main concepts:
Session
and
increment for each new page. This numerical identifier is used as the component identifier
accessible via getId()
.IPageManager
. PageParameters
argument (which wraps any
query string parameters for a request). In case the page has both constructors, the constructor
with PageParameters will be used.Component.setVersioned(boolean)
. By default all pages are versioned if not configured differently
in PageSettings.setVersionPagesByDefault(boolean)
WebPage
,
MarkupContainer
,
CompoundPropertyModel
,
Component
,
Serialized FormENABLE, FLAG_AFTER_RENDERING, FLAG_INITIALIZED, FLAG_PREPARED_FOR_RENDER, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RENDERING, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING
Modifier | Constructor and Description |
---|---|
protected |
Page()
Constructor.
|
protected |
Page(IModel<?> model)
Constructor.
|
protected |
Page(PageParameters parameters)
The
PageParameters parameter will be stored in this page and then those parameters
will be used to create stateless links to this bookmarkable page. |
Modifier and Type | Method and Description |
---|---|
protected void |
componentChanged(Component component,
MarkupContainer parent)
This method will be called for all components that are changed on the page So also auto
components or components that are not versioned.
|
void |
componentRendered(Component component)
Adds a component to the set of rendered components.
|
void |
detachModels()
Detaches any attached models referenced by this page.
|
void |
dirty() |
void |
dirty(boolean isInitialization)
Mark this page as modified in the session.
|
void |
endComponentRender(Component component)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
int |
getAutoIndex()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
String |
getId()
Gets the id of this component.
|
MarkupType |
getMarkupType()
Get the type of associated markup for this component.
|
Class<? extends Page> |
getPageClass() |
int |
getPageId() |
PageParameters |
getPageParameters()
The
PageParameters object that was used to construct this page. |
PageReference |
getPageReference()
Gets page instance's unique identifier
|
int |
getRenderCount()
Returns the number of times this page has been rendered.
|
long |
getSizeInBytes() |
boolean |
getStatelessHint()
Returns whether the page should try to be stateless.
|
String |
hierarchyAsString() |
protected void |
internalOnModelChanged()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
void |
internalPrepareForRender(boolean setRenderingFlag)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
boolean |
isBookmarkable()
Bookmarkable page can be instantiated using a bookmarkable URL.
|
boolean |
isErrorPage()
Override this method and return true if your page is used to display Wicket errors.
|
boolean |
isPageStateless()
Gets whether the page is stateless.
|
protected void |
onAfterRender()
Called just after a component is rendered.
|
protected void |
onBeforeRender()
Called just before a component is rendered only if the component is visible.
|
protected void |
onDetach()
Called to allow a component to detach resources after use.
|
protected void |
onInitialize()
This method is meant to be used as an alternative to initialize components.
|
protected void |
onRender()
Implementation that renders this component.
|
void |
renderPage()
Renders the page
|
boolean |
setFreezePageId(boolean freeze)
Sets whether or not the page is allowed to change its page id.
|
void |
setNumericId(int id)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
Page |
setStatelessHint(boolean value)
Sets whether the page should try to be stateless.
|
void |
setWasCreatedBookmarkable(boolean wasCreatedBookmarkable)
THIS METHOD IS NOT PART OF WICKET API.
|
void |
startComponentRender(Component component)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
String |
toString()
Get the string representation of this container.
|
boolean |
wasCreatedBookmarkable()
Checks if this page was created using one of its bookmarkable constructors
|
boolean |
wasRendered(Component component)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onAfterRenderChildren, onComponentTagBody, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, visitChildren, visitChildren, visitChildren, visitChildren
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onComponentTag, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canCallListenerInterfaceAfterExpiry, detach, get, getBehaviorById, getBehaviorId, getPage, getPageRelativePath
detach
dequeue, getRegionMarkup, newDequeueContext
protected Page()
protected Page(IModel<?> model)
model
- See ComponentComponent.Component(String, IModel)
protected Page(PageParameters parameters)
PageParameters
parameter will be stored in this page and then those parameters
will be used to create stateless links to this bookmarkable page.parameters
- externally passed parametersPageParameters
public PageParameters getPageParameters()
PageParameters
object that was used to construct this page. This will be used in
creating stateless/bookmarkable links to this pagegetPageParameters
in interface IRequestablePage
PageParameters
The construction page parameterpublic final void componentRendered(Component component)
component
- The component that was renderedpublic void detachModels()
detachModels
in class Component
public void internalPrepareForRender(boolean setRenderingFlag)
Component
Prepares the component and it's children for rendering. On whole page render this method must be called on the page. On AJAX request, this method must be called on the updated component.
internalPrepareForRender
in class Component
setRenderingFlag
- Whether to set the rendering flag. This must be true if the page is about to be
rendered. However, there are usecases to call this method without an immediate
render (e.g. on stateless listener request target to build the component
hierarchy), in that case setRenderingFlag should be false.Component.internalPrepareForRender(boolean)
public final void dirty()
dirty(boolean)
public boolean setFreezePageId(boolean freeze)
setFreezePageId
in interface IManageablePage
public void dirty(boolean isInitialization)
page store
isInitialization
- a flag whether this is a page instantiationprotected void onInitialize()
Component
Page
thus providing the component with an atomic callback
when the component's environment is built out.
Overrides must call super#Component.onInitialize()
. Usually this should be the first thing an
override does, much like a constructor.
Parent containers are guaranteed to be initialized before their children
It is safe to use Component.getPage()
in this method
NOTE:The timing of this call is not precise, the contract is that it is called sometime
before Component.onBeforeRender()
.
onInitialize
in class MarkupContainer
public final void endComponentRender(Component component)
MarkupContainer
then the rendering for that container is checked.component
- public final int getAutoIndex()
public final String getId()
Component
getId
in interface IRequestableComponent
getId
in class Component
Component.getId()
public final long getSizeInBytes()
getSizeInBytes
in class Component
public final boolean getStatelessHint()
getStatelessHint
in class Component
Component.getStatelessHint()
public final String hierarchyAsString()
public boolean isBookmarkable()
isBookmarkable
in interface IRequestablePage
public boolean isErrorPage()
public final boolean isPageStateless()
isPageStateless
in interface IManageablePage
public final void setNumericId(int id)
id
- The idpublic final Page setStatelessHint(boolean value)
value
- whether the page should try to be statelesspublic final void startComponentRender(Component component)
component
- public String toString()
toString
in class MarkupContainer
Component.toString()
protected void componentChanged(Component component, MarkupContainer parent)
component
- parent
- protected final void internalOnModelChanged()
internalOnModelChanged
in class Component
Component.internalOnModelChanged()
protected void onBeforeRender()
Component
NOTE: If you override this, you *must* call super.onBeforeRender() within
your implementation.
Because this method is responsible for cascading Component.onBeforeRender()
call to its
children it is strongly recommended that super call is made at the end of the override.
onBeforeRender
in class Component
Component.onBeforeRender()
protected void onAfterRender()
Component
onAfterRender
in class Component
Component.onAfterRender()
protected void onDetach()
Component
onDetach
in class MarkupContainer
Component.onDetach()
protected void onRender()
Component
onRender
in class MarkupContainer
MarkupContainer.onRender()
public MarkupType getMarkupType()
MarkupContainer
getMarkupType
in class MarkupContainer
MarkupContainer.getMarkupType()
public PageReference getPageReference()
public int getPageId()
getPageId
in interface IManageablePage
IManageablePage.getPageId()
public int getRenderCount()
IRequestablePage
For example a same page might have been rendered in two separate tabs. Page render doesn't change page id but it can modify component hierarchy. Listener interface links on such page should only work in tab where the page was rendered most recently.
getRenderCount
in interface IRequestablePage
public final void setWasCreatedBookmarkable(boolean wasCreatedBookmarkable)
wasCreatedBookmarkable
- public final boolean wasCreatedBookmarkable()
wasCreatedBookmarkable
in interface IRequestablePage
true
if this page has been created by a bookmarkable URL,
false
otherwise.IRequestablePage.wasCreatedBookmarkable()
public void renderPage()
IRequestablePage
renderPage
in interface IRequestablePage
IRequestablePage.renderPage()
public final boolean wasRendered(Component component)
component
- Copyright © 2006–2021 Apache Software Foundation. All rights reserved.