java.awt.event.ActionListener
, java.awt.event.ItemListener
, java.io.Serializable
, java.lang.Cloneable
, java.util.EventListener
, javax.swing.Action
LinkModelAction
public abstract class LinkAction<T> extends AbstractActionExt
JXHyperlink
configuration and
provide minimal api as needed by a org.jdesktop.swingx.hyperlink.LinkRenderer
. PENDING: rename to AbstractLinkAction
Modifier and Type | Field | Description |
---|---|---|
protected T |
target |
the object the actionPerformed can act on.
|
static java.lang.String |
VISITED_KEY |
Key for the visited property value.
|
GROUP, IS_STATE, LARGE_ICON
Constructor | Description |
---|---|
LinkAction() |
Instantiates a LinkAction with null target.
|
LinkAction(T target) |
Instantiates a LinkAction with a target of type targetClass.
|
Modifier and Type | Method | Description |
---|---|---|
T |
getTarget() |
|
protected void |
installTarget() |
hook for subclasses to update internal state after
a new target has been set.
|
boolean |
isVisited() |
|
void |
itemStateChanged(java.awt.event.ItemEvent e) |
Callback method as
ItemListener . |
void |
setStateAction(boolean state) |
Set the state property.
|
void |
setTarget(T target) |
PRE: isTargetable(target)
|
void |
setVisited(boolean visited) |
Set the visited property.
|
protected void |
uninstallTarget() |
hook for subclasses to cleanup before the old target
is overwritten.
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
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
public static final java.lang.String VISITED_KEY
protected T target
public LinkAction()
public LinkAction(T target)
installTarget()
target
- the target this action should act on.public void setVisited(boolean visited)
visited
- public boolean isVisited()
public T getTarget()
public void setTarget(T target)
target
- protected void installTarget()
Subclasses are free to decide the details. Here:
protected void uninstallTarget()
Subclasses are free to decide the details. Here: does nothing.
public void itemStateChanged(java.awt.event.ItemEvent e)
AbstractActionExt
ItemListener
. Updates internal state based
on the given ItemEvent. Here: synchs selected property if isStateAction(), does nothing otherwise.
itemStateChanged
in interface java.awt.event.ItemListener
itemStateChanged
in class AbstractActionExt
e
- the ItemEvent fired by a ItemSelectable on changing the selected
state.public void setStateAction(boolean state)
setStateAction
in class AbstractActionExt
state
- if true then this action will fire ItemEvents