org.apache.tapestry5.internal.structure
Class PageImpl

java.lang.Object
  extended by org.apache.tapestry5.internal.structure.PageImpl
All Implemented Interfaces:
Page

public class PageImpl
extends Object
implements Page


Constructor Summary
PageImpl(String name, Locale locale, PersistentFieldManager persistentFieldManager)
           
 
Method Summary
 void addLifecycleListener(PageLifecycleListener listener)
          Adds a listener that is notified of large scale page events.
 void attached()
          Invoked to inform the page that it is attached to the current request.
 void decrementDirtyCount()
          Called as a component finishes rendering itself.
 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.
 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.
 Locale getLocale()
          The locale for which the page is localized.
 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.
 void incrementDirtyCount()
          Called as a component initially starts to render itself.
 void loaded()
          Inform the page that it is now completely loaded.
 void persistFieldChange(ComponentResources resources, String fieldName, Object newValue)
          Posts a change to a persistent field.
 void setRootElement(ComponentPageElement component)
          Invoked during page construction time to connect the page's root component to the page instance.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageImpl

public PageImpl(String name,
                Locale locale,
                PersistentFieldManager persistentFieldManager)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getComponentElementByNestedId

public ComponentPageElement getComponentElementByNestedId(String nestedId)
Description copied from interface: Page
Retrieves 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:
getComponentElementByNestedId in interface Page

getLocale

public Locale getLocale()
Description copied from interface: Page
The locale for which the page is localized. This is set when the page is created and does not change.

Specified by:
getLocale in interface Page

setRootElement

public void setRootElement(ComponentPageElement component)
Description copied from interface: Page
Invoked during page construction time to connect the page's root component to the page instance.

Specified by:
setRootElement in interface Page

getRootElement

public ComponentPageElement getRootElement()
Description copied from interface: Page
The root component of the page. This is the wrapper around the end developer's view of the page.

Specified by:
getRootElement in interface Page

getRootComponent

public Component getRootComponent()
Description copied from interface: Page
The root component of the page. A convenience over invoking getRootElement().getComponent().

Specified by:
getRootComponent in interface Page

addLifecycleListener

public void addLifecycleListener(PageLifecycleListener listener)
Description copied from interface: Page
Adds a listener that is notified of large scale page events.

Specified by:
addLifecycleListener in interface Page

detached

public boolean detached()
Description copied from interface: Page
Invoked 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 containingPageDidDetech().

The page pool should discard pages that are dirty, rather than store them into the pool.

Specified by:
detached in interface Page
Returns:
true if the page is "dirty", false otherwise
See Also:
PageLifecycleListener.containingPageDidDetach()

loaded

public void loaded()
Description copied from interface: Page
Inform the page that it is now completely loaded.

Specified by:
loaded in interface Page
See Also:
PageLifecycleListener.containingPageDidLoad()

attached

public void attached()
Description copied from interface: Page
Invoked 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 to Page.loaded() will preceded the call to Page.attached().

Specified by:
attached in interface Page

getLogger

public org.slf4j.Logger getLogger()
Description copied from interface: Page
Returns the logger of the root component element. Any logging about page construction or activity should be sent to this logger.

Specified by:
getLogger in interface Page

persistFieldChange

public void persistFieldChange(ComponentResources resources,
                               String fieldName,
                               Object newValue)
Description copied from interface: Page
Posts a change to a persistent field.

Specified by:
persistFieldChange in interface Page
Parameters:
resources - the component resources for the component or mixin containing the field whose value changed
fieldName - the name of the field
newValue - the new value for the field

getFieldChange

public Object getFieldChange(String nestedId,
                             String fieldName)
Description copied from interface: Page
Gets a change for a field within the component.

Specified by:
getFieldChange in interface Page
Parameters:
nestedId - the nested component id of the component containing the field
fieldName - the name of the persistent field
Returns:
the value, or null if no value is stored

decrementDirtyCount

public void decrementDirtyCount()
Description copied from interface: Page
Called as a component finishes rendering itself.

Specified by:
decrementDirtyCount in interface Page

discardPersistentFieldChanges

public void discardPersistentFieldChanges()
Description copied from interface: Page
Discards all persistent field changes for the page containing the component. Changes are eliminated from persistent storage (such as the Session) which will take effect in the next request (the attached page instance is not affected).

Specified by:
discardPersistentFieldChanges in interface Page

incrementDirtyCount

public void incrementDirtyCount()
Description copied from interface: Page
Called as a component initially starts to render itself. This is used to check for the cases where a component causes a runtime exception that aborts the render early, leaving the page in an invalid state.

Specified by:
incrementDirtyCount in interface Page

getName

public String getName()
Description copied from interface: Page
Returns 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).

Specified by:
getName in interface Page


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.