com.swfm.mica.commands
Interface MiiCommandManager

All Known Subinterfaces:
MiiCommandDispatchManager, MiiEditorWindowSemanticsManager
All Known Implementing Classes:
MiCommandDispatchManager, MiCommandManager, MiEditorWindow, MiLayerAttributes

public interface MiiCommandManager

This class supports the registration of widgets and the commands they generate. This can then be used by a program to set values and states of 'commands', instead of 'widgets'. This is usefull because many programs have no knowledge of what widgets generate what commands, nor should they. For example: setCommandSensitivity(String command, boolean flag); sets the sensitivity of the widgets that generate the command. Many classes that implement this interface just delegate (forward) the methods that implement the interface to an instance of MiCommandManager.

Version:
%I% %G%
Author:
Michael L. Davis

Method Summary
 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 the widget that generates the given command.
 void setCommandOptions(java.lang.String command, Strings options)
          Sets the values of the multi-state widget that generates 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 the boolean widget that generates the given command.
 void setCommandState(java.lang.String command, java.lang.String state)
          Sets the state 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.
 void unRegisterWidgetGeneratedCommand(MiPart widget, java.lang.String command)
          UnRegisters the given widget and the command it generates.
 

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.

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.

Parameters:
widget - the widget that generates the command
command - the command
See Also:
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.

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).

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.

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), setCommandSensitivity(java.lang.String, boolean), MiCommandManager.setCommandSensitivity(java.lang.String, boolean)

setCommandState

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

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 of the multi-state widget that generates the given command. This is used for initializing widgets like combo boxes and lists.

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 the widget that generates the given command. This is used for initializing widgets like labels and menubar buttons, push button etc.

Parameters:
command - the command
label - the new label

setCommandOptions

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

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.

Parameters:
command - the command
propertyName - the property name
propertyValue - the value