ccs.swing18
Class I18Action

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by ccs.swing18.I18Action
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
BasicI18Action

public abstract class I18Action
extends javax.swing.AbstractAction

An Action which incorporates CCS' I18N and target method invocation support.

See Also:
Serialized Form

Field Summary
protected static java.lang.Class[] ACTORSIG0
          The empty array of classes. getMethod() implementations may find this useful.
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
I18Action(java.lang.String actionID, java.lang.Object target, java.lang.String methodName, int special)
          A new I18Action.
 
Method Summary
 java.lang.String getActionID()
          Return this action's ID.
 java.lang.reflect.Method getActor()
          Return the defined actor method upon the target.
protected  java.io.InputStream getIconData(java.lang.String resID)
          Retrieve icon graphics data.
 int getSpecial()
          Return the specialisation of the action.
 java.lang.Object getTarget()
          Return the target of this action.
protected abstract  java.lang.reflect.Method resolveActor(java.lang.Object target, java.lang.String methodName, int special)
          Return the method to invoke on target (won't be null), given its name.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

ACTORSIG0

protected static final java.lang.Class[] ACTORSIG0
The empty array of classes. getMethod() implementations may find this useful.

Constructor Detail

I18Action

public I18Action(java.lang.String actionID,
                 java.lang.Object target,
                 java.lang.String methodName,
                 int special)
A new I18Action.

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). It may throw Exception; this will be caught and handled via HurlLogic. The method must return void and have zero parameters.
special - Zero, or the action's specialisation. These are optional constants defined by subclasses.
Method Detail

resolveActor

protected abstract java.lang.reflect.Method resolveActor(java.lang.Object target,
                                                         java.lang.String methodName,
                                                         int special)
                                                  throws java.lang.NoSuchMethodException
Return the method to invoke on target (won't be null), given its name. You should be able to determine the correct method signature from the specialisation.

Throws:
java.lang.NoSuchMethodException

getIconData

protected java.io.InputStream getIconData(java.lang.String resID)
Retrieve icon graphics data. Default returns null, for apps which don't use icons for actions.

Parameters:
resID - The resource ID of the graphics data. Defined by the I18N properties file. Interpretation is application-specific.

getActionID

public java.lang.String getActionID()
Return this action's ID.


getSpecial

public int getSpecial()
Return the specialisation of the action.


getTarget

public java.lang.Object getTarget()
Return the target of this action.


getActor

public java.lang.reflect.Method getActor()
Return the defined actor method upon the target.