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.ComparableAn 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.StringVISITED_PROPERTY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)intcompareTo(java.lang.Object obj)booleanequals(java.lang.Object obj)protected voidfirePropertyChange(java.lang.String property, boolean oldValue, boolean newValue)protected voidfirePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)java.lang.StringgetTarget()Return the target for the URL.java.lang.StringgetText()java.net.URLgetURL()booleangetVisited()inthashCode()voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)voidsetTarget(java.lang.String target)Set the target that the URL should load into.voidsetText(java.lang.String text)Set the display text.voidsetURL(java.net.URL url)Set the url and resets the visited flag.voidsetURLString(java.lang.String howToURLString)voidsetVisited(boolean visited)Sets a flag to indicate if the link has been visited.java.lang.StringtoString()
-
-
-
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:
compareToin interfacejava.lang.Comparable
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-