SEdit
Class CommandAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended bySEdit.CommandAction
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable

public class CommandAction
extends AbstractAction

The CommandAction defines a generic implementation of actionPerformed. Here actionPerformed simply calls the execute method on its command object.

See Also:
Serialized Form

Field Summary
protected  Executable command
           
 
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
CommandAction(Executable command, String name)
          This constructor creates an action without an icon.
CommandAction(Executable command, String name, Icon icon)
          This constructor creates an action with an icon.
CommandAction(Executable command, String name, Icon icon, String shortdesc, String longdesc)
          This constructor creates an action with an icon.
 
Method Summary
 void actionPerformed(ActionEvent e)
          actionPerformed is what executed the command. actionPerformed is called whenever the action is acted upon.
protected  Executable getCommand()
          This method retrieves the encapsulated command.
protected  void setCommand(Executable newValue)
          This method sets the action's command object.
 void setLongDescription(String v)
          Set the value of the long description.
 void setShortDescription(String v)
          Set the value of the short description.
 
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

command

protected Executable command
Constructor Detail

CommandAction

public CommandAction(Executable command,
                     String name)
This constructor creates an action without an icon.

Parameters:
command - the command for this action to act upon
name - the action's name

CommandAction

public CommandAction(Executable command,
                     String name,
                     Icon icon)
This constructor creates an action with an icon.

Parameters:
command - the command for this action to act upon
name - the action's name
icon - the action's icon

CommandAction

public CommandAction(Executable command,
                     String name,
                     Icon icon,
                     String shortdesc,
                     String longdesc)
This constructor creates an action with an icon.

Parameters:
command - the command for this action to act upon
name - the action's name
icon - the action's icon
shortdesc - the action's name
longdesc - the action's name
Method Detail

setShortDescription

public void setShortDescription(String v)
Set the value of the short description.

Parameters:
v - Value to assign to the short escription.

setLongDescription

public void setLongDescription(String v)
Set the value of the long description.

Parameters:
v - Value to assign to the long description.

actionPerformed

public void actionPerformed(ActionEvent e)
actionPerformed is what executed the command. actionPerformed is called whenever the action is acted upon.

Parameters:
e - the action event

getCommand

protected final Executable getCommand()
This method retrieves the encapsulated command.

Returns:
Executable

setCommand

protected final void setCommand(Executable newValue)
This method sets the action's command object.

Parameters:
newValue - the command for this action to act upon


Copyright © J. Ferber, O. Gutknecht All Rights Reserved.