public class CommandManager extends Object
Constructor and Description |
---|
CommandManager()
Default constructor.
|
CommandManager(CommandManager orig)
Copy constructor, because "clone()" idiom is badly broken and only version number is preserved anyway.
|
Modifier and Type | Method and Description |
---|---|
void |
addCommandListener(CommandListener listener)
Adds editing command listener
|
boolean |
canRedo()
Can redo
|
boolean |
canUndo()
Can undo
|
void |
execute(Command... commands)
Execute the commands
|
void |
execute(Command command)
Execute a command.
|
Command |
getLastCommand()
Returns the most recent command executed
|
int |
getVersion()
Get the version number
|
void |
redo()
Redo last undone command.
|
void |
removeCommandListener(CommandListener listener)
removes editing command listener
|
void |
undo()
Undo last command.
|
public CommandManager()
public CommandManager(CommandManager orig)
orig
- the original command managerpublic int getVersion()
public void execute(Command command)
command
- - The command linepublic void execute(Command... commands)
commands
- - The commandspublic Command getLastCommand()
public void undo() throws CannotUndoException
CannotUndoException
- when the undo-list is empty.public boolean canUndo()
public void redo() throws CannotRedoException
CannotRedoException
- when redo-list is emptypublic boolean canRedo()
public void addCommandListener(CommandListener listener)
listener
- - command listenerpublic void removeCommandListener(CommandListener listener)
listener
- - command listenerCopyright © 2014 Uppsala University and Aalborg University. All Rights Reserved.