org.openstreetmap.josm.command
Class SequenceCommand

java.lang.Object
  extended by org.openstreetmap.josm.command.PseudoCommand
      extended by org.openstreetmap.josm.command.Command
          extended by org.openstreetmap.josm.command.SequenceCommand

public class SequenceCommand
extends Command

A command consisting of a sequence of other commands. Executes the other commands and undo them in reverse order.


Field Summary
 boolean continueOnError
           
private  java.lang.String name
           
private  Command[] sequence
          The command sequenz to be executed.
private  boolean sequence_complete
           
 
Constructor Summary
SequenceCommand(java.lang.String name, java.util.Collection<Command> sequenz)
          Create the command by specifying the list of commands to execute.
SequenceCommand(java.lang.String name, Command... sequenz)
          Convenient constructor, if the commands are known at compile time.
 
Method Summary
 boolean executeCommand()
          Executes the command on the dataset.
 void fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
          Fill in the changed data this command operates on.
 java.util.Collection<PseudoCommand> getChildren()
          Returns the subcommands of this command.
 javax.swing.Icon getDescriptionIcon()
          Provides a descriptive icon of this command.
 java.lang.String getDescriptionText()
          Provides a description text representing this command.
 Command getLastCommand()
           
 java.util.Collection<? extends OsmPrimitive> getParticipatingPrimitives()
          Return the primitives that take part in this command.
 void undoCommand()
          Undoes the command.
private  void undoCommands(int start)
           
 
Methods inherited from class org.openstreetmap.josm.command.Command
checkAndConfirmOutlyingOperation, getLayer, getOrig, invalidBecauselayerRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sequence

private Command[] sequence
The command sequenz to be executed.


sequence_complete

private boolean sequence_complete

name

private final java.lang.String name

continueOnError

public boolean continueOnError
Constructor Detail

SequenceCommand

public SequenceCommand(java.lang.String name,
                       java.util.Collection<Command> sequenz)
Create the command by specifying the list of commands to execute.

Parameters:
sequenz - The sequence that should be executed.

SequenceCommand

public SequenceCommand(java.lang.String name,
                       Command... sequenz)
Convenient constructor, if the commands are known at compile time.

Method Detail

executeCommand

public boolean executeCommand()
Description copied from class: Command
Executes the command on the dataset. This implementation will remember all primitives returned by fillModifiedData for restoring them on undo.

Overrides:
executeCommand in class Command

getLastCommand

public Command getLastCommand()

undoCommands

private void undoCommands(int start)

undoCommand

public void undoCommand()
Description copied from class: Command
Undoes 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:
undoCommand in class Command

fillModifiedData

public void fillModifiedData(java.util.Collection<OsmPrimitive> modified,
                             java.util.Collection<OsmPrimitive> deleted,
                             java.util.Collection<OsmPrimitive> added)
Description copied from class: Command
Fill in the changed data this command operates on. Add to the lists, don't clear them.

Specified by:
fillModifiedData in class Command
Parameters:
modified - The modified primitives
deleted - The deleted primitives
added - The added primitives

getDescriptionText

public java.lang.String getDescriptionText()
Description copied from class: PseudoCommand
Provides a description text representing this command.

Specified by:
getDescriptionText in class PseudoCommand

getDescriptionIcon

public javax.swing.Icon getDescriptionIcon()
Description copied from class: PseudoCommand
Provides a descriptive icon of this command.

Overrides:
getDescriptionIcon in class PseudoCommand

getChildren

public java.util.Collection<PseudoCommand> getChildren()
Description copied from class: PseudoCommand
Returns the subcommands of this command. Override for subclasses that have child commands.

Overrides:
getChildren in class PseudoCommand
Returns:
the subcommands, null if there are no child commands

getParticipatingPrimitives

public java.util.Collection<? extends OsmPrimitive> getParticipatingPrimitives()
Description copied from class: Command
Return the primitives that take part in this command.

Overrides:
getParticipatingPrimitives in class Command


JOSM