Class SequenceCommand

    • Field Detail

      • sequence

        private Command[] sequence
        The command sequence to be executed.
      • name

        private final java.lang.String name
      • continueOnError

        protected final boolean continueOnError
        Determines if the sequence execution should continue after one of its commands fails.
    • Constructor Detail

      • SequenceCommand

        public SequenceCommand​(DataSet ds,
                               java.lang.String name,
                               java.util.Collection<Command> sequenz,
                               boolean continueOnError)
        Create the command by specifying the list of commands to execute.
        Parameters:
        ds - The target data set. Must not be null
        name - The description text
        sequenz - The sequence that should be executed
        continueOnError - Determines if the sequence execution should continue after one of its commands fails
        Since:
        12726
      • SequenceCommand

        public SequenceCommand​(java.lang.String name,
                               java.util.Collection<Command> sequenz,
                               boolean continueOnError)
        Create the command by specifying the list of commands to execute.
        Parameters:
        name - The description text
        sequenz - The sequence that should be executed. Must not be null or empty
        continueOnError - Determines if the sequence execution should continue after one of its commands fails
        Since:
        11874
      • SequenceCommand

        public SequenceCommand​(java.lang.String name,
                               java.util.Collection<Command> sequenz)
        Create the command by specifying the list of commands to execute.
        Parameters:
        name - The description text
        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.
        Parameters:
        name - The description text
        sequenz - The sequence that should be executed.
    • Method Detail

      • wrapIfNeeded

        public static Command wrapIfNeeded​(java.lang.String name,
                                           Command... sequenz)
        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

        public static Command wrapIfNeeded​(java.lang.String name,
                                           java.util.Collection<Command> sequenz)
        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

        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.

        The layer should be invalidated after execution so that it can be re-painted.

        Overrides:
        executeCommand in class Command
        Returns:
        true
      • getLastCommand

        public Command getLastCommand()
        Returns the last command.
        Returns:
        The last command, or null if the sequence is empty.
      • undoCommands

        protected final 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 interface: PseudoCommand
        Provides a description text representing this command.
        Returns:
        description text representing this command
      • getName

        public final java.lang.String getName()
        Returns the command name used in description text.
        Returns:
        the command name
        Since:
        14283
      • getDescriptionIcon

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

        public java.util.Collection<PseudoCommandgetChildren()
        Description copied from interface: PseudoCommand
        Returns the subcommands of this command. Override for subclasses that have child commands.
        Returns:
        the subcommands, null if there are no child commands
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class Command