org.jhotdraw.app.action.edit
Class AbstractSelectionAction
java.lang.Object
javax.swing.AbstractAction
org.jhotdraw.app.action.edit.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.
Design Patterns
Framework
The interfaces and classes listed below work together:
Contract: EditableComponent
, JTextComponent
.
Client: AbstractSelectionAction
,
DeleteAction
,
DuplicateAction
,
SelectAllAction
,
ClearSelectionAction
.
- Version:
- $Id: AbstractSelectionAction.java 666 2010-07-28 19:11:46Z rawcoder $
- Author:
- Werner Randelshofer
- See Also:
- Serialized Form
Field Summary |
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. |
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 |
target
protected javax.swing.JComponent target
- The target of the action or null if the action acts on the currently
focused component.
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.
updateEnabled
protected void updateEnabled()