Class DefaultUndoManager
java.lang.Object
de.hybris.platform.cockpit.services.undo.impl.DefaultUndoManager
- All Implemented Interfaces:
UndoManager
Default implementation of undo manager functionality.
-
Constructor Summary
Constructors -
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.voidclear()Removes all undo/re-do operations and resets its state.intReturns the maximum undo/re-do step count.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.
-
Constructor Details
-
DefaultUndoManager
public DefaultUndoManager() -
DefaultUndoManager
public DefaultUndoManager(int size) Constructor.- Parameters:
size- the maximum size of undo/re-do stack
-
-
Method Details
-
getMaxSize
public int getMaxSize()Returns the maximum undo/re-do step count.- Returns:
- maximum undo/re-do step count
-
addOperation
Description copied from interface:UndoManagerPuts an UndoableOperation on the stack. If the stack is full the oldest UndoableOperation is removed from the stack.- Specified by:
addOperationin interfaceUndoManager- Parameters:
operation- the UndoableOperation operation to be put on the stack
-
canUndo
public boolean canUndo()Description copied from interface:UndoManagerReturns true if there's an undo operation and if the current undo operation can be performed, i.e itsUndoableOperation.canUndo()returns true.- Specified by:
canUndoin interfaceUndoManager- Returns:
- true if there's an undo operation and if the current undo operation can be performed, false otherwise
-
canRedo
public boolean canRedo()Description copied from interface:UndoManagerReturns true if there's an re-do operation and if the current re-do operation can be performed i.e itsUndoableOperation.canRedo()returns true.- Specified by:
canRedoin interfaceUndoManager- Returns:
- true if there's an re-do operation and if the current re-do operation can be performed, false otherwise
-
undo
Description copied from interface:UndoManagerUndoes the latest operation. Puts the UndoOperation on the re-do stack.- Specified by:
undoin interfaceUndoManager- Throws:
CannotUndoException- if there is no UndoOperation or if the latest operation cannot be undone
-
redo
Description copied from interface:UndoManagerRe-does the last undo operation, removes it from the re-do stack and puts it on the undo stack.- Specified by:
redoin interfaceUndoManager- Throws:
CannotRedoException- if there is no re-do operation on the stack or the current re-do operation cannot be performed
-
peekUndoOperation
Description copied from interface:UndoManagerReturns the latest undo operation without performing it.- Specified by:
peekUndoOperationin interfaceUndoManager- Returns:
- latest undo operation without performing it
-
peekRedoOperation
Description copied from interface:UndoManagerReturns the latest re-do operation without performing it.- Specified by:
peekRedoOperationin interfaceUndoManager- Returns:
- latest re-do operation without performing it
-
getUndoOperations
Description copied from interface:UndoManagerReturns the undo operations in the stack's order with the most recent first.- Specified by:
getUndoOperationsin interfaceUndoManager- Returns:
- undo operations in the stack's order with the most recent first
-
getRedoOperations
Description copied from interface:UndoManagerReturns the re-do operations in the stack's order with the most recent first.- Specified by:
getRedoOperationsin interfaceUndoManager- Returns:
- re-do operations in the stack's order with the most recent first
-
getUndoPresentationName
Description copied from interface:UndoManagerReturns a human readable description of the most recent undo operation- Specified by:
getUndoPresentationNamein interfaceUndoManager- Returns:
- human readable description of the most recent undo operation
-
getRedoPresentationName
Description copied from interface:UndoManagerReturns a human readable description of the most recent re-do operation- Specified by:
getRedoPresentationNamein interfaceUndoManager- Returns:
- human readable description of the most recent re-do operation
-
clear
public void clear()Removes all undo/re-do operations and resets its state.
-