public abstract class Command
extends java.lang.Object
Constructor and Description |
---|
Command(java.lang.String title)
Initializes a new
Command instance. |
Modifier and Type | Method and Description |
---|---|
void |
addSubCmd(Command cmd)
Adds a command object to a compound command.
|
protected boolean |
adopt(Command command)
Merges adjacent commands in the history queue if they are related.
|
abstract void |
execute(boolean undoEnabled)
This method is called internally by JDiagram when performing the action.
|
protected CommandContext |
getContext() |
CommandList |
getSubCommands()
Gets a collection of all command objects contained within the composite one.
|
java.lang.String |
getTitle()
Gets the title of this command.
|
protected boolean |
isContainerOf(Command command)
Determines whether a command has been initiated by this command
and should be treated as a derivative.
|
void |
redo()
This method is called by the
UndoManager when redoing actions. |
void |
setTitle(java.lang.String value)
Sets the command title.
|
void |
undo()
This method is called by the
UndoManager when undoing actions. |
public Command(java.lang.String title)
Command
instance.title
- A String
containing the command title.public abstract void execute(boolean undoEnabled)
undoEnabled
- true
if the undo manager is enabled
at this time, otherwise false
.public void undo()
UndoManager
when undoing actions.public void redo()
UndoManager
when redoing actions.protected CommandContext getContext()
public void addSubCmd(Command cmd)
cmd
- A subordinate action that should be executed, undone or
redone together with this command.protected boolean isContainerOf(Command command)
command
- The Command for which to determine whether it is a derivative.protected boolean adopt(Command command)
command
- The Command that might be adopted by this command.public java.lang.String getTitle()
String
containing the command's title.public void setTitle(java.lang.String value)
value
- A String
containing the command's title.public CommandList getSubCommands()