Class 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
    • Constructor Detail

      • SwingFormAction

        public SwingFormAction​(String aName,
                               Object aTask)
        Creates a new instance of SwingFormAction and initializes it. The task is checked (using ActionHelper) whether it is of an allowed type.
        Parameters:
        aName - the name of the action
        aTask - 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 interface net.sf.jguiraffe.gui.builder.action.FormAction
        Returns:
        the action's name
      • isChecked

        public boolean isChecked()
        Returns the value of the checked property.
        Specified by:
        isChecked in interface net.sf.jguiraffe.gui.builder.action.FormAction
        Returns:
        the checked property.
      • setChecked

        public void setChecked​(boolean f)
        Sets the value of the checked property. This property is used for checked menu items or toggle buttons in toolbars.
        Specified by:
        setChecked in interface net.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 interface net.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, ActionHelper is used.
        Specified by:
        setTask in interface net.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 ActionHelper class.
        Specified by:
        execute in interface net.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 interface ActionListener
        Parameters:
        event - the action event