public class SetOverrideCommand extends AbstractCommand
AbstractCommand.NonDirtying| Modifier and Type | Field and Description |
|---|---|
protected Command |
mapCommand
This keeps track of the set mapping command(s) used to implement this command.
|
protected MappingDomain |
mappingDomain
This keeps track of the mapping domain in which the command operates.
|
protected SetCommand |
setCommand
This keeps track of the SetCommand we're overriding
|
description, isExecutable, isPrepared, label| Constructor and Description |
|---|
SetOverrideCommand(MappingDomain domain,
SetCommand setCommand)
This creates a command instance that removes, unmaps the removed object and then adds and maps the new object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Called to indicate that the command will never be used again.
|
void |
execute()
Performs the command activity required for the effect.
|
java.util.Collection<?> |
getAffectedObjects()
Returns an empty list.
|
java.util.Collection<?> |
getResult()
Returns an empty list.
|
protected boolean |
prepare()
Called at most once in
AbstractCommand.canExecute() to give the command an opportunity to ready itself for execution. |
void |
redo()
Performs the command activity required to
redo the effect after undoing the effect. |
java.lang.String |
toString()
This gives an abbreviated name using this object's own class' name, without package qualification,
followed by a space separated list of field:value pairs.
|
void |
undo()
Throws a runtime exception.
|
canExecute, canUndo, chain, getDescription, getLabel, setDescription, setLabelprotected MappingDomain mappingDomain
protected SetCommand setCommand
protected Command mapCommand
public SetOverrideCommand(MappingDomain domain, SetCommand setCommand)
protected boolean prepare()
AbstractCommandAbstractCommand.canExecute() to give the command an opportunity to ready itself for execution.
The returned value is stored in AbstractCommand.canExecute().
In other words, you can override this method to initialize
and to yield a cached value for the all subsequent calls to canExecute.prepare in class AbstractCommandpublic void execute()
Commandexecute when canExecute returns false,
or when canExecute hasn't been called, is undefined.public void undo()
AbstractCommandundo in interface Commandundo in class AbstractCommandpublic void redo()
Commandredo the effect after undoing the effect.
The effect, if any, of calling redo before undo is called is undefined.
Note that if you implement redo to call execute
then any derived class will be restricted by that decision also.public void dispose()
Commanddispose in interface Commanddispose in class AbstractCommandpublic java.util.Collection<?> getResult()
AbstractCommandgetResult in interface CommandgetResult in class AbstractCommandpublic java.util.Collection<?> getAffectedObjects()
AbstractCommandgetAffectedObjects in interface CommandgetAffectedObjects in class AbstractCommandpublic java.lang.String toString()
toString in class AbstractCommand