public class UndoManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
UndoManager.CommandFilter |
Constructor and Description |
---|
UndoManager() |
Modifier and Type | Method and Description |
---|---|
void |
addCommand(Command newCommand)
Add a single command that has been executed and should be undone on it's
own.
|
void |
addCommand(Command newCommand,
CompositeState state)
Add a single command that has been executed and should be undone on it's
own.
|
void |
clearCommands()
Clear all commands
|
void |
clearCommands(UndoManager.CommandFilter filter)
Clear all commands indicated by a command filter.
|
void |
execute(Command cmd) |
int |
getDepth() |
Command |
getLastCommand() |
CompositeState |
getModelState() |
boolean |
hasCommandToUndo() |
void |
saveStateAndExecute(Command cmd) |
void |
setDepth(int depth) |
void |
undoLastCommand()
Undo the most recently executed set of commands.
|
public void setDepth(int depth)
public int getDepth()
public void addCommand(Command newCommand)
newCommand
- The command that has been executed.public void addCommand(Command newCommand, CompositeState state)
newCommand
- The command that has been executed.public void undoLastCommand()
public Command getLastCommand()
public void clearCommands()
public void clearCommands(UndoManager.CommandFilter filter)
public boolean hasCommandToUndo()
public void execute(Command cmd)
public CompositeState getModelState()
public void saveStateAndExecute(Command cmd)