com.swfm.mica.core
Class MiActionManager

java.lang.Object
  extended bycom.swfm.mica.core.MiActionManager
All Implemented Interfaces:
MiiActionTypes

public class MiActionManager
extends java.lang.Object
implements MiiActionTypes

This class is a globally accessible (i.e. it is a singleton) API to the valid action registry. All possible action types and their names are stored here. This manager allows components outside of Mica to generate actions that look and behave just like Mica's built-in actions. This is accomplished by a component registering it's unique action names with this manager and getting back unique action type values. These values can be used anywhere just like Mica action types (e.g. Mi_COPY_ACTION). For example: the Mica-supplied MiPlayerPanel class contains the following lines which allow the users of the class to access and use it's action type (Mi_PLAYER_PANEL_ACTION) just like a Mica built-in action types: public static final String Mi_PLAYER_PANEL_ACTION_NAME = "playerPanelStateChange"; public static final int Mi_PLAYER_PANEL_ACTION = MiActionManager.registerAction(Mi_PLAYER_PANEL_ACTION_NAME);

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

Field Summary
   
Constructor Summary
MiActionManager()
           
 
Method Summary
static java.lang.String getNameOfRegisteredAction(int actionType)
          Gets the name of the given registered action type.
static java.lang.String[] getNamesOfRegisteredActions()
          Gets the names of all registered actions.
static int getNumberOfRegisteredActions()
          Gets the number of registered actions, which is the total number of all valid actions in the system.
static int getTypeOfRegisteredAction(java.lang.String actionName)
          Gets the action type of the given registered action name.
static int registerAction(java.lang.String actionName)
          Registers the given action name and returns an action type value that can be used for this new action.
static int registerAction(java.lang.String actionName, boolean reuseExistingActionIfAvailable)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiActionManager

public MiActionManager()
Method Detail

registerAction

public static int registerAction(java.lang.String actionName)
Registers the given action name and returns an action type value that can be used for this new action.

Parameters:
actionName - the name of the action
Returns:
the type of the action
Throws:
java.lang.IllegalArgumentException - action name already exists

registerAction

public static int registerAction(java.lang.String actionName,
                                 boolean reuseExistingActionIfAvailable)

getNumberOfRegisteredActions

public static int getNumberOfRegisteredActions()
Gets the number of registered actions, which is the total number of all valid actions in the system.

Returns:
the number of registered actions

getNamesOfRegisteredActions

public static java.lang.String[] getNamesOfRegisteredActions()
Gets the names of all registered actions.

Returns:
the names of all registered actions

getNameOfRegisteredAction

public static java.lang.String getNameOfRegisteredAction(int actionType)
Gets the name of the given registered action type.

Returns:
the name of the action type or null if the action type has not been registered.

getTypeOfRegisteredAction

public static int getTypeOfRegisteredAction(java.lang.String actionName)
Gets the action type of the given registered action name.

Returns:
the action type of the action name or -1 if the action name has not been registered.