Package org.jdesktop.swingx.hyperlink
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 Summary
Fields Modifier and Type Field Description static StringVISITED_PROPERTY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener l)intcompareTo(Object obj)booleanequals(Object obj)protected voidfirePropertyChange(String property, boolean oldValue, boolean newValue)protected voidfirePropertyChange(String property, Object oldValue, Object newValue)StringgetTarget()Return the target for the URL.StringgetText()URLgetURL()booleangetVisited()inthashCode()voidremovePropertyChangeListener(PropertyChangeListener l)voidsetTarget(String target)Set the target that the URL should load into.voidsetText(String text)Set the display text.voidsetURL(URL url)Set the url and resets the visited flag.voidsetURLString(String howToURLString)voidsetVisited(boolean visited)Sets a flag to indicate if the link has been visited.StringtoString()
-
-
-
Field Detail
-
VISITED_PROPERTY
public static final String VISITED_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 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(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:
compareToin interfaceComparable
-
-