swingx
Version 2005-08-19

org.jdesktop.swingx
Class LinkModel

java.lang.Object
  extended by org.jdesktop.swingx.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.


Field Summary
static String VISITED_PROPERTY
           
 
Constructor Summary
LinkModel()
           
LinkModel(String text)
           
LinkModel(String text, String target, String template, String[] args)
           
LinkModel(String text, String target, URL url)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 int compareTo(Object obj)
           
 boolean equals(Object obj)
           
protected  void firePropertyChange(String property, boolean oldValue, boolean newValue)
           
protected  void firePropertyChange(String property, Object oldValue, Object newValue)
           
 String getTarget()
          Return the target for the URL.
 String getText()
           
 URL getURL()
           
 boolean getVisited()
           
 int hashCode()
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void setTarget(String target)
          Set the target that the URL should load into.
 void setText(String text)
          Set the display text.
 void setURL(URL url)
          Set the url and resets the visited flag.
 void setURLString(String howToURLString)
           
 void setVisited(boolean visited)
          Sets a flag to indicate if the link has been visited.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VISITED_PROPERTY

public static final String VISITED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

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 Detail

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

swingx
Version 2005-08-19