Class MementoBasedUndoableEdit
java.lang.Object
com.levigo.jadice.web.client.undo.AbstractUndoableEdit
com.levigo.jadice.web.client.undo.MementoBasedUndoableEdit
- All Implemented Interfaces:
UndoableEdit
An
UndoableEdit using two Memento, one from before and one after the edit.-
Constructor Summary
ConstructorsConstructorDescriptionMementoBasedUndoableEdit(String description, Object mergeKey, org.jadice.util.base.Memento before, org.jadice.util.base.Memento after) Create a memento-based undoable edit from the given menentos and the description of the edit. -
Method Summary
Modifier and TypeMethodDescriptionReturn a presentation name fragment suitable for use both in an "undo something" and "redo something" style phrase.voidredo()Re-do the edit.booleantryMergeInto(UndoableEdit anEdit) Determine whether the given edit can be merged into this edit.voidundo()Undo the edit.protected voidupdateAfterState(MementoBasedUndoableEdit newEdit) Methods inherited from class com.levigo.jadice.web.client.undo.AbstractUndoableEdit
getRedoDescription, getUndoDescriptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.levigo.jadice.web.client.undo.UndoableEdit
canRedo, canUndo, discard
-
Constructor Details
-
MementoBasedUndoableEdit
public MementoBasedUndoableEdit(String description, Object mergeKey, org.jadice.util.base.Memento before, org.jadice.util.base.Memento after) Create a memento-based undoable edit from the given menentos and the description of the edit. If non-null, the merge key is used to determine mergeability of two memento-based undoable edits: if they have the same merge key, as merge is performed by replacing the old after-memento with the new after-memento.- Parameters:
description- the description of the editmergeKey- the merge key ornullif this edit can never be merged with another onebefore- the before memento (used for undo)after- the after memento (used for redo)
-
-
Method Details
-
tryMergeInto
Description copied from interface:UndoableEditDetermine whether the given edit can be merged into this edit. If it can, merge the edit and returntrue, otherwise do nothing and returnfalse.- Parameters:
anEdit- the edit that should possible be merged into this edit- Returns:
trueif this edit could be merged,falseotherwise
-
getDescription
Description copied from class:AbstractUndoableEditReturn a presentation name fragment suitable for use both in an "undo something" and "redo something" style phrase.- Specified by:
getDescriptionin classAbstractUndoableEdit- Returns:
- a "something" fragment
-
undo
Description copied from interface:UndoableEditUndo the edit.- Throws:
CannotUndoException- if this edit can not be undone
-
redo
Description copied from interface:UndoableEditRe-do the edit.- Throws:
CannotRedoException- if this edit can not be re-done
-
updateAfterState
-