uic.model
Class UICRadioAction
java.lang.Object
uic.model.UICSimpleAction
uic.model.UICAction
uic.model.UICToggleAction
uic.model.UICRadioAction
- All Implemented Interfaces:
- ActionListener, EventListener
public class UICRadioAction
- extends UICToggleAction
An RadioButton action to add the concept of buttongroups to the ActionFactory used actions.
You use this class to register an action with the ActionFactory so radio buttons will
be grouped based on the exclusiveGroup you can (optionally) set on this action.
- Default target signatures
- (ARGUMENT_NEWSTATE, ARGMENT_SOUREC)
(ARGUMENT_NEWSTATE)
(ARGUMENT_SELECTED_NAME)
()
- All Targets
ARGUMENT_SELECTED_NAME
UICToggleAction.ARGUMENT_NEWSTATE
UICAction.ARGUMENT_SOURCE
- Since:
- 1.2
- See Also:
UICAction
,
ActionFactory
Constructor Summary |
UICRadioAction(String name,
Object targetObject,
String targetMethod,
String title,
ActionFactory actions)
|
UICRadioAction(String name,
Object targetObject,
String targetMethod,
String title,
String iconBaseName,
ActionFactory actions)
|
UICRadioAction(String name,
Object targetObject,
String targetMethod,
String title,
String iconBaseName,
String keyStroke,
ActionFactory actions)
|
UICRadioAction(String name,
Object targetObject,
String targetMethod,
String title,
String iconBaseName,
String keyStroke,
String toolTipText,
String whatIsThis,
ActionFactory actions)
Create new action. |
Methods inherited from class uic.model.UICAction |
addIcon, addKeyStroke, decorateButton, doAction, getComponentsIterator, getIconBaseName, getKeyStroke, getName, getTitle, getToolTipText, getWhatIsThis, setEnabled, setIconBaseName, setKeyStroke, setName, setStatusBar, setTexts, setTitle, setToolTipText, setUIUpdateCommand, setUIUpdateCommand, setWhatIsThis, toString |
Methods inherited from class uic.model.UICSimpleAction |
createArguments, equals, execute, execute, execute, execute, isEnabled, setDirect, setExecutionPolicy, setTarget, setTarget |
ARGUMENT_SELECTED_NAME
public static final String ARGUMENT_SELECTED_NAME
- a String: the name of the action that was triggered.
This is usefull to make several actions all call the same method with the name, as passed
into the constructor, as the argument to that method.
- See Also:
- Constant Field Values
UICRadioAction
public UICRadioAction(String name,
Object targetObject,
String targetMethod,
String title,
ActionFactory actions)
UICRadioAction
public UICRadioAction(String name,
Object targetObject,
String targetMethod,
String title,
String iconBaseName,
ActionFactory actions)
UICRadioAction
public UICRadioAction(String name,
Object targetObject,
String targetMethod,
String title,
String iconBaseName,
String keyStroke,
ActionFactory actions)
UICRadioAction
public UICRadioAction(String name,
Object targetObject,
String targetMethod,
String title,
String iconBaseName,
String keyStroke,
String toolTipText,
String whatIsThis,
ActionFactory actions)
- Create new action.
- Parameters:
name
- The identifying name of the action, must be unique.targetObject
- The object that contains the method we want to connect to.targetMethod
- the name of the method we want to connect to.title
- the name used on buttons or in a menu entry.iconBaseName
- the basename the new widgets can use to fetch the correct icon, or null if nonekeyStroke
- the keyStroke in the format accepted by javax.swing.KeyStroke.getKeyStroke(String)toolTipText
- the text for tooltips, or null for nonewhatIsThis
- the text for the statusBar.actions
- the actionFactory this action belongs to.- See Also:
KeyStroke.getKeyStroke(String)
setExclusiveGroup
public UICRadioAction setExclusiveGroup(String exclusiveGroup)
getExclusiveGroup
public String getExclusiveGroup()
actionPerformed
public void actionPerformed(ActionEvent e)
- Specified by:
actionPerformed
in interface ActionListener
- Overrides:
actionPerformed
in class UICToggleAction
setSelected
public void setSelected(boolean on,
boolean silent)
- Description copied from class:
UICToggleAction
- Set this action to be un/selected selecting/checking all registered components.
- Overrides:
setSelected
in class UICToggleAction
- Parameters:
on
- set all the registred butons selection value to this argument.silent
- make sure this action will not fire even if 'on' is different from the previous selected value.
getTargetSignatures
protected List getTargetSignatures()
- Description copied from class:
UICSimpleAction
- Return a List object with instances of the Arguments class.
Extending classes should implement this to return all the target method
signatures that are searched for should the user create an action without
an Arguments instance.
An example implementation could be this:
List result = new ArrayList(1);
result.add( new Arguments().addArgument("Source") );
return result;
This will result in a call to UICSimpleAction.getArgumentClass(java.lang.String)
with the string
"Source"
which returns a Class instance. In our example
that would be java.lang.Object
.
The result of this would be that a call to setTarget
will try to find a method with an argument of type Object, and will search again
if that is not found without any arguments.
- Overrides:
getTargetSignatures
in class UICToggleAction
- Returns:
- a List object with instances of the Arguments class.
- See Also:
UICSimpleAction.getArgumentValue(java.util.EventObject, java.lang.String)
,
UICSimpleAction.getArgumentClass(java.lang.String)
getArgumentValue
protected Object getArgumentValue(EventObject source,
String argumentType)
- Description copied from class:
UICSimpleAction
- For the uniquely defined argumentType (as also used in
UICSimpleAction.getTargetSignatures()
) return the value.
This method will always return 'null';
Extending actions can define various argumentType strings that can be used as an
argument in the call to the target method of this action.
The user decides on construction of the action which argumentTypes are to be used,
if a certain value is requested to be sent to the targetMethod a call is made to this
method to find its value based on the source event.
Note that base types can not be returned, since they are instances of object;
you should wrap these in their object re-presentation (an Integer object for an int).
- Overrides:
getArgumentValue
in class UICToggleAction
- Parameters:
source
- the event that caused the action to be fired. This is the event that
the extending class passed to the execute
method; so casting is fine.argumentType
- the uniquely defined name specifying the type of argument.
- Returns:
- the value to be passed to the taget method.
getArgumentClass
protected Class getArgumentClass(String argumentType)
- Description copied from class:
UICSimpleAction
- For the uniquely defined argumentType (as also used in
UICSimpleAction.getTargetSignatures()
) return the Class.
This method will always return 'null';
Extending actions can define various argumentType strings that can be used as an
argument in the call to the target method of this action.
The user decides on construction of the action which argumentTypes are to be used,
if a certain value is requested to be sent to the targetMethod a call is made to this
method to find the Class of the type.
Note that basetypes have a class of their own and you should return the correct
one you expect the targetMethod to implement. returning Integer.class
will search for an Integer
; returing int.class
will search
for an int
. This is important to note since the UICSimpleAction.getArgumentValue(java.util.EventObject, java.lang.String)
method should return an Integer object in both cases.
- Overrides:
getArgumentClass
in class UICToggleAction
- Parameters:
argumentType
- the uniquely defined name specifying the type of argument.
- Returns:
- the class of this argument to be found on the target method
createMenuItem
public JMenuItem createMenuItem(IconFactory iconFactory)
- Overrides:
createMenuItem
in class UICToggleAction
createPopupMenuItem
public JMenuItem createPopupMenuItem(IconFactory iconFactory)
- Overrides:
createPopupMenuItem
in class UICAction
Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence