org.springframework.richclient.command
Class SwingActionAdapter

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.springframework.richclient.command.SwingActionAdapter
All Implemented Interfaces:
ActionListener, PropertyChangeListener, Serializable, Cloneable, EventListener, Action

public class SwingActionAdapter
extends AbstractAction
implements PropertyChangeListener

An adapter between a Spring Rich Client ActionCommand and the Swing Action interface.

This adheres to the standard GoF Adapter pattern whereby this class acts as a wrapper around an underlying ActionCommand to give it the appearance of being an Action.

The PropertyChangeListener interface is also implemented so that instances can be notified of property change events being fired by their underlying command.

See Also:
Serialized Form

Field Summary
 
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
SwingActionAdapter(ActionCommand command)
          Creates a new SwingActionAdapter with the given underlying action command.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Delegates the handling of the given event to the underlying command.
 void propertyChange(PropertyChangeEvent event)
          
protected  void update()
          Updates this instance according to the properties provided by the underlying command.
 
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

SwingActionAdapter

public SwingActionAdapter(ActionCommand command)
Creates a new SwingActionAdapter with the given underlying action command. The newly created instance will add itself as a property change listener of the command.

Parameters:
command - The underlying action command.
Throws:
IllegalArgumentException - if command is null.
Method Detail

actionPerformed

public void actionPerformed(ActionEvent event)
Delegates the handling of the given event to the underlying command.

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - The action event to be handled.

propertyChange

public void propertyChange(PropertyChangeEvent event)

Specified by:
propertyChange in interface PropertyChangeListener

update

protected void update()
Updates this instance according to the properties provided by the underlying command.



Copyright © 2004-2008 The Spring Framework. All Rights Reserved.