org.jhotdraw.app.action
Class AbstractSelectionAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.jhotdraw.app.action.AbstractSelectionAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
ClearSelectionAction, CopyAction, CutAction, DuplicateAction, PasteAction, SelectAllAction

public abstract class AbstractSelectionAction
extends javax.swing.AbstractAction

AbstractSelectionAction acts on the selection of a target component.

By default, the action is disabled when the target component is disabled or has no selection. * If the target component is null, updateEnabled does nothing. You can change this behavior by overriding method updateEnabled().

This action registers a WeakPropertyChangeListener on the component.

Version:
1.0 2010-01-10 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
private  java.beans.PropertyChangeListener propertyHandler
          This variable keeps a strong reference on the property change listener.
protected  javax.swing.JComponent target
          The target of the action or null if the action acts on the currently focused component.
 
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
AbstractSelectionAction(javax.swing.JComponent target)
          Creates a new instance which acts on the specified component.
 
Method Summary
protected  void updateEnabled()
           
 
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
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

target

protected javax.swing.JComponent target
The target of the action or null if the action acts on the currently focused component.


propertyHandler

private java.beans.PropertyChangeListener propertyHandler
This variable keeps a strong reference on the property change listener.

Constructor Detail

AbstractSelectionAction

public AbstractSelectionAction(javax.swing.JComponent target)
Creates a new instance which acts on the specified component.

Parameters:
target - The target of the action. Specify null for the currently focused component.
Method Detail

updateEnabled

protected void updateEnabled()