Class 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
    • 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()
      • firePropertyChange

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

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

        public int hashCode()
        Overrides:
        hashCode in class Object