org.apache.tapestry.record
Class SessionPageRecorder

java.lang.Object
  |
  +--org.apache.tapestry.record.PageRecorder
        |
        +--org.apache.tapestry.record.SessionPageRecorder
All Implemented Interfaces:
ChangeObserver, IPageRecorder

public class SessionPageRecorder
extends PageRecorder

Simple implementation of org.apache.tapestry.IPageRecorder that stores page changes as HttpSession attributes.

Version:
$Id: SessionPageRecorder.java,v 1.4 2003/04/21 13:15:41 glongman Exp $
Author:
Howard Ship

Constructor Summary
SessionPageRecorder()
           
 
Method Summary
 void commit()
          Simply clears the dirty flag, because there is no external place to store changed page properties.
 void discard()
          Invoked at the end of a request cycle in which the page recorder is discarded (either implicitly, because the page recorder has no changes, or explicitly because of IEngine#forgetPage(String) or PageRecorder.markForDiscard().
 Collection getChanges()
          Returns a Collection of org.apache.tapestry.IPageChange objects identifying changes to the page and its components.
 boolean getHasChanges()
          Returns true if the recorder has any changes recorded.
 void initialize(String pageName, IRequestCycle cycle)
          Invoked after the recorder is instantiated to initialize it for the current request cycle.
protected  void recordChange(String componentPath, String propertyName, Object newValue)
          Records a change to a particular component.
 
Methods inherited from class org.apache.tapestry.record.PageRecorder
getDirty, isDirty, isLocked, isMarkedForDiscard, markForDiscard, observeChange, rollback, setDirty, setLocked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionPageRecorder

public SessionPageRecorder()
Method Detail

initialize

public void initialize(String pageName,
                       IRequestCycle cycle)
Description copied from interface: IPageRecorder
Invoked after the recorder is instantiated to initialize it for the current request cycle.
Following copied from interface: org.apache.tapestry.engine.IPageRecorder
Parameters:
pageName - the fully qualified page name
cycle - the current request cycle

discard

public void discard()
Description copied from interface: IPageRecorder
Invoked at the end of a request cycle in which the page recorder is discarded (either implicitly, because the page recorder has no changes, or explicitly because of IEngine#forgetPage(String) or IPageRecorder.markForDiscard().

commit

public void commit()
Simply clears the dirty flag, because there is no external place to store changed page properties. Sets the locked flag to prevent subsequent changes from occuring now.
Overrides:
commit in class PageRecorder

getHasChanges

public boolean getHasChanges()
Returns true if the recorder has any changes recorded.

getChanges

public Collection getChanges()
Description copied from class: PageRecorder
Returns a Collection of org.apache.tapestry.IPageChange objects identifying changes to the page and its components.
Overrides:
getChanges in class PageRecorder

recordChange

protected void recordChange(String componentPath,
                            String propertyName,
                            Object newValue)
Description copied from class: PageRecorder
Records a change to a particular component. Subclasses may cache these in memory, or record them externally at this time.

This method is responsible for setting the dirty flag if the described change is real.

Overrides:
recordChange in class PageRecorder
Following copied from class: org.apache.tapestry.record.PageRecorder
Parameters:
componentPath - the name of the component relative to the page which contains it. May be null if the change was to a property of the page itself.
propertyName - the name of the property which changed.
newValue - the new value for the property, which may also be null.
See Also:
IComponent.getIdPath()