phenote.gui.actions
Class ResponderChainAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by phenote.gui.actions.ResponderChainAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class ResponderChainAction
extends javax.swing.AbstractAction

An action which traverses the component hierarchy, beginning with the currently focused component, until it finds a object implementing a method with the name of the action's actionCommand. The method must accept no arguments. If an object in the component hierarchy implements the method "getResponderDelegate" or is a JComponent with a client property "responderDelegate", the object returned will also be queried for an implementation of the actionCommand.

Author:
Jim Balhoff
See Also:
Serialized Form

Field Summary
static java.lang.String CLIENT_PROPERTY
           
static java.lang.String DELEGATE_METHOD
           
 
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
ResponderChainAction(java.lang.String actionCommand)
          Creates a ResponderChainAction object which will try to invoke a method named by the given actionCommand.
ResponderChainAction(java.lang.String actionCommand, java.lang.String name)
          Creates a ResponderChainAction object which will try to invoke a method named by the given actionCommand.
ResponderChainAction(java.lang.String actionCommand, java.lang.String name, javax.swing.Icon icon)
          Creates a ResponderChainAction object which will try to invoke a method named by the given actionCommand.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Invoked when an action occurs.
 java.lang.String getActionCommand()
           
 java.lang.Object getFinalResponder()
           
 void setActionCommand(java.lang.String actionCommand)
           
 void setFinalResponder(java.lang.Object anObject)
           
 
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
 

Field Detail

DELEGATE_METHOD

public static java.lang.String DELEGATE_METHOD

CLIENT_PROPERTY

public static java.lang.String CLIENT_PROPERTY
Constructor Detail

ResponderChainAction

public ResponderChainAction(java.lang.String actionCommand)
Creates a ResponderChainAction object which will try to invoke a method named by the given actionCommand. The ResponderChainAction will use the actionCommand as the description string and a default icon.

Parameters:
actionCommand - The name of the method this action invokes.

ResponderChainAction

public ResponderChainAction(java.lang.String actionCommand,
                            java.lang.String name)
Creates a ResponderChainAction object which will try to invoke a method named by the given actionCommand. The ResponderChainAction will use the specified description string and a default icon.

Parameters:
actionCommand - The name of the method this action invokes.
name - The action's description string.

ResponderChainAction

public ResponderChainAction(java.lang.String actionCommand,
                            java.lang.String name,
                            javax.swing.Icon icon)
Creates a ResponderChainAction object which will try to invoke a method named by the given actionCommand. The ResponderChainAction will use the specified description string and the specified icon.

Parameters:
actionCommand - The name of the method this action invokes.
name - The action's description string.
icon - The action's icon.
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Invoked when an action occurs. The action searches the component hierarchy for a object which can respond to the action's actionCommand, and if successful invokes that method on the object.


getActionCommand

public java.lang.String getActionCommand()

setActionCommand

public void setActionCommand(java.lang.String actionCommand)

getFinalResponder

public java.lang.Object getFinalResponder()

setFinalResponder

public void setFinalResponder(java.lang.Object anObject)