public class DefaultUndoManager extends Object implements UndoManager
| Constructor and Description |
|---|
DefaultUndoManager() |
DefaultUndoManager(int size)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOperation(UndoableOperation operation)
Puts an UndoableOperation on the stack.
|
boolean |
canRedo()
Returns true if there's an re-do operation and if the current re-do operation can be performed i.e its
UndoableOperation.canRedo() returns true. |
boolean |
canUndo()
Returns true if there's an undo operation and if the current undo operation can be performed, i.e its
UndoableOperation.canUndo() returns true. |
void |
clear()
Removes all undo/re-do operations and resets its state.
|
int |
getMaxSize()
Returns the maximum undo/re-do step count.
|
List<UndoableOperation> |
getRedoOperations()
Returns the re-do operations in the stack's order with the most recent first.
|
String |
getRedoPresentationName()
Returns a human readable description of the most recent re-do operation
|
List<UndoableOperation> |
getUndoOperations()
Returns the undo operations in the stack's order with the most recent first.
|
String |
getUndoPresentationName()
Returns a human readable description of the most recent undo operation
|
UndoableOperation |
peekRedoOperation()
Returns the latest re-do operation without performing it.
|
UndoableOperation |
peekUndoOperation()
Returns the latest undo operation without performing it.
|
void |
redo()
Re-does the last undo operation, removes it from the re-do stack and puts it on the undo stack.
|
void |
undo()
Undoes the latest operation.
|
public DefaultUndoManager()
public DefaultUndoManager(int size)
size - the maximum size of undo/re-do stackpublic int getMaxSize()
public void addOperation(UndoableOperation operation)
UndoManageraddOperation in interface UndoManageroperation - the UndoableOperation operation to be put on the stackpublic boolean canUndo()
UndoManagerUndoableOperation.canUndo() returns true.canUndo in interface UndoManagerpublic boolean canRedo()
UndoManagerUndoableOperation.canRedo() returns true.canRedo in interface UndoManagerpublic void undo()
throws CannotUndoException
UndoManagerundo in interface UndoManagerCannotUndoException - if there is no UndoOperation or if the latest operation cannot be undonepublic void redo()
throws CannotRedoException
UndoManagerredo in interface UndoManagerCannotRedoException - if there is no re-do operation on the stack or the current re-do operation cannot be performedpublic UndoableOperation peekUndoOperation()
UndoManagerpeekUndoOperation in interface UndoManagerpublic UndoableOperation peekRedoOperation()
UndoManagerpeekRedoOperation in interface UndoManagerpublic List<UndoableOperation> getUndoOperations()
UndoManagergetUndoOperations in interface UndoManagerpublic List<UndoableOperation> getRedoOperations()
UndoManagergetRedoOperations in interface UndoManagerpublic String getUndoPresentationName()
UndoManagergetUndoPresentationName in interface UndoManagerpublic String getRedoPresentationName()
UndoManagergetRedoPresentationName in interface UndoManagerpublic void clear()
Copyright © 2017 SAP SE. All Rights Reserved.