ccs.swing18
Class I18Dispatcher

java.lang.Object
  extended by ccs.swing18.I18Dispatcher

public abstract class I18Dispatcher
extends java.lang.Object

A dispatcher object maintains a collection of I18Actions encapsulating the behaviour of GUI buttons and menu items.


Constructor Summary
I18Dispatcher()
           
 
Method Summary
 void addMenu(java.lang.String actionID)
          Add a new menu to the menu bar.
 void addMenuItem(java.lang.String menuActionID, int idx, java.lang.String itemActionID)
          Add a new item to an existing menu.
 void addMenuItem(java.lang.String menuActionID, java.lang.String itemActionID)
          Add a new item to an existing menu.
protected abstract  I18Action createAction(java.lang.String actionID, java.lang.Object target, java.lang.String methodName, int special)
          Create an I18Action subclass instance suited to this dispatcher.
 I18Action getAction(java.lang.String actionID)
          Retrieve an action object based on its ID.
 I18Action[] getMenu(java.lang.String menuActionID)
          Return list of actions encapsulating a specified menu.
 java.lang.String[] getMenus()
          Return the list of menu action IDs.
 void putAction(java.lang.String menuActionID, int idx, java.lang.String actionID, java.lang.Object target, java.lang.String methodName, int special)
          Add a new action to the collection, at a given point within a given menu.
 void putAction(java.lang.String actionID, java.lang.Object target, java.lang.String methodName, int special)
          Add a new action to the collection.
 void putAction(java.lang.String menuActionID, java.lang.String actionID, java.lang.Object target, java.lang.String methodName, int special)
          Add a new action to the collection, within a given menu.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I18Dispatcher

public I18Dispatcher()
Method Detail

putAction

public void putAction(java.lang.String actionID,
                      java.lang.Object target,
                      java.lang.String methodName,
                      int special)
Add a new action to the collection.

Parameters:
actionID - The unique ID string for this action. This is used as the base for several related I18N strings and must obey the conventions laid down in ccs.utils.MsgHelper. .
target - The object containing the method that should be called when this action happens. If null, the action won't do anything.
methodName - the name of the method of target to be called when the action happens. The method must be accessible and must be declared by the class of target directly (not inherited). The required signature and other behaviour of the method is governed by the I18Action subclass instance created by your implementation of createAction.
special - Zero, or the action's "specialisation". This is used to flag modified signature or exception-throwing behaviour of the invoked method. Your subclasses may use this, or not.

createAction

protected abstract I18Action createAction(java.lang.String actionID,
                                          java.lang.Object target,
                                          java.lang.String methodName,
                                          int special)
Create an I18Action subclass instance suited to this dispatcher.

See Also:
(ctor).

putAction

public void putAction(java.lang.String menuActionID,
                      java.lang.String actionID,
                      java.lang.Object target,
                      java.lang.String methodName,
                      int special)
Add a new action to the collection, within a given menu. Utility method.

Parameters:
menuActionID - The action ID for the menu to add this to.
actionID - The unique ID string for this action. This is used as the base for several related I18N strings and must obey the conventions laid down in ccs.utils.MsgHelper. Specifically, all actionIDs should begin with 'G'; Menu items will begin "GM", GUI buttons "GB", items on dialogs "GD", buttons on dialogs "GDB".
target - The object containing the method that should be called when this action happens. If null, the action won't do anything.
methodName - the name of the method of target to be called when the action happens. The method must be accessible and must be declared by the class of target directly (not inherited). The required signature and other behaviour of the method is governed by the I18Action subclass instance created by your implementation of createAction.
special - Zero, or the action's "specialisation". This is used to flag modified signature or exception-throwing behaviour of the invoked method. Your subclasses may use this, or not.

putAction

public void putAction(java.lang.String menuActionID,
                      int idx,
                      java.lang.String actionID,
                      java.lang.Object target,
                      java.lang.String methodName,
                      int special)
Add a new action to the collection, at a given point within a given menu. Utility method.

Parameters:
menuActionID - The action ID for the menu to add this to.
idx - The position within the menu at which to add the action.
actionID - The unique ID string for this action. This is used as the base for several related I18N strings and must obey the conventions laid down in ccs.utils.MsgHelper. Specifically, all actionIDs should begin with 'G'; Menu items will begin "GM", GUI buttons "GB", items on dialogs "GD", buttons on dialogs "GDB".
target - The object containing the method that should be called when this action happens. If null, the action won't do anything.
methodName - the name of the method of target to be called when the action happens. The method must be accessible and must be declared by the class of target directly (not inherited). The required signature and other behaviour of the method is governed by the I18Action subclass instance created by your implementation of createAction.
special - Zero, or the action's "specialisation". This is used to flag modified signature or exception-throwing behaviour of the invoked method. Your subclasses may use this, or not.

getAction

public I18Action getAction(java.lang.String actionID)
Retrieve an action object based on its ID.


addMenu

public void addMenu(java.lang.String actionID)
Add a new menu to the menu bar. Only works during application init, and only for the main GUI's Dispatcher.

Parameters:
actionID - The actionID of the action representing the menu. The action must have been added already using putAction.

addMenuItem

public void addMenuItem(java.lang.String menuActionID,
                        java.lang.String itemActionID)
Add a new item to an existing menu. Only works during application init, and only for the main GUI's Dispatcher.

Parameters:
menuActionID - The actionID of the action representing the menu.
itemActionID - The actionID of the action encapsulating the menu ID, or null to add a separator to the menu. The action must have been added already using putAction.

addMenuItem

public void addMenuItem(java.lang.String menuActionID,
                        int idx,
                        java.lang.String itemActionID)
Add a new item to an existing menu. Only works during application init, and only for the main GUI's Dispatcher.

Parameters:
menuActionID - The actionID of the action representing the menu.
idx - Where to insert the item.
itemActionID - The actionID of the action encapsulating the menu ID, or null to add a separator to the menu. The action must have been added already using putAction.

getMenus

public java.lang.String[] getMenus()
Return the list of menu action IDs.


getMenu

public I18Action[] getMenu(java.lang.String menuActionID)
Return list of actions encapsulating a specified menu. This may contain nulls; these represent separators.