public class mxUndoManager extends mxEventSource
edit
property contains the mxUndoableEdit that was undone.
mxEvent.REDO fires afer a significant edit was redone in redo. The
edit
property contains the mxUndoableEdit that was redone.
mxEvent.ADD fires after an undoable edit was added to the history. The
edit
property contains the mxUndoableEdit that was added.mxEventSource.mxIEventListener
Modifier and Type | Field | Description |
---|---|---|
protected java.util.List<mxUndoableEdit> |
history |
List that contains the steps of the command history.
|
protected int |
indexOfNextAdd |
Index of the element to be added next.
|
protected int |
size |
Maximum command history size.
|
eventListeners, eventsEnabled, eventSource
Constructor | Description |
---|---|
mxUndoManager() |
Constructs a new undo manager with a default history size.
|
mxUndoManager(int size) |
Constructs a new undo manager for the specified size.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
canRedo() |
Returns true if a redo is possible.
|
boolean |
canUndo() |
Returns true if an undo is possible.
|
void |
clear() |
Clears the command history.
|
boolean |
isEmpty() |
|
void |
redo() |
Redoes the last change.
|
protected void |
trim() |
Removes all pending steps after indexOfNextAdd from the history,
invoking die on each edit.
|
void |
undo() |
Undoes the last change.
|
void |
undoableEditHappened(mxUndoableEdit undoableEdit) |
Method to be called to add new undoable edits to the history.
|
addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource
protected int size
protected java.util.List<mxUndoableEdit> history
protected int indexOfNextAdd
public mxUndoManager()
public mxUndoManager(int size)
public boolean isEmpty()
public void clear()
public boolean canUndo()
public void undo()
public boolean canRedo()
public void redo()
public void undoableEditHappened(mxUndoableEdit undoableEdit)
protected void trim()
Copyright (c) 2010-2017 Gaudenz Alder, JGraph Ltd. All rights reserved.