|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry.record.PageRecorder
public abstract class PageRecorder
Tracks changes to components on a page, allowing changes to be persisted across request cycles, and restoring the state of a page and component when needed.
This is an abstract implementation; specific implementations can choose where and how to persist the data.
Constructor Summary | |
---|---|
PageRecorder()
|
Method Summary | |
---|---|
abstract void |
commit()
Invoked to persist all changes that have been accumulated. |
abstract Collection |
getChanges()
Returns a Collection of
IPageChange objects
identifying changes to the page and its components. |
protected boolean |
getDirty()
|
boolean |
isDirty()
Returns true if the page has observed a change. |
boolean |
isLocked()
Returns true if the recorder is locked. |
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 |
observeChange(ObservedChangeEvent event)
Observes the change. |
protected abstract void |
recordChange(String componentPath,
String propertyName,
Object newValue)
Records a change to a particular component. |
void |
rollback(IPage page)
Rolls back the page to the currently persisted state. |
protected void |
setDirty(boolean dirty)
|
void |
setLocked(boolean value)
Invoked to lock or unlock the recorder. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.tapestry.engine.IPageRecorder |
---|
discard, getHasChanges, initialize |
Constructor Detail |
---|
public PageRecorder()
Method Detail |
---|
public abstract void commit()
Subclasses should check the dirty flag. If the recorder is dirty, changes should be recorded and the dirty flag cleared.
commit
in interface IPageRecorder
public abstract Collection getChanges()
Collection
of
IPageChange
objects
identifying changes to the page and its components.
getChanges
in interface IPageRecorder
public boolean isDirty()
commit()
.
isDirty
in interface IPageRecorder
public boolean isLocked()
commit()
.
isLocked
in interface IPageRecorder
public void setLocked(boolean value)
IPageRecorder
setLocked
in interface IPageRecorder
public void observeChange(ObservedChangeEvent event)
IComponent
. Ignores the change if not active,
otherwise, sets invokes recordChange(String, String,
Object)
.
If the property name in the event is null, then the recorder
is marked dirty (but
recordChange(String, String,
Object)
is not invoked. This is how a "distant" property changes
are propogated to the page recorder (a distant property change is a change to
a property of an object that is itself a property of the page).
If the recorder is not active (typically, when a page is being rewound), then the event is simply ignored.
observeChange
in interface ChangeObserver
protected abstract void recordChange(String componentPath, String propertyName, Object newValue)
This method is responsible for setting the dirty flag if the described change is real.
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.IComponent.getIdPath()
public void rollback(IPage page)
rollback
in interface IPageRecorder
public boolean isMarkedForDiscard()
IPageRecorder
isMarkedForDiscard
in interface IPageRecorder
public void markForDiscard()
IPageRecorder
markForDiscard
in interface IPageRecorder
protected void setDirty(boolean dirty)
protected boolean getDirty()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |