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
FormActioninterface.This class serves as an adapter between the generic
FormActioninterface 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 StringCHECKEDConstant 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 ofSwingFormActionand initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(ActionEvent event)Callback method for action events.voidexecute(net.sf.jguiraffe.gui.builder.event.BuilderEvent event)Executes this action.StringgetName()Returns the name of this action.ObjectgetTask()Returns the task of this action.booleanisChecked()Returns the value of thecheckedproperty.voidsetChecked(boolean f)Sets the value of thecheckedproperty.voidsetTask(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 ofSwingFormActionand 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:
getNamein interfacenet.sf.jguiraffe.gui.builder.action.FormAction- Returns:
- the action's name
-
isChecked
public boolean isChecked()
Returns the value of thecheckedproperty.- Specified by:
isCheckedin interfacenet.sf.jguiraffe.gui.builder.action.FormAction- Returns:
- the
checkedproperty.
-
setChecked
public void setChecked(boolean f)
Sets the value of thecheckedproperty. This property is used for checked menu items or toggle buttons in toolbars.- Specified by:
setCheckedin 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:
getTaskin 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:
setTaskin 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 theclass.ActionHelper- Specified by:
executein 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:
actionPerformedin interfaceActionListener- Parameters:
event- the action event
-
-