com.mindfusion.diagramming
Class CommandHistory

java.lang.Object
  extended by com.mindfusion.diagramming.CommandHistory

public class CommandHistory
extends java.lang.Object

Represent the command undo/redo history.


Constructor Summary
CommandHistory()
          Initializes a new CommandHistory instance.
 
Method Summary
 void clear()
          Clears the undo/redo history.
 int getCapacity()
          Gets how much commands can be saved in the undo history.
 Command getNextRedo()
          Gets the command that will be redone by the next call to UndoManager.redo().
 Command getNextUndo()
          Gets the command that will be undone by the next call to UndoManager.undo().
 boolean mergeUndoRecords(int numRecords, java.lang.String title)
          Merges several undo records into a single composite record.
 void setCapacity(int value)
          Sets the maximum number of commands that can be saved in the undo history.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandHistory

public CommandHistory()
Initializes a new CommandHistory instance.

Method Detail

mergeUndoRecords

public boolean mergeUndoRecords(int numRecords,
                                java.lang.String title)
Merges several undo records into a single composite record.

Parameters:
numRecords - Specifies how many records at the end of the command list should be merged.
title - Specifies the title of the new command.
Returns:
false if the commands saved in the history are less than numRecords; otherwise, true.

clear

public void clear()
Clears the undo/redo history.


getNextUndo

public Command getNextUndo()
Gets the command that will be undone by the next call to UndoManager.undo().


getNextRedo

public Command getNextRedo()
Gets the command that will be redone by the next call to UndoManager.redo().


getCapacity

public int getCapacity()
Gets how much commands can be saved in the undo history.

Returns:
An integer value specifying how much commands can be saved in the undo/redo history before dropping the oldest command.

setCapacity

public void setCapacity(int value)
Sets the maximum number of commands that can be saved in the undo history.

Parameters:
value - An integer value specifying how much commands can be saved in the undo/redo history before dropping the oldest command.