public class PageImpl extends Object implements Page
Page.Stats
Constructor and Description |
---|
PageImpl(String name,
ComponentResourceSelector selector,
PersistentFieldManager persistentFieldManager,
PerthreadManager perThreadManager,
MetaDataLocator metaDataLocator) |
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(PageLifecycleListener listener)
Adds a listener that is notified of large scale page events.
|
void |
addPageAttachedCallback(Runnable callback)
Adds a callback for when the page is attached to the request.
|
void |
addPageDetachedCallback(Runnable callback)
Adds a callback for when the page is detached from the request.
|
void |
addPageLoadedCallback(Runnable callback)
Adds a callback for when the page is first loaded.
|
void |
addResetCallback(Runnable callback)
A reset occurs when a request for a page arrives that did not originate on the same page.
|
void |
addResetListener(PageResetListener listener)
Adds a new listener for page reset events.
|
void |
addVerifyCallback(Runnable callback)
Adds a verify callback, which is allowed while the page is loading.
|
void |
attached()
Invoked to inform the page that it is attached to the current request.
|
boolean |
detached()
Invoked to inform the page that it is being detached from the current request.
|
void |
discardPersistentFieldChanges()
Discards all persistent field changes for the page containing the component.
|
int |
getAttachCount()
Returns the number of times the page has been attached to a request.
|
ComponentPageElement |
getComponentElementByNestedId(String nestedId)
Retrieves a component element by its nested id (a sequence of simple ids, separated by dots).
|
Object |
getFieldChange(String nestedId,
String fieldName)
Gets a change for a field within the component.
|
org.slf4j.Logger |
getLogger()
Returns the logger of the root component element.
|
String |
getName()
Returns the short, logical name for the page.
|
Component |
getRootComponent()
The root component of the page.
|
ComponentPageElement |
getRootElement()
The root component of the page.
|
ComponentResourceSelector |
getSelector()
The selector (which includes Locale) used when the page was constructor.
|
Page.Stats |
getStats()
Returns the page construction statistics for this page.
|
boolean |
hasResetListeners()
Returns true if there are any
PageResetListener listeners. |
boolean |
isExactParameterCountMatch()
Returns true if extract parameter count matching is enabled.
|
void |
loaded()
Inform the page that it is now completely loaded.
|
void |
pageReset()
Invoked to notify
PageResetListener listeners. |
void |
persistFieldChange(ComponentResources resources,
String fieldName,
Object newValue)
Posts a change to a persistent field.
|
void |
removeLifecycleListener(PageLifecycleListener listener)
Removes a listener that was previously added.
|
void |
setRootElement(ComponentPageElement component)
Invoked during page construction time to connect the page's root component to the page
instance.
|
void |
setStats(Page.Stats stats)
Invoked once at the end of page construction, to provide page construction statistics.
|
String |
toString() |
public PageImpl(String name, ComponentResourceSelector selector, PersistentFieldManager persistentFieldManager, PerthreadManager perThreadManager, MetaDataLocator metaDataLocator)
name
- canonicalized page nameselector
- used to locate resourcespersistentFieldManager
- for access to cross-request persistent valuesperThreadManager
- metaDataLocator
- public void setStats(Page.Stats stats)
Page
public Page.Stats getStats()
Page
public ComponentPageElement getComponentElementByNestedId(String nestedId)
Page
getComponentElementByNestedId
in interface Page
public ComponentResourceSelector getSelector()
Page
getSelector
in interface Page
public void setRootElement(ComponentPageElement component)
Page
setRootElement
in interface Page
public ComponentPageElement getRootElement()
Page
getRootElement
in interface Page
public Component getRootComponent()
Page
getRootComponent
in interface Page
public void addLifecycleListener(PageLifecycleListener listener)
Page
addLifecycleListener
in interface Page
public void removeLifecycleListener(PageLifecycleListener listener)
Page
removeLifecycleListener
in interface Page
public boolean detached()
Page
PerthreadManager
. A future release of Tapestry will likely convert this method to
type void.detached
in interface Page
PageLifecycleListener.containingPageDidDetach()
public void loaded()
Page
loaded
in interface Page
PageLifecycleListener.containingPageDidLoad()
public void attached()
Page
Page.loaded()
will preceded the call to Page.attached()
.
First all listeners have PageLifecycleListener.restoreStateBeforePageAttach()
invoked, followed by
PageLifecycleListener.containingPageDidAttach()
.public org.slf4j.Logger getLogger()
Page
public void persistFieldChange(ComponentResources resources, String fieldName, Object newValue)
Page
persistFieldChange
in interface Page
resources
- the component resources for the component or mixin containing the field whose
value changedfieldName
- the name of the fieldnewValue
- the new value for the fieldpublic Object getFieldChange(String nestedId, String fieldName)
Page
getFieldChange
in interface Page
nestedId
- the nested component id of the component containing the fieldfieldName
- the name of the persistent fieldpublic void discardPersistentFieldChanges()
Page
Session
) which will
take effect in the next request (the attached page instance is not affected).discardPersistentFieldChanges
in interface Page
public String getName()
Page
public void addResetCallback(Runnable callback)
PageLifecycleCallbackHub
addResetCallback
in interface PageLifecycleCallbackHub
callback
- invoked when a page is activated by link from some other page.public void addResetListener(PageResetListener listener)
Page
addResetListener
in interface Page
listener
- will receive notifications when the page is accessed from a different pagepublic void addVerifyCallback(Runnable callback)
PageLifecycleCallbackHub
addVerifyCallback
in interface PageLifecycleCallbackHub
callback
- to be invoked after page loadedpublic void pageReset()
Page
PageResetListener
listeners.public boolean hasResetListeners()
Page
PageResetListener
listeners.hasResetListeners
in interface Page
public int getAttachCount()
Page
getAttachCount
in interface Page
public boolean isExactParameterCountMatch()
Page
isExactParameterCountMatch
in interface Page
MetaDataConstants.UNKNOWN_ACTIVATION_CONTEXT_CHECK
public void addPageLoadedCallback(Runnable callback)
PageLifecycleCallbackHub
addPageLoadedCallback
in interface PageLifecycleCallbackHub
callback
- invoked once, when page is first loadedpublic void addPageAttachedCallback(Runnable callback)
PageLifecycleCallbackHub
addPageAttachedCallback
in interface PageLifecycleCallbackHub
public void addPageDetachedCallback(Runnable callback)
PageLifecycleCallbackHub
addPageDetachedCallback
in interface PageLifecycleCallbackHub
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.