Package org.jdesktop.swingx.hyperlink
Class LinkModel
- java.lang.Object
-
- org.jdesktop.swingx.hyperlink.LinkModel
-
- All Implemented Interfaces:
java.lang.Comparable
public class LinkModel extends java.lang.Object implements java.lang.Comparable
An bean which represents an URL link. Text, URL and visited are bound properties. Compares by Text.- Author:
- Mark Davidson, Jeanette Winzenburg
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
VISITED_PROPERTY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener l)
int
compareTo(java.lang.Object obj)
boolean
equals(java.lang.Object obj)
protected void
firePropertyChange(java.lang.String property, boolean oldValue, boolean newValue)
protected void
firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
java.lang.String
getTarget()
Return the target for the URL.java.lang.String
getText()
java.net.URL
getURL()
boolean
getVisited()
int
hashCode()
void
removePropertyChangeListener(java.beans.PropertyChangeListener l)
void
setTarget(java.lang.String target)
Set the target that the URL should load into.void
setText(java.lang.String text)
Set the display text.void
setURL(java.net.URL url)
Set the url and resets the visited flag.void
setURLString(java.lang.String howToURLString)
void
setVisited(boolean visited)
Sets a flag to indicate if the link has been visited.java.lang.String
toString()
-
-
-
Field Detail
-
VISITED_PROPERTY
public static final java.lang.String VISITED_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LinkModel
public LinkModel(java.lang.String text, java.lang.String target, java.net.URL url)
- Parameters:
text
-target
-url
-
-
LinkModel
public LinkModel()
-
LinkModel
public LinkModel(java.lang.String text)
-
LinkModel
public LinkModel(java.lang.String text, java.lang.String target, java.lang.String template, java.lang.String[] args)
- Parameters:
text
- text to that a renderer would displaytarget
- the target that a URL should load into.template
- a string that represents a URL with &{N} place holders for string substitutionargs
- an array of strings which will be used for substitition
-
-
Method Detail
-
setText
public void setText(java.lang.String text)
Set the display text.
-
getText
public java.lang.String getText()
-
setURLString
public void setURLString(java.lang.String howToURLString)
-
setURL
public void setURL(java.net.URL url)
Set the url and resets the visited flag. Think: keep list of visited urls here?
-
getURL
public java.net.URL getURL()
-
setTarget
public void setTarget(java.lang.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 java.lang.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(java.beans.PropertyChangeListener l)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
-
firePropertyChange
protected void firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
-
firePropertyChange
protected void firePropertyChange(java.lang.String property, boolean oldValue, boolean newValue)
-
compareTo
public int compareTo(java.lang.Object obj)
- Specified by:
compareTo
in interfacejava.lang.Comparable
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-