|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.request.handler.PageProvider
public class PageProvider
Provides page instance for request handlers. Each of the constructors has just enough information
to get existing or create new page instance. Requesting or creating page instance is deferred
until getPageInstance()
is called.
Purpose of this class is to reduce complexity of both IRequestMapper
s and
IRequestHandler
s. IRequestMapper
examines the URL, gathers all relevant
information about the page in the URL (combination of page id, page class, page parameters and
render count), creates PageProvider
object and creates a IRequestHandler
instance
that can use the PageProvider
to access the page.
Apart from simplifying IRequestMapper
s and IRequestHandler
s PageProvider
also helps performance because creating or obtaining page from IPageManager
is delayed
until the IRequestHandler
actually requires the page.
Constructor Summary | |
---|---|
PageProvider(Class<? extends IRequestablePage> pageClass)
Creates a new page provider object. |
|
PageProvider(Class<? extends IRequestablePage> pageClass,
PageParameters pageParameters)
Creates a new page provider object. |
|
PageProvider(Integer pageId,
Class<? extends IRequestablePage> pageClass,
Integer renderCount)
Creates a new page provider object. |
|
PageProvider(Integer pageId,
Class<? extends IRequestablePage> pageClass,
PageParameters pageParameters,
Integer renderCount)
Creates a new page provider object. |
|
PageProvider(Integer pageId,
Integer renderCount)
Creates a new page provider object. |
|
PageProvider(IRequestablePage page)
Creates a new page provider object. |
Method Summary | |
---|---|
void |
detach()
Detaches the page if it has been loaded (that means either PageProvider(IRequestablePage) constructor has been used or
getPageInstance() has been called). |
Class<? extends IRequestablePage> |
getPageClass()
Returns class of the page. |
Integer |
getPageId()
Returns the page id. |
IRequestablePage |
getPageInstance()
Returns page instance specified by the constructor. |
PageParameters |
getPageParameters()
Returns PageParameters of the page. |
protected IPageSource |
getPageSource()
|
Integer |
getRenderCount()
Returns the number of times this page has been rendered. |
boolean |
hasPageInstance()
Checks whether or not the provider has a page instance. |
boolean |
isNewPageInstance()
The page instance is new only if there is no cached instance or the data stores doesn't have a page with that id with the same pageClass. |
boolean |
isPageInstanceFresh()
Returns whether or not the page instance held by this provider has been instantiated by the provider. |
protected void |
setPageParameters(PageParameters pageParameters)
|
void |
setPageSource(IPageSource pageSource)
If the PageProvider is used outside request thread (thread that does not have
application instance assigned) it is necessary to specify a IPageSource instance so
that PageProvider knows how to get a page instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PageProvider(Integer pageId, Integer renderCount)
getPageInstance()
this provider
will return page instance with specified id.
pageId
- renderCount
- optional argumentpublic PageProvider(Integer pageId, Class<? extends IRequestablePage> pageClass, Integer renderCount)
getPageInstance()
this provider
will return page instance with specified id if it exists and it's class matches pageClass. If
none of these is true new page instance will be created.
pageId
- pageClass
- renderCount
- optional argumentpublic PageProvider(Integer pageId, Class<? extends IRequestablePage> pageClass, PageParameters pageParameters, Integer renderCount)
getPageInstance()
this provider
will return page instance with specified id if it exists and it's class matches pageClass. If
none of these is true new page instance will be created.
pageId
- pageClass
- pageParameters
- renderCount
- optional argumentpublic PageProvider(Class<? extends IRequestablePage> pageClass, PageParameters pageParameters)
getPageInstance()
this provider
will return new instance of page with specified class.
pageClass
- pageParameters
- public PageProvider(Class<? extends IRequestablePage> pageClass)
getPageInstance()
this provider
will return new instance of page with specified class.
pageClass
- public PageProvider(IRequestablePage page)
getPageInstance()
this provider
will return the given page instance.
page
- Method Detail |
---|
public IRequestablePage getPageInstance()
IPageProvider
getPageInstance
in interface IPageProvider
IPageProvider.getPageInstance()
public PageParameters getPageParameters()
IPageProvider
PageParameters
of the page.
getPageParameters
in interface IPageProvider
IPageProvider.getPageParameters()
public boolean isNewPageInstance()
isNewPageInstance
in interface IPageProvider
true
if calling IPageProvider.getPageInstance()
will create new page
instance, false
otherwise.IPageProvider.isNewPageInstance()
public Class<? extends IRequestablePage> getPageClass()
IPageProvider
getPageClass
in interface IPageProvider
IPageProvider.getPageClass()
protected IPageSource getPageSource()
public void detach()
PageProvider(IRequestablePage)
constructor has been used or
getPageInstance()
has been called).
detach
in interface IPageProvider
public void setPageSource(IPageSource pageSource)
PageProvider
is used outside request thread (thread that does not have
application instance assigned) it is necessary to specify a IPageSource
instance so
that PageProvider
knows how to get a page instance.
pageSource
- protected void setPageParameters(PageParameters pageParameters)
pageParameters
- public Integer getPageId()
IPageProvider
getPageId
in interface IPageProvider
public Integer getRenderCount()
IPageProvider
getRenderCount
in interface IPageProvider
public final boolean hasPageInstance()
hasPageInstance
in interface IIntrospectablePageProvider
true
iff page instance has been created or retrievedpublic final boolean isPageInstanceFresh()
isPageInstanceFresh
in interface IIntrospectablePageProvider
true
iff the page instance held by this provider was instantiated by the
provider
IllegalStateException
- if this method is called and the provider does not yet have a page instance, ie
if getPageInstance()
has never been called on this provider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |