Class UndoRedoManager

java.lang.Object
lu.kbra.modelizer_next.history.UndoRedoManager

public class UndoRedoManager extends Object
Manages the document snapshot history and exposes undo/redo navigation.
  • Constructor Details

    • UndoRedoManager

      public UndoRedoManager()
  • Method Details

    • canRedo

      public boolean canRedo()
      Checks whether this object can redo.
      Returns:
      true if the operation is allowed; otherwise false
    • canUndo

      public boolean canUndo()
      Checks whether this object can undo.
      Returns:
      true if the operation is allowed; otherwise false
    • recordState

      public void recordState(ModelDocument document)
      Records the state in history.
      Parameters:
      document - document to read or modify
    • redo

      public boolean redo(ModelDocument document)
      Restores the next snapshot in the redo history.
      Parameters:
      document - document to read or modify
      Returns:
      true when the condition is met; otherwise false
    • reset

      public void reset(ModelDocument document)
      Clears the current state and starts a new history baseline.
      Parameters:
      document - document to read or modify
    • undo

      public boolean undo(ModelDocument document)
      Restores the previous snapshot in the undo history.
      Parameters:
      document - document to read or modify
      Returns:
      true when the condition is met; otherwise false