Class GanttUndoRedoManager
java.lang.Object
org.eclipse.nebula.widgets.ganttchart.undoredo.GanttUndoRedoManager
public class GanttUndoRedoManager
extends java.lang.Object
Deals with Undo/Redo events in the chart. Implemented per Command-structure standards.
-
Field Summary
Fields Modifier and Type Field Description static intSTACK_SIZE -
Constructor Summary
Constructors Constructor Description GanttUndoRedoManager(GanttComposite parent, int maxStackSize) -
Method Summary
Modifier and Type Method Description voidaddUndoRedoListener(IUndoRedoListener listener)Adds a listener to be notified when undo/redo possibilities changebooleancanRedo()Whether a Redo is possible.booleancanUndo()Whether an Undo is possible.voidclear()Removes all undo/redo events from the stackintgetCurrentIndex()The current index of where the undo/redo marker isjava.util.ListgetUndoRedoEvents()voidrecord(IUndoRedoCommand command)Records an undoable/redoable commandbooleanredo()Redoes the last GanttChart action.voidremoveUndoRedoListener(IUndoRedoListener listener)Removes a listener from being notified when undo/redo possibilities changevoidsetCurrentIndex(int currentIndex)voidsetMaxStackSize(int stackSize)Sets a new max undo/redo sack size, value must be a positive integer or it is ignored.booleanundo()Undoes the last GanttChart action.
-
Field Details
-
STACK_SIZE
public static final int STACK_SIZE- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
getUndoRedoEvents
public java.util.List getUndoRedoEvents() -
addUndoRedoListener
Adds a listener to be notified when undo/redo possibilities change- Parameters:
listener-
-
removeUndoRedoListener
Removes a listener from being notified when undo/redo possibilities change- Parameters:
listener-
-
record
Records an undoable/redoable command- Parameters:
command-
-
clear
public void clear()Removes all undo/redo events from the stack -
canUndo
public boolean canUndo()Whether an Undo is possible.- Returns:
- true if user can Undo
-
undo
public boolean undo()Undoes the last GanttChart action.- Returns:
-
redo
public boolean redo()Redoes the last GanttChart action.- Returns:
-
canRedo
public boolean canRedo()Whether a Redo is possible.- Returns:
- true if user can Redo
-
getCurrentIndex
public int getCurrentIndex()The current index of where the undo/redo marker is- Returns:
-
setCurrentIndex
public void setCurrentIndex(int currentIndex)- Parameters:
currentIndex- The current index of where the undo/redo marker is
-
setMaxStackSize
public void setMaxStackSize(int stackSize)Sets a new max undo/redo sack size, value must be a positive integer or it is ignored.- Parameters:
stackSize- new max undo/redo stack size
-