Class UndoCaretaker


  • public class UndoCaretaker
    extends Object
    Undo caretaker implementation for the Viewer RI. Currently only annotation can be manipulate but this class can easily handle any class that implements the Memento interfce.
    Since:
    4.0
    • Constructor Detail

      • UndoCaretaker

        public UndoCaretaker()
    • Method Detail

      • undo

        public Memento undo()
        Undo the last state change. Only possible if there are items in the undo history list.
      • isUndo

        public boolean isUndo()
        Gets the status of the undo command.
        Returns:
        true if an undo command is possible, false if undo can not be done.
      • redo

        public Memento redo()
        Redo the last state change. ONly possible if there have been previous undo call.
      • isRedo

        public boolean isRedo()
        Gets the status of the redo command.
        Returns:
        true if an redo command is possible, false if the redo can not be done.
      • addState

        public void addState​(Memento previousState,
                             Memento newState)
        Adds the give states to the history list.
        Parameters:
        previousState - previous state
        newState - new state.