net.refractions.udig.project.command
Class CompositeCommand

java.lang.Object
  extended by net.refractions.udig.project.command.CompositeCommand
All Implemented Interfaces:
Command, MapCommand
Direct Known Subclasses:
UndoableComposite

public class CompositeCommand
extends java.lang.Object
implements MapCommand

A collection of Commands that are done as one command. See Gang of Four composite pattern.

Since:
1.0.0
Author:
Jesse

Field Summary
protected  java.util.List<MapCommand> commands
           
protected  java.util.List<MapCommand> finalizerCommands
           
 
Constructor Summary
CompositeCommand()
           
CompositeCommand(java.util.List commands)
          Creates a new instance of CompositeCommand
 
Method Summary
 MapCommand copy()
          Instantiates a new copy of the command that will operate in the same manner as the original command.
 java.util.List<MapCommand> getCommands()
           
 java.util.List<MapCommand> getFinalizerCommands()
           
 Map getMap()
          Returns the map if called during execute (or undo command is an undoable command) API mutable?
 java.lang.String getName()
          Returns the name of the MapCommand
 void run(IProgressMonitor monitor)
          The method that performs the work of the command.
 void setMap(IMap map)
          Called when before the command is executed.
 void setName(java.lang.String newName)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

commands

protected java.util.List<MapCommand> commands

finalizerCommands

protected java.util.List<MapCommand> finalizerCommands
Constructor Detail

CompositeCommand

public CompositeCommand(java.util.List commands)
Creates a new instance of CompositeCommand

Parameters:
commands - A list of commands to execute.

CompositeCommand

public CompositeCommand()
Method Detail

run

public void run(IProgressMonitor monitor)
         throws java.lang.Exception
Description copied from interface: Command
The method that performs the work of the command.

Run is called by UDIG when the command is received. Commands are run in a seperate thread.

Specified by:
run in interface Command
Parameters:
monitor - A progress monitor used by the command to report on its internal state. API how is this associated with a Thread? is it a Thread?
Throws:
java.lang.Exception
See Also:
net.refractions.udig.project.internal.command.MapCommand#run()

copy

public MapCommand copy()
Description copied from interface: Command
Instantiates a new copy of the command that will operate in the same manner as the original command. API isn't this cloneable?

Specified by:
copy in interface Command
Returns:
A copy of the current command. The new command must run the same way as the current object.

If the current command has already executed it cannot be used again, but a copy may because a copy should contain none of the state side-effect that execution has on a command

See Also:
net.refractions.udig.project.internal.command.MapCommand#copy()

getName

public java.lang.String getName()
Description copied from interface: Command
Returns the name of the MapCommand

Specified by:
getName in interface Command
Returns:
The name of the command.
See Also:
Command.getName()

setName

public void setName(java.lang.String newName)

setMap

public void setMap(IMap map)
Description copied from interface: MapCommand
Called when before the command is executed. API mutable?throw unsupportedexception?

Specified by:
setMap in interface MapCommand
Parameters:
map - The map executing the command.
See Also:
MapCommand.setMap(IMap)

getMap

public Map getMap()
Description copied from interface: MapCommand
Returns the map if called during execute (or undo command is an undoable command) API mutable?

Specified by:
getMap in interface MapCommand
Returns:
the map if called during execute (or undo command is an undoable command)
See Also:
MapCommand.getMap()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCommands

public java.util.List<MapCommand> getCommands()
Returns:
Returns the commands.

getFinalizerCommands

public java.util.List<MapCommand> getFinalizerCommands()
Returns:
Returns the commands that will always be run at the end of the command.