Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph X 1.4.0.9
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mxgraph.util
Class mxUndoManager

    java.lang.Object
      com.mxgraph.util.mxEventSource
          com.mxgraph.util.mxUndoManager

    public class mxUndoManager

extends mxEventSource

Implements an undo history. This class fires the following events: mxEvent.CLEAR fires after clear was executed. The event has no properties. mxEvent.UNDO fires afer a significant edit was undone in undo. The `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.

Nested Class Summary

Nested classes/interfaces inherited from class com.mxgraph.util.mxEventSource
`mxEventSource.mxIEventListener`

Field Summary
`protected 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.

Fields inherited from class com.mxgraph.util.mxEventSource
`eventListeners, eventsEnabled, eventSource`

Constructor Summary
`mxUndoManager()` Constructs a new undo manager with a default history size.
`mxUndoManager(int size)` Constructs a new undo manager for the specified size.

Method Summary
`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.

Methods inherited from class com.mxgraph.util.mxEventSource
`addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### size

    protected int size

  Maximum command history size. 0 means unlimited history. Default is 100.

### history

    protected List<mxUndoableEdit> history

  List that contains the steps of the command history.

### indexOfNextAdd

    protected int indexOfNextAdd

  Index of the element to be added next.

Constructor Detail

### mxUndoManager

    public mxUndoManager()

  Constructs a new undo manager with a default history size.

### mxUndoManager

    public mxUndoManager(int size)

  Constructs a new undo manager for the specified size.

Method Detail

### isEmpty

    public boolean isEmpty()

### clear

    public void clear()

  Clears the command history.

### canUndo

    public boolean canUndo()

  Returns true if an undo is possible.

### undo

    public void undo()

  Undoes the last change.

### canRedo

    public boolean canRedo()

  Returns true if a redo is possible.

### redo

    public void redo()

  Redoes the last change.

### undoableEditHappened

    public void undoableEditHappened(mxUndoableEdit undoableEdit)

  Method to be called to add new undoable edits to the history.

### trim

    protected void trim()

  Removes all pending steps after indexOfNextAdd from the history, invoking die on each edit. This is called from undoableEditHappened.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph X 1.4.0.9
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2010 Gaudenz Alder. All rights reserved.