Class DefaultUndoManager
- java.lang.Object
-
- de.hybris.platform.cockpit.services.undo.impl.DefaultUndoManager
-
- All Implemented Interfaces:
UndoManager
public class DefaultUndoManager extends java.lang.Object implements UndoManager
Default implementation of undo manager functionality.
-
-
Constructor Summary
Constructors Constructor Description DefaultUndoManager()DefaultUndoManager(int size)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOperation(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.intgetMaxSize()Returns the maximum undo/re-do step count.java.util.List<UndoableOperation>getRedoOperations()Returns the re-do operations in the stack's order with the most recent first.java.lang.StringgetRedoPresentationName()Returns a human readable description of the most recent re-do operationjava.util.List<UndoableOperation>getUndoOperations()Returns the undo operations in the stack's order with the most recent first.java.lang.StringgetUndoPresentationName()Returns a human readable description of the most recent undo operationUndoableOperationpeekRedoOperation()Returns the latest re-do operation without performing it.UndoableOperationpeekUndoOperation()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 Detail
-
getMaxSize
public int getMaxSize()
Returns the maximum undo/re-do step count.- Returns:
- maximum undo/re-do step count
-
addOperation
public void addOperation(UndoableOperation operation)
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
public void undo() throws CannotUndoExceptionDescription 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
public void redo() throws CannotRedoExceptionDescription 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
public UndoableOperation 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
public UndoableOperation 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
public java.util.List<UndoableOperation> 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
public java.util.List<UndoableOperation> 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
public java.lang.String 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
public java.lang.String 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.
-
-