Class LinkModel

java.lang.Object
org.jdesktop.swingx.hyperlink.LinkModel
All Implemented Interfaces:
Comparable

public class LinkModel extends Object implements Comparable
An bean which represents an URL link. Text, URL and visited are bound properties. Compares by Text.
Author:
Mark Davidson, Jeanette Winzenburg
  • Field Details

  • Constructor Details

    • LinkModel

      public LinkModel(String text, String target, URL url)
      Parameters:
      text -
      target -
      url -
    • LinkModel

      public LinkModel()
    • LinkModel

      public LinkModel(String text)
    • LinkModel

      public LinkModel(String text, String target, String template, String[] args)
      Parameters:
      text - text to that a renderer would display
      target - the target that a URL should load into.
      template - a string that represents a URL with &{N} place holders for string substitution
      args - an array of strings which will be used for substitition
  • Method Details

    • setText

      public void setText(String text)
      Set the display text.
    • getText

      public String getText()
    • setURLString

      public void setURLString(String howToURLString)
    • setURL

      public void setURL(URL url)
      Set the url and resets the visited flag. Think: keep list of visited urls here?
    • getURL

      public URL getURL()
    • setTarget

      public void setTarget(String target)
      Set the target that the URL should load into. This can be a uri representing another control or the name of a window or special targets. See: http://www.w3c.org/TR/html401/present/frames.html#adef-target
    • getTarget

      public String getTarget()
      Return the target for the URL.
      Returns:
      value of the target. If null then "_blank" will be returned.
    • setVisited

      public void setVisited(boolean visited)
      Sets a flag to indicate if the link has been visited. The state of this flag can be used to render the color of the link.
    • getVisited

      public boolean getVisited()
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener l)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener l)
    • firePropertyChange

      protected void firePropertyChange(String property, Object oldValue, Object newValue)
    • firePropertyChange

      protected void firePropertyChange(String property, boolean oldValue, boolean newValue)
    • compareTo

      public int compareTo(Object obj)
      Specified by:
      compareTo in interface Comparable
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object