Class DefaultUndoManager

java.lang.Object
de.hybris.platform.cockpit.services.undo.impl.DefaultUndoManager
All Implemented Interfaces:
UndoManager

public class DefaultUndoManager extends Object implements UndoManager
Default implementation of undo manager functionality.
  • 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

      public void addOperation(UndoableOperation operation)
      Description copied from interface: UndoManager
      Puts an UndoableOperation on the stack. If the stack is full the oldest UndoableOperation is removed from the stack.
      Specified by:
      addOperation in interface UndoManager
      Parameters:
      operation - the UndoableOperation operation to be put on the stack
    • canUndo

      public boolean canUndo()
      Description copied from interface: UndoManager
      Returns true if there's an undo operation and if the current undo operation can be performed, i.e its UndoableOperation.canUndo() returns true.
      Specified by:
      canUndo in interface UndoManager
      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: UndoManager
      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.
      Specified by:
      canRedo in interface UndoManager
      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 CannotUndoException
      Description copied from interface: UndoManager
      Undoes the latest operation. Puts the UndoOperation on the re-do stack.
      Specified by:
      undo in interface UndoManager
      Throws:
      CannotUndoException - if there is no UndoOperation or if the latest operation cannot be undone
    • redo

      public void redo() throws CannotRedoException
      Description copied from interface: UndoManager
      Re-does the last undo operation, removes it from the re-do stack and puts it on the undo stack.
      Specified by:
      redo in interface UndoManager
      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: UndoManager
      Returns the latest undo operation without performing it.
      Specified by:
      peekUndoOperation in interface UndoManager
      Returns:
      latest undo operation without performing it
    • peekRedoOperation

      public UndoableOperation peekRedoOperation()
      Description copied from interface: UndoManager
      Returns the latest re-do operation without performing it.
      Specified by:
      peekRedoOperation in interface UndoManager
      Returns:
      latest re-do operation without performing it
    • getUndoOperations

      public List<UndoableOperation> getUndoOperations()
      Description copied from interface: UndoManager
      Returns the undo operations in the stack's order with the most recent first.
      Specified by:
      getUndoOperations in interface UndoManager
      Returns:
      undo operations in the stack's order with the most recent first
    • getRedoOperations

      public List<UndoableOperation> getRedoOperations()
      Description copied from interface: UndoManager
      Returns the re-do operations in the stack's order with the most recent first.
      Specified by:
      getRedoOperations in interface UndoManager
      Returns:
      re-do operations in the stack's order with the most recent first
    • getUndoPresentationName

      public String getUndoPresentationName()
      Description copied from interface: UndoManager
      Returns a human readable description of the most recent undo operation
      Specified by:
      getUndoPresentationName in interface UndoManager
      Returns:
      human readable description of the most recent undo operation
    • getRedoPresentationName

      public String getRedoPresentationName()
      Description copied from interface: UndoManager
      Returns a human readable description of the most recent re-do operation
      Specified by:
      getRedoPresentationName in interface UndoManager
      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.