Package org.jdesktop.swingx.hyperlink
Class LinkModelAction<T extends LinkModel>
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.jdesktop.swingx.action.AbstractActionExt
-
- org.jdesktop.swingx.hyperlink.AbstractHyperlinkAction<T>
-
- org.jdesktop.swingx.hyperlink.LinkModelAction<T>
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.ItemListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
public class LinkModelAction<T extends LinkModel> extends AbstractHyperlinkAction<T>
Specialized LinkAction for a target of typeLinkModel
.This action delegates actionPerformed to vistingDelegate. PENDING: move to swingx package?
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.event.ActionListener
delegate
private java.beans.PropertyChangeListener
linkListener
static java.lang.String
VISIT_ACTION
-
Fields inherited from class org.jdesktop.swingx.hyperlink.AbstractHyperlinkAction
target, VISITED_KEY
-
Fields inherited from class org.jdesktop.swingx.action.AbstractActionExt
GROUP, IS_STATE, LARGE_ICON
-
-
Constructor Summary
Constructors Constructor Description LinkModelAction()
LinkModelAction(java.awt.event.ActionListener visitingDelegate)
LinkModelAction(T target)
LinkModelAction(T target, java.awt.event.ActionListener visitingDelegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
This action delegates to the visitingDelegate if both delegate and target are != null, does nothing otherwise.private java.beans.PropertyChangeListener
getTargetListener()
protected void
installTarget()
installs a propertyChangeListener on the target and updates the visual properties from the target.void
setVisitingDelegate(java.awt.event.ActionListener delegate)
The delegate to invoke on actionPerformed.protected void
uninstallTarget()
removes the propertyChangeListener.protected void
updateFromTarget()
-
Methods inherited from class org.jdesktop.swingx.hyperlink.AbstractHyperlinkAction
getTarget, isVisited, itemStateChanged, setStateAction, setTarget, setVisited
-
Methods inherited from class org.jdesktop.swingx.action.AbstractActionExt
dispose, getAccelerator, getActionCommand, getGroup, getLargeIcon, getLongDescription, getMnemonic, getName, getShortDescription, getSmallIcon, isSelected, isStateAction, setAccelerator, setActionCommand, setGroup, setLargeIcon, setLongDescription, setMnemonic, setMnemonic, setName, setSelected, setShortDescription, setSmallIcon, setStateAction, toString
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
delegate
private java.awt.event.ActionListener delegate
-
VISIT_ACTION
public static final java.lang.String VISIT_ACTION
- See Also:
- Constant Field Values
-
linkListener
private java.beans.PropertyChangeListener linkListener
-
-
Method Detail
-
setVisitingDelegate
public void setVisitingDelegate(java.awt.event.ActionListener delegate)
The delegate to invoke on actionPerformed.The delegates actionPerformed is invoked with an ActionEvent having the target as source. Delegates are expected to cope gracefully with the T.
PENDING: JW - How to formalize?
- Parameters:
delegate
- the action invoked on the target.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
This action delegates to the visitingDelegate if both delegate and target are != null, does nothing otherwise. The actionEvent carries the target as source. PENDING: pass through a null target? - most probably!
-
installTarget
protected void installTarget()
installs a propertyChangeListener on the target and updates the visual properties from the target.- Overrides:
installTarget
in classAbstractHyperlinkAction<T extends LinkModel>
-
uninstallTarget
protected void uninstallTarget()
removes the propertyChangeListener.Implementation NOTE: this does not clean-up internal state! There is no need to because updateFromTarget handles both null and not-null targets. Hmm...
- Overrides:
uninstallTarget
in classAbstractHyperlinkAction<T extends LinkModel>
-
updateFromTarget
protected void updateFromTarget()
-
getTargetListener
private java.beans.PropertyChangeListener getTargetListener()
-
-