Package org.openstreetmap.josm.command
Class SequenceCommand
java.lang.Object
org.openstreetmap.josm.command.Command
org.openstreetmap.josm.command.SequenceCommand
- All Implemented Interfaces:
PseudoCommand
- Direct Known Subclasses:
JoinAreasAction.JoinAreaCommand,SplitWayCommand,ValidatorDialog.AutofixCommand
A command consisting of a sequence of other commands. Executes the other commands
and undo them in reverse order.
- Since:
- 31
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.command.Command
Command.OldNodeState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanDetermines if the sequence execution should continue after one of its commands fails.private final Stringprivate Command[]The command sequence to be executed.private booleanFields inherited from class org.openstreetmap.josm.command.Command
IS_INCOMPLETE, IS_OK, IS_OUTSIDE -
Constructor Summary
ConstructorsConstructorDescriptionSequenceCommand(String name, Collection<Command> sequenz) Create the command by specifying the list of commands to execute.SequenceCommand(String name, Collection<Command> sequenz, boolean continueOnError) Create the command by specifying the list of commands to execute.SequenceCommand(String name, Command... sequenz) Convenient constructor, if the commands are known at compile time.SequenceCommand(DataSet ds, String name, Collection<Command> sequenz, boolean continueOnError) Create the command by specifying the list of commands to execute. -
Method Summary
Modifier and TypeMethodDescriptionprivate ReportedExceptioncreateReportedException(Throwable e, int i) booleanbooleanExecutes the command on the dataset.voidfillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) Fill in the changed data this command operates on.Returns the subcommands of this command.Provides a descriptive icon of this command.Provides a description text representing this command.Returns the last command.final StringgetName()Returns the command name used in description text.Collection<? extends OsmPrimitive>Return the primitives that take part in this command.inthashCode()protected final voidsetSequence(Command... sequence) protected final voidsetSequenceComplete(boolean sequenceComplete) voidUndoes the command.protected final voidundoCommands(int start) static CommandwrapIfNeeded(String name, Collection<Command> sequenz) Convenient constructor, if the commands are known at compile time.static CommandwrapIfNeeded(String name, Command... sequenz) Convenient constructor, if the commands are known at compile time.Methods inherited from class org.openstreetmap.josm.command.Command
checkOutlyingOrIncompleteOperation, ensurePrimitivesAreInDataset, getAffectedDataSet, getOrig
-
Field Details
-
sequence
The command sequence to be executed. -
sequenceComplete
-
name
-
continueOnError
Determines if the sequence execution should continue after one of its commands fails.
-
-
Constructor Details
-
SequenceCommand
public SequenceCommand(DataSet ds, String name, Collection<Command> sequenz, boolean continueOnError) Create the command by specifying the list of commands to execute.- Parameters:
ds- The target data set. Must not benullname- The description textsequenz- The sequence that should be executedcontinueOnError- Determines if the sequence execution should continue after one of its commands fails- Since:
- 12726
-
SequenceCommand
Create the command by specifying the list of commands to execute.- Parameters:
name- The description textsequenz- The sequence that should be executed. Must not be null or emptycontinueOnError- Determines if the sequence execution should continue after one of its commands fails- Since:
- 11874
-
SequenceCommand
Create the command by specifying the list of commands to execute.- Parameters:
name- The description textsequenz- The sequence that should be executed.
-
SequenceCommand
Convenient constructor, if the commands are known at compile time.- Parameters:
name- The description textsequenz- The sequence that should be executed.
-
-
Method Details
-
wrapIfNeeded
Convenient constructor, if the commands are known at compile time.- Parameters:
name- The description text to be used for the sequence command, if one is created.sequenz- The sequence that should be executed.- Returns:
- Either a SequenceCommand, or the only command in the potential sequence
- Since:
- 16573
-
wrapIfNeeded
Convenient constructor, if the commands are known at compile time.- Parameters:
name- The description text to be used for the sequence command, if one is created.sequenz- The sequence that should be executed.- Returns:
- Either a SequenceCommand, or the only command in the potential sequence
- Since:
- 16573
-
executeCommand
Description copied from class:CommandExecutes the command on the dataset. This implementation will remember all primitives returned by fillModifiedData for restoring them on undo.The layer should be invalidated after execution so that it can be re-painted.
- Overrides:
executeCommandin classCommand- Returns:
- true
-
getLastCommand
Returns the last command.- Returns:
- The last command, or
nullif the sequence is empty.
-
undoCommands
-
createReportedException
-
undoCommand
Description copied from class:CommandUndoes the command. It can be assumed that all objects are in the same state they were before. It can also be assumed that executeCommand was called exactly once before. This implementation undoes all objects stored by a former call to executeCommand.- Overrides:
undoCommandin classCommand
-
fillModifiedData
public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) Description copied from class:CommandFill in the changed data this command operates on. Add to the lists, don't clear them.- Specified by:
fillModifiedDatain classCommand- Parameters:
modified- The modified primitivesdeleted- The deleted primitivesadded- The added primitives
-
getDescriptionText
Description copied from interface:PseudoCommandProvides a description text representing this command.- Returns:
- description text representing this command
-
getName
Returns the command name used in description text.- Returns:
- the command name
- Since:
- 14283
-
getDescriptionIcon
Description copied from interface:PseudoCommandProvides a descriptive icon of this command.- Returns:
- descriptive icon of this command
-
getChildren
Description copied from interface:PseudoCommandReturns the subcommands of this command. Override for subclasses that have child commands.- Returns:
- the subcommands, null if there are no child commands
-
getParticipatingPrimitives
Description copied from class:CommandReturn the primitives that take part in this command. The collection is computed during execution.- Specified by:
getParticipatingPrimitivesin interfacePseudoCommand- Overrides:
getParticipatingPrimitivesin classCommand- Returns:
- primitives that take part in this command
-
setSequence
-
setSequenceComplete
-
hashCode
-
equals
-