Interface UndoManager

    • Method Detail

      • undo

        void undo()
           throws CannotUndoException
        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 its UndoableOperation.canUndo() returns true.
        Returns:
        true if there's an undo operation and if the current undo operation can be performed, false otherwise
      • redo

        void redo()
           throws CannotRedoException
        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 its UndoableOperation.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

        void addOperation​(UndoableOperation operation)
        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

        java.util.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

        java.util.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

        java.lang.String getUndoPresentationName()
        Returns a human readable description of the most recent undo operation
        Returns:
        human readable description of the most recent undo operation
      • getRedoPresentationName

        java.lang.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