edu.neu.ccs.gui
Class SimpleAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byedu.neu.ccs.gui.SimpleAction
All Implemented Interfaces:
Action, ActionListener, ChangeListener, Cloneable, EventListener, PropertyChangeListener, Serializable
Direct Known Subclasses:
PaintableButton.RefreshListener, PaintableComponent.RefreshListener

public abstract class SimpleAction
extends AbstractAction
implements ChangeListener, PropertyChangeListener

A trivial extension of the Java AbstractAction class used to simplify the programming interface for a class representing a GUI action. For convenience, this class also implements ChangeListener and PropertyChangeListener

Since:
1.0.1
Version:
2.3
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
SimpleAction()
          Constructs a simple action with no name or icon.
SimpleAction(String name)
          Constructs a simple action with the given name but no icon.
SimpleAction(String name, Icon icon)
          Constructs a simple action with the given name and icon.
 
Method Summary
 void actionPerformed(ActionEvent evt)
          Performs this action by calling the simplified perform method of this class.
abstract  void perform()
          Performs the tasks encapsulated by this action.
 void propertyChange(PropertyChangeEvent evt)
          Performs this property change action by calling the simplified perform method of this class.
 void stateChanged(ChangeEvent evt)
          Performs this state change action by calling the simplified perform method of this class.
 
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
 

Constructor Detail

SimpleAction

public SimpleAction()
Constructs a simple action with no name or icon.


SimpleAction

public SimpleAction(String name)
Constructs a simple action with the given name but no icon.

Parameters:
name - the name for this action

SimpleAction

public SimpleAction(String name,
                    Icon icon)
Constructs a simple action with the given name and icon.

Parameters:
name - the name for this action
icon - the icon for this action
Method Detail

actionPerformed

public final void actionPerformed(ActionEvent evt)
Performs this action by calling the simplified perform method of this class.

Specified by:
actionPerformed in interface ActionListener
Parameters:
evt - an object encapsulating an event that triggered this action

stateChanged

public final void stateChanged(ChangeEvent evt)
Performs this state change action by calling the simplified perform method of this class.

Specified by:
stateChanged in interface ChangeListener
Parameters:
evt - an object encapsulating an event that triggered this action

propertyChange

public final void propertyChange(PropertyChangeEvent evt)
Performs this property change action by calling the simplified perform method of this class.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - an object encapsulating an event that triggered this action

perform

public abstract void perform()
Performs the tasks encapsulated by this action. Subclasses should override this method to provide tasks this action performs.