Package lu.kbra.modelizer_next.history
Class UndoRedoManager
java.lang.Object
lu.kbra.modelizer_next.history.UndoRedoManager
Manages the document snapshot history and exposes undo/redo navigation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRedo()Checks whether this object can redo.booleancanUndo()Checks whether this object can undo.voidrecordState(ModelDocument document) Records the state in history.booleanredo(ModelDocument document) Restores the next snapshot in the redo history.voidreset(ModelDocument document) Clears the current state and starts a new history baseline.booleanundo(ModelDocument document) Restores the previous snapshot in the undo history.
-
Constructor Details
-
UndoRedoManager
public UndoRedoManager()
-
-
Method Details
-
canRedo
public boolean canRedo()Checks whether this object can redo.- Returns:
trueif the operation is allowed; otherwisefalse
-
canUndo
public boolean canUndo()Checks whether this object can undo.- Returns:
trueif the operation is allowed; otherwisefalse
-
recordState
Records the state in history.- Parameters:
document- document to read or modify
-
redo
Restores the next snapshot in the redo history.- Parameters:
document- document to read or modify- Returns:
truewhen the condition is met; otherwisefalse
-
reset
Clears the current state and starts a new history baseline.- Parameters:
document- document to read or modify
-
undo
Restores the previous snapshot in the undo history.- Parameters:
document- document to read or modify- Returns:
truewhen the condition is met; otherwisefalse
-