|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Page
Represents a unique page within the application. Pages are part of the internal structure of a Tapestry
application; end developers who refer to "page" are really referring to the root
component
of the actual page.
PerthreadManager
. Page construction time is considered to extend past the
page loaded callback. This is not quite perfect from a
threading point-of-view (arguably, even write-once-read-many fields should be protected by synchronized blocks or
other mechanisms). At best, we can be assured that the entire page construction phase is protected by a single
synchronized block (but not on the page itself). An ideal system would build the page bottom to top so that all
assignments could take place in constructors, assigning to final fields. Maybe some day.
The Page object is never visible to end-user code, though it exposes an interface (PageLifecycleCallbackHub
that
is).
Nested Class Summary | |
---|---|
static class |
Page.Stats
Page construction statistics for the page. |
Method Summary | |
---|---|
void |
addLifecycleListener(PageLifecycleListener listener)
Deprecated. in 5.3.4; use PageLifecycleCallbackHub.addPageLoadedCallback(Runnable) , PageLifecycleCallbackHub.addPageAttachedCallback(Runnable) , or
PageLifecycleCallbackHub.addPageDetachedCallback(Runnable) instead |
void |
addResetListener(PageResetListener listener)
Deprecated. in 5.3.4, |
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. |
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)
Deprecated. in 5.3.4, due to introduction of PageLifecycleCallbackHub.addPageLoadedCallback(Runnable) |
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. |
Methods inherited from interface org.apache.tapestry5.runtime.PageLifecycleCallbackHub |
---|
addPageAttachedCallback, addPageDetachedCallback, addPageLoadedCallback, addResetCallback, addVerifyCallback |
Method Detail |
---|
String getName()
ComponentResourceSelector getSelector()
void setRootElement(ComponentPageElement component)
ComponentPageElement getRootElement()
Component getRootComponent()
boolean detached()
PerthreadManager
. A future release of Tapestry will likely convert this method to
type void.
PageLifecycleListener.containingPageDidDetach()
void attached()
loaded()
will preceded the call to attached()
.
First all listeners have PageLifecycleListener.restoreStateBeforePageAttach()
invoked, followed by
PageLifecycleListener.containingPageDidAttach()
.
void loaded()
PageLifecycleListener.containingPageDidLoad()
void addLifecycleListener(PageLifecycleListener listener)
PageLifecycleCallbackHub.addPageLoadedCallback(Runnable)
, PageLifecycleCallbackHub.addPageAttachedCallback(Runnable)
, or
PageLifecycleCallbackHub.addPageDetachedCallback(Runnable)
instead
void removeLifecycleListener(PageLifecycleListener listener)
PageLifecycleCallbackHub.addPageLoadedCallback(Runnable)
org.slf4j.Logger getLogger()
ComponentPageElement getComponentElementByNestedId(String nestedId)
IllegalArgumentException
- if the nestedId does not correspond to a componentvoid persistFieldChange(ComponentResources resources, String fieldName, Object newValue)
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 fieldObject getFieldChange(String nestedId, String fieldName)
nestedId
- the nested component id of the component containing the fieldfieldName
- the name of the persistent field
void discardPersistentFieldChanges()
Session
) which will
take effect in the next request (the attached page instance is not affected).
void addResetListener(PageResetListener listener)
listener
- will receive notifications when the page is accessed from a different pageboolean hasResetListeners()
PageResetListener
listeners.
void pageReset()
PageResetListener
listeners.
void setStats(Page.Stats stats)
Page.Stats getStats()
int getAttachCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |