Class AbstractHyperlinkAction<T>
java.lang.Object
javax.swing.AbstractAction
org.jdesktop.swingx.action.AbstractActionExt
org.jdesktop.swingx.hyperlink.AbstractHyperlinkAction<T>
- All Implemented Interfaces:
ActionListener, ItemListener, Serializable, Cloneable, EventListener, Action
- Direct Known Subclasses:
BasicCalendarHeaderHandler.ZoomOutAction, HyperlinkAction, LinkModelAction
Convenience implementation to simplify
JXHyperlink configuration and
provide minimal api. - See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Tthe object the actionPerformed can act on.static final StringKey for the visited property value.Fields inherited from class AbstractActionExt
GROUP, IS_STATE, LARGE_ICONFields inherited from class AbstractAction
changeSupport, enabledFields inherited from interface 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
ConstructorsConstructorDescriptionInstantiates a LinkAction with null target.AbstractHyperlinkAction(T target) Instantiates a LinkAction with a target of type targetClass. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhook for subclasses to update internal state after a new target has been set.booleanvoidCallback method asItemListener.voidsetStateAction(boolean state) Set the state property.voidPRE: isTargetable(target)voidsetVisited(boolean visited) Set the visited property.protected voidhook for subclasses to cleanup before the old target is overwritten.Methods inherited from class 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, toStringMethods inherited from class AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ActionListener
actionPerformed
-
Field Details
-
VISITED_KEY
-
target
the object the actionPerformed can act on.
-
-
Constructor Details
-
AbstractHyperlinkAction
public AbstractHyperlinkAction()Instantiates a LinkAction with null target. -
AbstractHyperlinkAction
Instantiates a LinkAction with a target of type targetClass. The visited property is initialized as defined byinstallTarget()- Parameters:
target- the target this action should act on.
-
-
Method Details
-
setVisited
public void setVisited(boolean visited) Set the visited property.- Parameters:
visited-
-
isVisited
public boolean isVisited()- Returns:
- visited state
-
getTarget
-
setTarget
-
installTarget
protected void installTarget()hook for subclasses to update internal state after a new target has been set.Subclasses are free to decide the details. Here:
- the text property is set to target.toString or empty String if the target is null
- visited is set to false.
-
uninstallTarget
protected void uninstallTarget()hook for subclasses to cleanup before the old target is overwritten.Subclasses are free to decide the details. Here: does nothing.
-
itemStateChanged
Description copied from class:AbstractActionExtCallback method asItemListener. Updates internal state based on the given ItemEvent.Here: synchs selected property if isStateAction(), does nothing otherwise.
- Specified by:
itemStateChangedin interfaceItemListener- Overrides:
itemStateChangedin classAbstractActionExt- Parameters:
e- the ItemEvent fired by a ItemSelectable on changing the selected state.
-
setStateAction
public void setStateAction(boolean state) Set the state property. Overridden to to nothing. PENDING: really?- Overrides:
setStateActionin classAbstractActionExt- Parameters:
state- if true then this action will fire ItemEvents
-