org.apache.tapestry.engine
Interface IPageRecorder

All Superinterfaces:
ChangeObserver
All Known Implementing Classes:
PageRecorder, SessionPageRecorder

public interface IPageRecorder
extends ChangeObserver

Defines an object that can observe changes to properties of a page and its components, store the state of the page between request cycles, and restore a page's state on a subsequent request cycle.

Concrete implementations of this can store the changes in memory, as client-side cookies, in a flat file, or in a database.

Version:
$Id: IPageRecorder.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship

Method Summary
 void commit()
          Persists all changes that have been accumulated.
 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 markForDiscard().
 Collection getChanges()
          Returns a Collection of IPageChange objects that represent the persistant state of the page.
 boolean getHasChanges()
          Returns true if the recorder has any changes for the page.
 void initialize(String pageName, IRequestCycle cycle)
          Invoked after the recorder is instantiated to initialize it for the current request cycle.
 boolean isDirty()
          Returns true if the recorder has observed any changes that have not been committed to external storage.
 boolean isLocked()
          Returns true if the recorder is in a locked state, following a commit().
 boolean isMarkedForDiscard()
          Returns true if the recorder has been marked for discard.
 void markForDiscard()
          Invoked to mark the recorder for discarding at the end of the request cycle.
 void rollback(IPage page)
          Rolls back the page to the currently persisted state.
 void setLocked(boolean value)
          Invoked to lock or unlock the recorder.
 
Methods inherited from interface org.apache.tapestry.event.ChangeObserver
observeChange
 

Method Detail

initialize

void initialize(String pageName,
                IRequestCycle cycle)
Invoked after the recorder is instantiated to initialize it for the current request cycle.

Parameters:
pageName - the fully qualified page name
cycle - the current request cycle
Since:
3.0

discard

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 markForDiscard().

Since:
3.0

commit

void commit()
Persists all changes that have been accumulated. If the recorder saves change incrementally, this should ensure that all changes have been persisted.

After commiting, a page recorder automatically locks itself.


getChanges

Collection getChanges()
Returns a Collection of IPageChange objects that represent the persistant state of the page.


getHasChanges

boolean getHasChanges()
Returns true if the recorder has any changes for the page.


isDirty

boolean isDirty()
Returns true if the recorder has observed any changes that have not been committed to external storage.


isLocked

boolean isLocked()
Returns true if the recorder is in a locked state, following a commit().


rollback

void rollback(IPage page)
Rolls back the page to the currently persisted state.

A page recorder can only rollback changes to properties which have changed at some point. This can cause some minor problems, addressed by PageDetachListener.pageDetached(org.apache.tapestry.event.PageEvent).


setLocked

void setLocked(boolean value)
Invoked to lock or unlock the recorder. Recoders are locked after they are commited, and stay locked until explicitly unlocked in a subsequent request cycle.


markForDiscard

void markForDiscard()
Invoked to mark the recorder for discarding at the end of the request cycle.

Since:
2.0.2

isMarkedForDiscard

boolean isMarkedForDiscard()
Returns true if the recorder has been marked for discard.