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

public abstract class AbstractHyperlinkAction<T> extends AbstractActionExt
Convenience implementation to simplify JXHyperlink configuration and provide minimal api.
Author:
Jeanette Winzenburg
See Also:
  • Field Details

    • VISITED_KEY

      public static final String VISITED_KEY
      Key for the visited property value.
      See Also:
    • target

      protected T target
      the object the actionPerformed can act on.
  • Constructor Details

    • AbstractHyperlinkAction

      public AbstractHyperlinkAction()
      Instantiates a LinkAction with null target.
    • AbstractHyperlinkAction

      public AbstractHyperlinkAction(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 Details

    • setVisited

      public void setVisited(boolean visited)
      Set the visited property.
      Parameters:
      visited - boolean value of the prop
    • isVisited

      public boolean isVisited()
      Returns:
      visited state
    • getTarget

      public T getTarget()
      get the object the actionPerformed acts on.
      Returns:
      target
    • setTarget

      public void setTarget(T target)
      set the object the actionPerformed cam act on. PRE: isTargetable(target)
      Parameters:
      target - generic object
    • 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

      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