com.swfm.mica.commands
Class MiCommandManager

java.lang.Object
  extended bycom.swfm.mica.commands.MiCommandManager
All Implemented Interfaces:
MiiCommandManager
Direct Known Subclasses:
MiCommandDispatchManager

public class MiCommandManager
extends java.lang.Object
implements MiiCommandManager

This class provides a good deal of the implementation of the MiiCommandManager interface. The classes that use use this, like MiWidgetGroupCommandHandler, delegate calls to their methods to an instance of this class.

Version:
%I% %G%
Author:
Michael L. Davis
See Also:
MiiCommandManager

Constructor Summary
MiCommandManager()
          Constructs a new MiCommandManager.
 
Method Summary
 MiPart getCommandWidget(java.lang.String command)
          Gets the first widget registered that generates the (caseless) given command.
 MiParts getCommandWidgets(java.lang.String command)
          Gets all the widgets registered that generates the (caseless) given command.
 void registerCommandDependentWidget(MiPart widget, java.lang.String command)
          Registers the given widget and the command it generates.
 void setCommandLabel(java.lang.String command, java.lang.String label)
          Sets the label of all of the widget that generates the given command.
 void setCommandOptions(java.lang.String command, Strings options)
          Sets the values of the all of the multi-state widgets that generate the given command.
 void setCommandPropertyValue(java.lang.String command, java.lang.String propertyName, java.lang.String propertyValue)
          Sets the given property to the given value for all parts that generates the given command.
 void setCommandSensitivity(java.lang.String command, boolean flag)
          Sets whether the given command can be processed at this time.
 void setCommandSensitivity(java.lang.String command, boolean flag, java.lang.String statusHelpMsg)
          Sets whether the given command can be processed at this time.
 void setCommandState(java.lang.String command, boolean flag)
          Sets the state of all the boolean widget that generates the given command.
 void setCommandState(java.lang.String command, java.lang.String state)
          Sets the state all of the multi-state widget that generates the given command.
 void setCommandVisibility(java.lang.String command, boolean flag)
          Sets whether the given command is to be visible to the user.
 java.lang.String toString()
          Returns information about this class.
 void unRegisterWidgetGeneratedCommand(MiPart widget, java.lang.String command)
          UnRegisters the given widget and the command it generates.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MiCommandManager

public MiCommandManager()
Constructs a new MiCommandManager.

Method Detail

registerCommandDependentWidget

public void registerCommandDependentWidget(MiPart widget,
                                           java.lang.String command)
Registers the given widget and the command it generates. This permits (de)sensitization of the widget by the setCommandSensitivity method.

Specified by:
registerCommandDependentWidget in interface MiiCommandManager
Parameters:
widget - the widget that generates the command
command - the command
See Also:
unRegisterWidgetGeneratedCommand(com.swfm.mica.core.MiPart, java.lang.String)

unRegisterWidgetGeneratedCommand

public void unRegisterWidgetGeneratedCommand(MiPart widget,
                                             java.lang.String command)
UnRegisters the given widget and the command it generates. Either the given widget or the given command may be null. Nulls act as wild cards.

Specified by:
unRegisterWidgetGeneratedCommand in interface MiiCommandManager
Parameters:
widget - the widget that generates the command
command - the command
See Also:
MiiCommandManager.registerCommandDependentWidget(com.swfm.mica.core.MiPart, java.lang.String)

setCommandVisibility

public void setCommandVisibility(java.lang.String command,
                                 boolean flag)
Sets whether the given command is to be visible to the user. This method typically (hides)shows the widgets that have been associated with the command.

Specified by:
setCommandVisibility in interface MiiCommandManager
Parameters:
command - the command
flag - true if the user can now see the command (whether sensitive or not)
See Also:
registerCommandDependentWidget(com.swfm.mica.core.MiPart, java.lang.String)

setCommandSensitivity

public void setCommandSensitivity(java.lang.String command,
                                  boolean flag)
Sets whether the given command can be processed at this time. Otherwise, possibly based on the current state of the application, the given command cannot/should not be processed at this time. This method typically (de)sensitizes the widgets that have been associated with the command (see registerCommandDependentWidget).

Specified by:
setCommandSensitivity in interface MiiCommandManager
Parameters:
command - the command
flag - true if the system can now process the command
See Also:
registerCommandDependentWidget(com.swfm.mica.core.MiPart, java.lang.String)

setCommandSensitivity

public void setCommandSensitivity(java.lang.String command,
                                  boolean flag,
                                  java.lang.String statusHelpMsg)
Sets whether the given command can be processed at this time. Otherwise, possibly based on the current state of the application, the given command cannot/should not be processed at this time. This method typically (de)sensitizes the widgets that have been associated with the command (see registerCommandDependentWidget). This method is designed to display a status bar message that describes why a particular widget is desensitized.

Specified by:
setCommandSensitivity in interface MiiCommandManager
Parameters:
command - the command
flag - true if the system can now process the command
statusHelpMsg - the new status bar message
See Also:
registerCommandDependentWidget(com.swfm.mica.core.MiPart, java.lang.String)

setCommandState

public void setCommandState(java.lang.String command,
                            boolean flag)
Sets the state of all the boolean widget that generates the given command. This is used for initializing toggle buttons.

Specified by:
setCommandState in interface MiiCommandManager
Parameters:
command - the command
flag - true if the two state widget is to be 'set'.

setCommandState

public void setCommandState(java.lang.String command,
                            java.lang.String state)
Sets the state all of the multi-state widget that generates the given command. This is used for initializing widgets like combo boxes and lists.

Specified by:
setCommandState in interface MiiCommandManager
Parameters:
command - the command
state - the current state, one of many.

setCommandLabel

public void setCommandLabel(java.lang.String command,
                            java.lang.String label)
Sets the label of all of the widget that generates the given command. This is used for initializing widgets like labels and menubar buttons, push button etc.

Specified by:
setCommandLabel in interface MiiCommandManager
Parameters:
command - the command
label - the new label

setCommandOptions

public void setCommandOptions(java.lang.String command,
                              Strings options)
Sets the values of the all of the multi-state widgets that generate the given command. This is used for setting the possible values of widgets like combo boxes and lists.

Specified by:
setCommandOptions in interface MiiCommandManager
Parameters:
command - the command
options - the new contents of the widget

setCommandPropertyValue

public void setCommandPropertyValue(java.lang.String command,
                                    java.lang.String propertyName,
                                    java.lang.String propertyValue)
Sets the given property to the given value for all parts that generates the given command. This is used for, say, changing the status help message on a widget that may only be situationally and temporarily desensitized.

Specified by:
setCommandPropertyValue in interface MiiCommandManager
Parameters:
command - the command
propertyName - the property name
propertyValue - the value

getCommandWidget

public MiPart getCommandWidget(java.lang.String command)
Gets the first widget registered that generates the (caseless) given command.

Parameters:
command - the command
Returns:
the widget generating the given command or null if not found.

getCommandWidgets

public MiParts getCommandWidgets(java.lang.String command)
Gets all the widgets registered that generates the (caseless) given command.

Parameters:
command - the command
Returns:
the widgets generating the given command or null if none found.

toString

public java.lang.String toString()
Returns information about this class.

Returns:
textual information (class name + + list of commands of registered widgets)