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.void
redo()
Re-do the edit.boolean
tryMergeInto
(UndoableEdit anEdit) Determine whether the given edit can be merged into this edit.void
undo()
Undo the edit.protected void
updateAfterState
(MementoBasedUndoableEdit newEdit) Methods inherited from class com.levigo.jadice.web.client.undo.AbstractUndoableEdit
getRedoDescription, getUndoDescription
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 ornull
if 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:UndoableEdit
Determine 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:
true
if this edit could be merged,false
otherwise
-
getDescription
Description copied from class:AbstractUndoableEdit
Return a presentation name fragment suitable for use both in an "undo something" and "redo something" style phrase.- Specified by:
getDescription
in classAbstractUndoableEdit
- Returns:
- a "something" fragment
-
undo
Description copied from interface:UndoableEdit
Undo the edit.- Throws:
CannotUndoException
- if this edit can not be undone
-
redo
Description copied from interface:UndoableEdit
Re-do the edit.- Throws:
CannotRedoException
- if this edit can not be re-done
-
updateAfterState
-