public class UndoManager
extends java.lang.Object
Constructor and Description |
---|
UndoManager() |
Modifier and Type | Method and Description |
---|---|
void |
addCommand(java.util.ArrayList<Command> newCommands)
Add a set of commands that have been executed and should be undone
together.
|
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() |
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(java.util.ArrayList<Command> newCommands)
newCommands
- The commands that have been executed.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 boolean hasCommandToUndo()
public void execute(Command cmd)
public CompositeState getModelState()
public void saveStateAndExecute(Command cmd)