ehsbe CommonsTM
Version 1.1.0rc3

com.ehsbe.commons.action
Class ManagedAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.ehsbe.commons.action.AbstractActionExt
          extended by com.ehsbe.commons.action.ManagedAction
All Implemented Interfaces:
ActionListener, ItemListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
BoundAction, CompositeAction, TriggerAction

public class ManagedAction
extends AbstractActionExt

An extended abstract action, which delegates action and item events to its listeners.

Version:
$Revision: 432 $
Author:
Jens Elkner
See Also:
Serialized Form

Field Summary
protected  CopyOnWriteArrayList<ActionListener> actionListeners
          all registered action listeners
protected  CopyOnWriteArrayList<ItemListener> itemListeners
          all registered item listeners
 
Fields inherited from class com.ehsbe.commons.action.AbstractActionExt
GROUP, IS_STATE, LARGE_ICON_P_KEY, SELECT_PROPERTY_NAME, SMALL_ICON_P_KEY
 
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
ManagedAction(String name)
          Create a action with the given name.
ManagedAction(String name, Icon icon)
          Create a action with the given name and icon.
ManagedAction(String name, String command)
          Constructs an Action with the label and command
ManagedAction(String name, String command, Icon icon)
          Constructs an action with the given name, icon and command key.
 
Method Summary
 void actionPerformed(ActionEvent e)
          
 void addActionListener(ActionListener listener)
          Register the given listener for receiving action events sent by registered actions of this instance.
 void addItemListener(ItemListener listener)
          Register the given listener for receiving item events sent by registered actions of this instance.
 ManagedAction clone()
          Create a copy of this object, but does not copy its item, action and property change listeners.
 void itemStateChanged(ItemEvent e)
          
 void removeActionListener(ActionListener listener)
          Unregister the given listener for receiving action events sent by registered actions of this instance.
 void removeItemListener(ItemListener listener)
          Unregister the given listener for receiving item events sent by registered actions of this instance.
 
Methods inherited from class com.ehsbe.commons.action.AbstractActionExt
dispose, getAccelerator, getActionCommand, getGroup, getLargeIcon, getLargePressedIcon, getLongDescription, getMnemonic, getName, getShortDescription, getSmallIcon, getSmallPressedIcon, isSelected, isStateAction, setAccelerator, setActionCommand, setGroup, setLargeIcon, setLargePressedIcon, setLongDescription, setMnemonic, setMnemonic, setName, setSelected, setShortDescription, setSmallIcon, setSmallPressedIcon, setStateAction, setStateAction, toString
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actionListeners

protected CopyOnWriteArrayList<ActionListener> actionListeners
all registered action listeners


itemListeners

protected CopyOnWriteArrayList<ItemListener> itemListeners
all registered item listeners

Constructor Detail

ManagedAction

public ManagedAction(String name)
Create a action with the given name.

Parameters:
name - action's name
See Also:
AbstractAction.AbstractAction(String)

ManagedAction

public ManagedAction(String name,
                     Icon icon)
Create a action with the given name and icon.

Parameters:
name - action's name
icon - small icon to set
See Also:
AbstractAction.AbstractAction(String, Icon)

ManagedAction

public ManagedAction(String name,
                     String command)
Constructs an Action with the label and command

Parameters:
name - name of the action usually used as a label
command - command key of the action

ManagedAction

public ManagedAction(String name,
                     String command,
                     Icon icon)
Constructs an action with the given name, icon and command key.

Parameters:
name - display name of the action
command - the value of the action command key
icon - icon to display
Method Detail

addActionListener

public void addActionListener(ActionListener listener)
Register the given listener for receiving action events sent by registered actions of this instance.

Parameters:
listener - listener to add

addItemListener

public void addItemListener(ItemListener listener)
Register the given listener for receiving item events sent by registered actions of this instance.

Parameters:
listener - listener to add

removeActionListener

public void removeActionListener(ActionListener listener)
Unregister the given listener for receiving action events sent by registered actions of this instance.

Parameters:
listener - listener to remove

removeItemListener

public void removeItemListener(ItemListener listener)
Unregister the given listener for receiving item events sent by registered actions of this instance.

Parameters:
listener - listener to remove

actionPerformed

public void actionPerformed(ActionEvent e)


itemStateChanged

public void itemStateChanged(ItemEvent e)


clone

public ManagedAction clone()
                    throws CloneNotSupportedException
Create a copy of this object, but does not copy its item, action and property change listeners.

Overrides:
clone in class AbstractActionExt
Returns:
a managed action
Throws:
CloneNotSupportedException

ehsbe CommonsTM
Version 1.1.0rc3

Copyright ©2005-2009 EHSBE, Walther-Rathenau-Str. 58, 39104 Magdeburg, Sachsen-Anhalt, Germany. All Rights Reserved.