ccs.swing18
Class BasicI18Action
java.lang.Object
javax.swing.AbstractAction
ccs.swing18.I18Action
ccs.swing18.BasicI18Action
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
public class BasicI18Action
- extends I18Action
An I18Action implementation with no support for specialisation or action
methods which are not direct members of the target object's class. Any
exception thrown by the action method is sent to a Hurlable to be processed.
If you don't need icon support, you may well be able to use this class directly
in simple (and common) cases. If you do, you'll need to subclass it. Note that
there is no BasicI18Dispatcher: the source of the Hurlable is always
application-specific, so a one-liner application-specific dispatcher is
required.
- See Also:
- Serialized Form
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 |
BasicI18Action(java.lang.String actionID,
java.lang.Object target,
java.lang.String methodName,
Hurlable hurlable)
A new I18Action. |
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent ae)
|
protected java.io.InputStream |
classloadIconData(java.lang.String pkgPrefix,
java.lang.String resID)
Utility method to return icon data from a fixed Java package (via the
class loader.) |
protected 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 |
BasicI18Action
public BasicI18Action(java.lang.String actionID,
java.lang.Object target,
java.lang.String methodName,
Hurlable hurlable)
- 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). The method must
return void and have zero parameters.hurlable
- Any exception thrown by the action method will be transferred
to this for handling.
resolveActor
protected java.lang.reflect.Method resolveActor(java.lang.Object target,
java.lang.String methodName,
int special)
throws java.lang.NoSuchMethodException
- Description copied from class:
I18Action
- 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.
- Specified by:
resolveActor
in class I18Action
- Throws:
java.lang.NoSuchMethodException
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent ae)
classloadIconData
protected java.io.InputStream classloadIconData(java.lang.String pkgPrefix,
java.lang.String resID)
- Utility method to return icon data from a fixed Java package (via the
class loader.) Most subclasses which need to implement
getIconData
can do it as a a one-line calls to this method with a suitable package prefix.
- Parameters:
pkgPrefix
- The package to load from. For a package com.example.foo,
the package prefix would be com/example/foo/
(note slashes).