Interface UndoManager
- All Known Implementing Classes:
BundleUndoManager,DefaultUndoManager
public interface UndoManager
Manages
UndoableOperations. You add such an operation with addOperation(UndoableOperation) and it is
put on a stack. To perform the latest undo call undo(). The operation is then put on the re-do stack. To
re-do the latest undone operation call redo().-
Method Summary
Modifier and TypeMethodDescriptionvoidaddOperation(UndoableOperation operation) Puts an UndoableOperation on the stack.booleancanRedo()Returns true if there's an re-do operation and if the current re-do operation can be performed i.e itsUndoableOperation.canRedo()returns true.booleancanUndo()Returns true if there's an undo operation and if the current undo operation can be performed, i.e itsUndoableOperation.canUndo()returns true.Returns the re-do operations in the stack's order with the most recent first.Returns a human readable description of the most recent re-do operationReturns the undo operations in the stack's order with the most recent first.Returns a human readable description of the most recent undo operationReturns the latest re-do operation without performing it.Returns the latest undo operation without performing it.voidredo()Re-does the last undo operation, removes it from the re-do stack and puts it on the undo stack.voidundo()Undoes the latest operation.
-
Method Details
-
undo
Undoes the latest operation. Puts the UndoOperation on the re-do stack.- Throws:
CannotUndoException- if there is no UndoOperation or if the latest operation cannot be undone
-
canUndo
boolean canUndo()Returns true if there's an undo operation and if the current undo operation can be performed, i.e itsUndoableOperation.canUndo()returns true.- Returns:
- true if there's an undo operation and if the current undo operation can be performed, false otherwise
-
redo
Re-does the last undo operation, removes it from the re-do stack and puts it on the undo stack.- Throws:
CannotRedoException- if there is no re-do operation on the stack or the current re-do operation cannot be performed
-
canRedo
boolean canRedo()Returns true if there's an re-do operation and if the current re-do operation can be performed i.e itsUndoableOperation.canRedo()returns true.- Returns:
- true if there's an re-do operation and if the current re-do operation can be performed, false otherwise
-
addOperation
Puts an UndoableOperation on the stack. If the stack is full the oldest UndoableOperation is removed from the stack.- Parameters:
operation- the UndoableOperation operation to be put on the stack
-
peekUndoOperation
UndoableOperation peekUndoOperation()Returns the latest undo operation without performing it.- Returns:
- latest undo operation without performing it
-
peekRedoOperation
UndoableOperation peekRedoOperation()Returns the latest re-do operation without performing it.- Returns:
- latest re-do operation without performing it
-
getUndoOperations
List<UndoableOperation> getUndoOperations()Returns the undo operations in the stack's order with the most recent first.- Returns:
- undo operations in the stack's order with the most recent first
-
getRedoOperations
List<UndoableOperation> getRedoOperations()Returns the re-do operations in the stack's order with the most recent first.- Returns:
- re-do operations in the stack's order with the most recent first
-
getUndoPresentationName
String getUndoPresentationName()Returns a human readable description of the most recent undo operation- Returns:
- human readable description of the most recent undo operation
-
getRedoPresentationName
String getRedoPresentationName()Returns a human readable description of the most recent re-do operation- Returns:
- human readable description of the most recent re-do operation
-