Abstract base class for pages. As a 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).

Construction - When a page is constructed, it is automatically added to the current
PageMap in the Session. When a Page is added to the Session's PageMap, the PageMap assigns the
Page an id. A PageMap is roughly equivalent to a browser window and encapsulates a set of pages
accessible through that window. When a popup window is created, a new PageMap is created for the
popup.

Identity - The Session that a Page is contained in can be retrieved by calling
Page.getSession(). Page identifiers start at 0 for each PageMap in the Session and increment as
new pages are added to the map. The PageMap-(and Session)-unique identifier assigned to a given
Page can be retrieved by calling getId(). So, the first Page added to a new user Session will
always be named "0".

LifeCycle - Subclasses of Page which are interested in lifecycle events can override
onBeginRequest, onEndRequest() and onModelChanged(). The onBeginRequest() method is inherited
from Component. A call to onBeginRequest() is made for every Component on a Page before page
rendering begins. At the end of a request (when rendering has completed) to a Page, the
onEndRequest() method is called for every Component on the Page.

Nested Component Hierarchy - The Page class is a subclass of MarkupContainer. All
MarkupContainers can have "associated markup", which resides alongside the Java code by default.
All MarkupContainers are also Component containers. Through nesting, of containers, a Page can
contain any arbitrary tree of Components. For more details on MarkupContainers, see
MarkupContainer.

Bookmarkable Pages - Pages can be constructed with any constructor when they are being
used in a Wicket session, but if you wish to link to a Page using a URL that is "bookmarkable"
(which implies that the URL will not have any session information encoded in it, and that you can
call this page directly without having a session first directly from your browser), you need to
implement your Page with a no-arg constructor or with a constructor that accepts a 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.

Models - Pages, like other Components, can have models (see IModel). A Page
can be assigned a model by passing one to the Page's constructor, by overriding initModel() or
with an explicit invocation of setModel(). If the model is a
CompoundPropertyModel, Components on the Page can use the Page's
model implicitly via container inheritance. If a Component is not assigned a model, the
initModel() override in Component will cause that Component to use the nearest CompoundModel in
the parent chain, in this case, the Page's model. For basic CompoundModels, the name of the
Component determines which property of the implicit page model the component is bound to. If more
control is desired over the binding of Components to the page model (for example, if you want to
specify some property expression other than the component's name for retrieving the model
object), BoundCompoundPropertyModel can be used.

Back Button - Pages can support the back button by enabling versioning with a call to
setVersioned(boolean). If a Page is versioned and changes occur to it which need to be tracked, a
version manager will be installed using the ISessionStore's factory method
newVersionManager().

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 listner request target to build the component
hierarchy), in that case setRenderingFlag should be false

dirty

setFreezePageId

public boolean setFreezePageId(boolean freeze)

Sets whether or not the page is allowed to change its page id. Implementations of this
interface usually change their page id once a change to the data structure is made and
historical record of the current state needs to be kept (usually to be accessible via the
back button). Keeping a historical record is usually achieved by simply incrementing the page
id to the next unique number, so when the implementation is stored it is done so in a new
slot.
This method is useful when for some reason we do not want the implementation to change its
page id under any circumstances. One concrete example is an AJAX request. Suppose the page
with id 10 was written out with callbacks pointing to id 10. Suppose that the user executed
some AJAX callbacks which have changed the page id to 15. Now, the user clicks a non-AJAX
link that was never updated by an AJAX update and still points to id 10 - which causes the
state of the page to be rolled back - which is usually undesirable as all changes made to the
page by AJAX requests are lost. So, instead, whatever is invoking the execution of the AJAX
request on the page can use this method to tell the page to not update its page id thereby
solving the problem.

endComponentRender

THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL.
This method is called when a component was rendered standalone. If it is a
MarkupContainer then the rendering for that container is checked.

Parameters:

component -

getAutoIndex

public final int getAutoIndex()

THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
Get a page unique number, which will be increased with each call.

isErrorPage

Override this method and return true if your page is used to display Wicket errors. This can
help the framework prevent infinite failure loops.

Returns:

True if this page is intended to display an error to the end user.

isPageStateless

public final boolean isPageStateless()

Gets whether the page is stateless. Components on stateless page must not render any stateful
urls, and components on stateful page must not render any stateless urls. Stateful urls are
urls, which refer to a certain (current) page instance.

onRedirect

setNumericId

public final void setNumericId(int id)

THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL.
Set the id for this Page. This method is called by PageMap when a Page is added because the
id, which is assigned by PageMap, is not known until this time.

Parameters:

id - The id

setStatelessHint

public final void setStatelessHint(boolean value)

Sets whether the page should try to be stateless. To be stateless, getStatelessHint() of
every component on page (and it's behavior) must return true and the page must be
bookmarkable.

componentChanged

This method will be called for all components that are changed on the page So also auto
components or components that are not versioned.
If the parent is given that it was a remove or add from that parent of the given component.
else it was just a internal property change of that component.

Parameters:

component -

parent -

internalOnModelChanged

protected final void internalOnModelChanged()

THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR OVERRIDE.

onBeforeRender

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.

getMarkupType

The type of associated markup for this component (for example, "html", "wml" or
"vxml"). The markup type for a component is independent of whether or not the
component actually has an associated markup resource file (which is determined at
runtime). If there is no markup type for a component, null may be returned, but this
means that no markup can be loaded for the class. Null is also returned if the
component, or any of its parents, has not been added to a Page.

getRenderCount

Returns the number of times this page has been rendered. The number will be appended to
listener interface links in order to prevent invoking listeners from staled page version.

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.