Class DefaultUndoManager
java.lang.Object
com.levigo.jadice.web.client.undo.DefaultUndoManager
- All Implemented Interfaces:
UndoManager
A default implementation of
UndoManager
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
addEdit
(UndoableEdit anEdit) Add an undoable edit to the undo stack.void
Adds a handler that is called whenever the undo/redo item lists are updated.boolean
canRedo()
Determine whether there is currently something to redo.boolean
canUndo()
Determine whether there is currently something to undo.void
clear()
Clear the undo and redo stacks.void
Removes all handlers that are called whenever the undo/redo item lists are updated.int
getLimit()
Get the maximum size of the undo and redo stacks.Get the human-readable description of the edit at the top of the redo stack.Get the human-readable description of the edit at the top of the undo stack.protected UndoableEdit
nextRedo()
protected UndoableEdit
nextUndo()
void
redo()
Redo the edit at the top of the redo stack.void
Removes a handler that is called whenever the undo/redo item lists are updated.void
setLimit
(int l) Set the maximum size of the undo and redo stacks.void
undo()
Undo the edit at the top of the undo stack.
-
Constructor Details
-
DefaultUndoManager
public DefaultUndoManager()
-
-
Method Details
-
clear
public void clear()Description copied from interface:UndoManager
Clear the undo and redo stacks.- Specified by:
clear
in interfaceUndoManager
-
getLimit
public int getLimit()Get the maximum size of the undo and redo stacks.- Returns:
- the maximum number of edits on the stacks
-
setLimit
public void setLimit(int l) Set the maximum size of the undo and redo stacks.- Parameters:
l
- the limit
-
nextUndo
-
nextRedo
-
undo
Description copied from interface:UndoManager
Undo the edit at the top of the undo stack.- Specified by:
undo
in interfaceUndoManager
- Throws:
CannotUndoException
- if the stack is empty or the edit cannot be undone for some other reason.
-
canUndo
public boolean canUndo()Description copied from interface:UndoManager
Determine whether there is currently something to undo.- Specified by:
canUndo
in interfaceUndoManager
- Returns:
true
if there is
-
redo
Description copied from interface:UndoManager
Redo the edit at the top of the redo stack.- Specified by:
redo
in interfaceUndoManager
- Throws:
CannotRedoException
- if the stack is empty or the edit cannot be re-done for some other reason.
-
canRedo
public boolean canRedo()Description copied from interface:UndoManager
Determine whether there is currently something to redo.- Specified by:
canRedo
in interfaceUndoManager
- Returns:
true
if there is
-
addEdit
Description copied from interface:UndoManager
Add an undoable edit to the undo stack. This can happen in one of two ways:- The edit could not be merged into the element currently at the top of the stack either
because the stack was empty or because the
UndoableEdit.tryMergeInto(UndoableEdit)
returnedfalse
. In this case the new edit is simply added to the stack. - The edit could me berged.
- Specified by:
addEdit
in interfaceUndoManager
- Parameters:
anEdit
- the edit- Returns:
true
if the edit was merged into the edit at the top of the stack,false
otherwise.
- The edit could not be merged into the element currently at the top of the stack either
because the stack was empty or because the
-
getUndoDescription
Description copied from interface:UndoManager
Get the human-readable description of the edit at the top of the undo stack. It is provided by delegating toUndoableEdit.getUndoDescription()
.- Specified by:
getUndoDescription
in interfaceUndoManager
- Returns:
- the description or
null
if the undo stack is empty.
-
getRedoDescription
Description copied from interface:UndoManager
Get the human-readable description of the edit at the top of the redo stack. It is provided by delegating toUndoableEdit.getRedoDescription()
.- Specified by:
getRedoDescription
in interfaceUndoManager
- Returns:
- the description or
null
if the redo stack is empty.
-
addOnUndoStackUpdatedHandler
Description copied from interface:UndoManager
Adds a handler that is called whenever the undo/redo item lists are updated.- Specified by:
addOnUndoStackUpdatedHandler
in interfaceUndoManager
- Parameters:
handler
- The handler to add.
-
removeOnUndoStackUpdatedHandler
Description copied from interface:UndoManager
Removes a handler that is called whenever the undo/redo item lists are updated.- Specified by:
removeOnUndoStackUpdatedHandler
in interfaceUndoManager
- Parameters:
handler
- The handler to remove.
-
clearOnUndoStackUpdateHandlers
public void clearOnUndoStackUpdateHandlers()Description copied from interface:UndoManager
Removes all handlers that are called whenever the undo/redo item lists are updated.- Specified by:
clearOnUndoStackUpdateHandlers
in interfaceUndoManager
-