swingx
Version 2005-08-19

org.jdesktop.swingx.action
Class LinkAction<T>

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.jdesktop.swingx.action.AbstractActionExt
          extended by org.jdesktop.swingx.action.LinkAction<T>
All Implemented Interfaces:
ActionListener, ItemListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
LinkModelAction

public abstract class LinkAction<T>
extends AbstractActionExt

Convenience implementation to simplify JXHyperlink configuration and provide minimal api as needed by a LinkRenderer.

PENDING: rename to AbstractLinkAction

See Also:
Serialized Form

Field Summary
protected  T target
          the object the actionPerformed can act on.
static String VISITED_KEY
          Key for the visited property value.
 
Fields inherited from class org.jdesktop.swingx.action.AbstractActionExt
GROUP, IS_STATE, LARGE_ICON
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
LinkAction()
          Instantiates a LinkAction with null target.
LinkAction(T target)
          Instantiates a LinkAction with a target of type targetClass.
 
Method Summary
 T getTarget()
           
protected  void installTarget()
          hook for subclasses to update internal state after a new target has been set.
 boolean isVisited()
           
 void itemStateChanged(ItemEvent e)
           
 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.
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

VISITED_KEY

public static final String VISITED_KEY
Key for the visited property value.

See Also:
Constant Field Values

target

protected T target
the object the actionPerformed can act on.

Constructor Detail

LinkAction

public LinkAction()
Instantiates a LinkAction with null target.


LinkAction

public LinkAction(T target)
Instantiates a LinkAction with a target of type targetClass. The visited property is initialized as defined by installTarget()

Parameters:
target - the target this action should act on.
Method Detail

setVisited

public void setVisited(boolean visited)
Set the visited property.

Parameters:
visited -

isVisited

public boolean isVisited()
Returns:
visited state

getTarget

public T getTarget()

setTarget

public void setTarget(T target)
PRE: isTargetable(target)

Parameters:
target -

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:


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

public void itemStateChanged(ItemEvent e)
Specified by:
itemStateChanged in interface ItemListener
Overrides:
itemStateChanged in class AbstractActionExt

setStateAction

public void setStateAction(boolean state)
Set the state property. Overridden to to nothing. PENDING: really?

Overrides:
setStateAction in class AbstractActionExt
Parameters:
state - if true then this action will fire ItemEvents

swingx
Version 2005-08-19