org.esa.beam.framework.ui.command
Interface CommandManager

All Known Implementing Classes:
DefaultCommandManager

public interface CommandManager

A command manager is used to create, register and deregister a list of commands. It also provides a set operations which are applied to all commands in the list.

Version:
$Revision$ $Date$
Author:
Norman Fomferra

Method Summary
 void addCommand(Command command)
          Adds a new command to this command manager.
 CommandGroup createCommandGroup(String commandID, CommandStateListener listener)
          Creates a new command group command for the given unique command ID and the given command state listener.
 ExecCommand createExecCommand(String commandID, CommandListener listener)
          Creates a new executable command for the given unique command ID and the given command listener.
 ToolCommand createToolCommand(String commandID, CommandStateListener listener, com.bc.ceres.swing.figure.Interactor tool)
          Creates a new tool command for the given unique command ID and the given tool.
 Command getCommand(String commandID)
          Gets the command associated with the given command-COMMAND_ID or null if a command with the given command-ID has not been registered (so far).
 Command getCommandAt(int index)
          Returns the element at the specified position in this DefaultCommandManager.
 CommandGroup getCommandGroup(String commandID)
          Gets the command group associated with the given command-ID or null if an command group with the given command-ID has not been registered (so far).
 ExecCommand getExecCommand(String commandID)
          Gets the executable command associated with the given command-ID or null if an executable command with the given command-ID has not been registered (so far).
 int getNumCommands()
          Returns the number of commands in this DefaultCommandManager.
 ToolCommand getToolCommand(String commandID)
          Gets the tool command associated with the given command-ID or null if a tool command with the given command-ID has not been registered (so far).
 void removeCommand(Command command)
          Removes an existing command from this command manager.
 void updateComponentTreeUI()
          Updates the component tree of all commands since the Java look-and-feel has changed.
 void updateState()
          Calls the updateState method of all registered commands.
 

Method Detail

createExecCommand

ExecCommand createExecCommand(String commandID,
                              CommandListener listener)
Creates a new executable command for the given unique command ID and the given command listener.

Parameters:
commandID - a unique command ID
listener - the command listener which executes the command and updates its state
Returns:
a new executable command
See Also:
createToolCommand(java.lang.String, org.esa.beam.framework.ui.command.CommandStateListener, com.bc.ceres.swing.figure.Interactor), createCommandGroup(java.lang.String, org.esa.beam.framework.ui.command.CommandStateListener)

createToolCommand

ToolCommand createToolCommand(String commandID,
                              CommandStateListener listener,
                              com.bc.ceres.swing.figure.Interactor tool)
Creates a new tool command for the given unique command ID and the given tool.

Parameters:
commandID - a unique command ID
listener - the command state listener used to update the tool command's state
tool - the tool which executes the command and updates its state
Returns:
a new tool command
See Also:
createExecCommand(java.lang.String, org.esa.beam.framework.ui.command.CommandListener), createCommandGroup(java.lang.String, org.esa.beam.framework.ui.command.CommandStateListener)

createCommandGroup

CommandGroup createCommandGroup(String commandID,
                                CommandStateListener listener)
Creates a new command group command for the given unique command ID and the given command state listener.

Parameters:
commandID - a unique command ID
listener - the command state listener used to update the command group state
Returns:
a new command group
See Also:
createExecCommand(java.lang.String, org.esa.beam.framework.ui.command.CommandListener), createToolCommand(java.lang.String, org.esa.beam.framework.ui.command.CommandStateListener, com.bc.ceres.swing.figure.Interactor)

getNumCommands

int getNumCommands()
Returns the number of commands in this DefaultCommandManager. If this manager contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE :-)

Returns:
the number of commands in this DefaultCommandManager.

getCommandAt

Command getCommandAt(int index)
Returns the element at the specified position in this DefaultCommandManager.

Parameters:
index - index of command to return.
Returns:
the Command at the specified position in this DefaultCommandManager.
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getNumCommands()).

getCommand

Command getCommand(String commandID)
Gets the command associated with the given command-COMMAND_ID or null if a command with the given command-ID has not been registered (so far).


getExecCommand

ExecCommand getExecCommand(String commandID)
Gets the executable command associated with the given command-ID or null if an executable command with the given command-ID has not been registered (so far).


getToolCommand

ToolCommand getToolCommand(String commandID)
Gets the tool command associated with the given command-ID or null if a tool command with the given command-ID has not been registered (so far).


getCommandGroup

CommandGroup getCommandGroup(String commandID)
Gets the command group associated with the given command-ID or null if an command group with the given command-ID has not been registered (so far).


updateState

void updateState()
Calls the updateState method of all registered commands.


updateComponentTreeUI

void updateComponentTreeUI()
Updates the component tree of all commands since the Java look-and-feel has changed.


addCommand

void addCommand(Command command)
Adds a new command to this command manager.

Parameters:
command - the command to be added
Throws:
IllegalArgumentException - if the command ID property of the command has not been set, or if an command with the same command ID has alreay been registered

removeCommand

void removeCommand(Command command)
Removes an existing command from this command manager.

Parameters:
command - the command to be removed


Copyright © 2002-2013 Brockmann Consult GmbH. All Rights Reserved.