Class PageImpl
java.lang.Object
org.apache.tapestry5.internal.structure.PageImpl
- All Implemented Interfaces:
Page,PageLifecycleCallbackHub
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tapestry5.internal.structure.Page
Page.Stats -
Constructor Summary
ConstructorsConstructorDescriptionPageImpl(String name, ComponentResourceSelector selector, PersistentFieldManager persistentFieldManager, PerthreadManager perThreadManager, MetaDataLocator metaDataLocator) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleListener(PageLifecycleListener listener) Adds a listener that is notified of large scale page events.voidaddPageAttachedCallback(Runnable callback) Adds a callback for when the page is attached to the request.voidaddPageDetachedCallback(Runnable callback) Adds a callback for when the page is detached from the request.voidaddPageLoadedCallback(Runnable callback) Adds a callback for when the page is first loaded.voidaddResetCallback(Runnable callback) A reset occurs when a request for a page arrives that did not originate on the same page.voidaddResetListener(PageResetListener listener) Adds a new listener for page reset events.voidaddVerifyCallback(Runnable callback) Adds a verify callback, which is allowed while the page is loading.voidattached()Invoked to inform the page that it is attached to the current request.booleandetached()Invoked to inform the page that it is being detached from the current request.voidDiscards all persistent field changes for the page containing the component.intReturns the number of times the page has been attached to a request.getComponentElementByNestedId(String nestedId) Retrieves a component element by its nested id (a sequence of simple ids, separated by dots).getFieldChange(String nestedId, String fieldName) Gets a change for a field within the component.org.slf4j.LoggerReturns the logger of the root component element.getName()Returns the short, logical name for the page.The root component of the page.The root component of the page.The selector (which includes Locale) used when the page was constructor.getStats()Returns the page construction statistics for this page.booleanReturns true if there are anyPageResetListenerlisteners.booleanReturns true if extract parameter count matching is enabled.voidloaded()Inform the page that it is now completely loaded.voidInvoked to notifyPageResetListenerlisteners.voidpersistFieldChange(ComponentResources resources, String fieldName, Object newValue) Posts a change to a persistent field.voidremoveLifecycleListener(PageLifecycleListener listener) Removes a listener that was previously added.voidsetRootElement(ComponentPageElement component) Invoked during page construction time to connect the page's root component to the page instance.voidsetStats(Page.Stats stats) Invoked once at the end of page construction, to provide page construction statistics.toString()
-
Constructor Details
-
PageImpl
public PageImpl(String name, ComponentResourceSelector selector, PersistentFieldManager persistentFieldManager, PerthreadManager perThreadManager, MetaDataLocator metaDataLocator) - Parameters:
name- canonicalized page nameselector- used to locate resourcespersistentFieldManager- for access to cross-request persistent valuesperThreadManager-metaDataLocator-
-
-
Method Details
-
setStats
Description copied from interface:PageInvoked once at the end of page construction, to provide page construction statistics. -
getStats
Description copied from interface:PageReturns the page construction statistics for this page. -
toString
-
getComponentElementByNestedId
Description copied from interface:PageRetrieves a component element by its nested id (a sequence of simple ids, separated by dots). The individual names in the nested id are matched without regards to case. A nested id of '' (the empty string) returns the root element of the page.- Specified by:
getComponentElementByNestedIdin interfacePage
-
getSelector
Description copied from interface:PageThe selector (which includes Locale) used when the page was constructor.- Specified by:
getSelectorin interfacePage
-
setRootElement
Description copied from interface:PageInvoked during page construction time to connect the page's root component to the page instance.- Specified by:
setRootElementin interfacePage
-
getRootElement
Description copied from interface:PageThe root component of the page. This is the wrapper around the end developer's view of the page.- Specified by:
getRootElementin interfacePage
-
getRootComponent
Description copied from interface:PageThe root component of the page. A convenience over invoking getRootElement().getComponent().- Specified by:
getRootComponentin interfacePage
-
addLifecycleListener
Description copied from interface:PageAdds a listener that is notified of large scale page events.- Specified by:
addLifecycleListenerin interfacePage
-
removeLifecycleListener
Description copied from interface:PageRemoves a listener that was previously added.- Specified by:
removeLifecycleListenerin interfacePage
-
detached
Description copied from interface:PageInvoked to inform the page that it is being detached from the current request. This occurs just before the page is returned to the page pool. A page may be clean or dirty. A page is dirty if its dirty count is greater than zero (meaning that, during the render of the page, some components did not fully render), or if any of its listeners throw an exception from containingPageDidDetach(). The page pool should discard pages that are dirty, rather than store them into the pool. Under Tapestry 5.2 and pool-less pages, the result is ignored; all mutable state is expected to be discarded automatically from thePerthreadManager. A future release of Tapestry will likely convert this method to type void. -
loaded
Description copied from interface:PageInform the page that it is now completely loaded. -
attached
Description copied from interface:PageInvoked to inform the page that it is attached to the current request. This occurs when a page is first referenced within a request. If the page was created from scratch for this request, the call toPage.loaded()will preceded the call toPage.attached(). First all listeners havePageLifecycleListener.restoreStateBeforePageAttach()invoked, followed byPageLifecycleListener.containingPageDidAttach(). -
getLogger
Description copied from interface:PageReturns the logger of the root component element. Any logging about page construction or activity should be sent to this logger. -
persistFieldChange
Description copied from interface:PagePosts a change to a persistent field.- Specified by:
persistFieldChangein interfacePage- Parameters:
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 field
-
getFieldChange
Description copied from interface:PageGets a change for a field within the component.- Specified by:
getFieldChangein interfacePage- Parameters:
nestedId- the nested component id of the component containing the fieldfieldName- the name of the persistent field- Returns:
- the value, or null if no value is stored
-
discardPersistentFieldChanges
Description copied from interface:PageDiscards all persistent field changes for the page containing the component. Changes are eliminated from persistent storage (such as theSession) which will take effect in the next request (the attached page instance is not affected).- Specified by:
discardPersistentFieldChangesin interfacePage
-
getName
Description copied from interface:PageReturns the short, logical name for the page. This is the page name as it might included in an action or page render URL (though it will be converted to lower case when it is included). -
addResetCallback
Description copied from interface:PageLifecycleCallbackHubA reset occurs when a request for a page arrives that did not originate on the same page. This gives the application a chance to reset the state of the page.- Specified by:
addResetCallbackin interfacePageLifecycleCallbackHub- Parameters:
callback- invoked when a page is activated by link from some other page.
-
addResetListener
Description copied from interface:PageAdds a new listener for page reset events.- Specified by:
addResetListenerin interfacePage- Parameters:
listener- will receive notifications when the page is accessed from a different page
-
addVerifyCallback
Description copied from interface:PageLifecycleCallbackHubAdds a verify callback, which is allowed while the page is loading. Such callbacks are invoked once, after the page has been loaded successfully, and are then discarded. This was added specifically to ensure that components only verify that required parameters are bound after all components and mixins of the page have had a chance to initialize.- Specified by:
addVerifyCallbackin interfacePageLifecycleCallbackHub- Parameters:
callback- to be invoked after page loaded
-
pageReset
Description copied from interface:PageInvoked to notifyPageResetListenerlisteners. -
hasResetListeners
Description copied from interface:PageReturns true if there are anyPageResetListenerlisteners.- Specified by:
hasResetListenersin interfacePage
-
getAttachCount
Description copied from interface:PageReturns the number of times the page has been attached to a request. This is a rough measure of how important the page is, relative to other pages. This value is volatile, changing constantly.- Specified by:
getAttachCountin interfacePage
-
isExactParameterCountMatch
Description copied from interface:PageReturns true if extract parameter count matching is enabled.- Specified by:
isExactParameterCountMatchin interfacePage- See Also:
-
addPageLoadedCallback
Description copied from interface:PageLifecycleCallbackHubAdds a callback for when the page is first loaded. Callbacks are invoked in the order they are added to the page. They are invoked once and then discarded.- Specified by:
addPageLoadedCallbackin interfacePageLifecycleCallbackHub- Parameters:
callback- invoked once, when page is first loaded
-
addPageAttachedCallback
Description copied from interface:PageLifecycleCallbackHubAdds a callback for when the page is attached to the request.- Specified by:
addPageAttachedCallbackin interfacePageLifecycleCallbackHub
-
addPageDetachedCallback
Description copied from interface:PageLifecycleCallbackHubAdds a callback for when the page is detached from the request.- Specified by:
addPageDetachedCallbackin interfacePageLifecycleCallbackHub
-