Class SwingFormAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- net.sf.jguiraffe.gui.platform.swing.builder.action.SwingFormAction
-
- All Implemented Interfaces:
ActionListener
,Serializable
,Cloneable
,EventListener
,Action
,net.sf.jguiraffe.gui.builder.action.FormAction
public class SwingFormAction extends AbstractAction implements net.sf.jguiraffe.gui.builder.action.FormAction
A Swing specific implementation of the
FormAction
interface.This class serves as an adapter between the generic
FormAction
interface and Swing specific actions.- Version:
- $Id: SwingFormAction.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CHECKED
Constant for the CHECKED property.-
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
Constructors Constructor Description SwingFormAction(String aName, Object aTask)
Creates a new instance ofSwingFormAction
and initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(ActionEvent event)
Callback method for action events.void
execute(net.sf.jguiraffe.gui.builder.event.BuilderEvent event)
Executes this action.String
getName()
Returns the name of this action.Object
getTask()
Returns the task of this action.boolean
isChecked()
Returns the value of thechecked
property.void
setChecked(boolean f)
Sets the value of thechecked
property.void
setTask(Object task)
Sets the task of this action.-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
CHECKED
public static final String CHECKED
Constant for the CHECKED property.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SwingFormAction
public SwingFormAction(String aName, Object aTask)
Creates a new instance ofSwingFormAction
and initializes it. The task is checked (using
) whether it is of an allowed type.ActionHelper
- Parameters:
aName
- the name of the actionaTask
- the task with the executable code- Throws:
IllegalArgumentException
- if the name is null or the task is invalid
-
-
Method Detail
-
getName
public String getName()
Returns the name of this action.- Specified by:
getName
in interfacenet.sf.jguiraffe.gui.builder.action.FormAction
- Returns:
- the action's name
-
isChecked
public boolean isChecked()
Returns the value of thechecked
property.- Specified by:
isChecked
in interfacenet.sf.jguiraffe.gui.builder.action.FormAction
- Returns:
- the
checked
property.
-
setChecked
public void setChecked(boolean f)
Sets the value of thechecked
property. This property is used for checked menu items or toggle buttons in toolbars.- Specified by:
setChecked
in interfacenet.sf.jguiraffe.gui.builder.action.FormAction
- Parameters:
f
- the value of the property
-
getTask
public Object getTask()
Returns the task of this action.- Specified by:
getTask
in interfacenet.sf.jguiraffe.gui.builder.action.FormAction
- Returns:
- the task
-
setTask
public void setTask(Object task)
Sets the task of this action. The passed in object must be supported by this action. To check this,
is used.ActionHelper
- Specified by:
setTask
in interfacenet.sf.jguiraffe.gui.builder.action.FormAction
- Parameters:
task
- the new task- Throws:
IllegalArgumentException
- if the task object is not allowed
-
execute
public void execute(net.sf.jguiraffe.gui.builder.event.BuilderEvent event)
Executes this action. This method delegates the call to the internally stored task object. Invocation of this task is delegated to the
class.ActionHelper
- Specified by:
execute
in interfacenet.sf.jguiraffe.gui.builder.action.FormAction
- Parameters:
event
- the causing event
-
actionPerformed
public void actionPerformed(ActionEvent event)
Callback method for action events. This method is called when the associated action is triggered. It delegates the call to the internal task object.- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
event
- the action event
-
-