Class Link

java.lang.Object
com.groiss.gui.AbstractComponent
com.groiss.gui.component.Link
All Implemented Interfaces:
Component, Serializable, Cloneable, Comparable<Object>
Direct Known Subclasses:
SortableLink

public class Link extends AbstractComponent implements Comparable<Object>
A HTML link element (a). Note: this class has a natural ordering that is inconsistent with equals, There are cases where x.compareTo(y) is 0 and equals return false.
See Also:
  • Field Details

    • text

      protected String text
  • Constructor Details

    • Link

      public Link()
      Constructs a new empty link.
    • Link

      public Link(String href, String text)
    • Link

      @Deprecated public Link(String href, Object[] contents)
      Deprecated.
      Parameters:
      href -
      contents -
    • Link

      public Link(String href)
    • Link

      public Link(String href, Component text)
    • Link

      public Link(String href, Content text)
    • Link

      public Link(String href, String text, String target)
      Constructor with text, url and target.
      Parameters:
      href - the url of the link
      text - the description of the link
      target - the target where the link will open
    • Link

      public Link(String href, String text, String target, String styleClass)
      Constructor with text, url, target, and style.
      Parameters:
      href - the url of the link
      text - the description of the link
      target - the target where the link will open
      styleClass - the name of a CSS class
    • Link

      public Link(String href, Component text, String target, String styleClass)
    • Link

      public Link(String href, String text, String target, String styleClass, String id)
      Constructor with text, url, target, style, and id.
      Parameters:
      href - the url of the link
      text - the description of the link
      target - the target where the link will open
      styleClass - the name of a CSS class
      id - the uniqe element id
  • Method Details

    • addContent

      public Link addContent(Object... contents)
    • setHref

      public void setHref(String href)
      sets the link url
      Parameters:
      href - the url
    • getHref

      public String getHref()
    • setText

      public void setText(String text)
      sets the text
      Parameters:
      text - - the text String
    • setText

      public void setText(Component text)
    • getText

      public String getText()
    • setTarget

      public void setTarget(String target)
      sets the target where the link will open
      Parameters:
      target - - the target
    • getTarget

      public String getTarget()
    • setContent

      public void setContent(Object o)
      Set the href attribute.
      Specified by:
      setContent in interface Component
      Overrides:
      setContent in class AbstractComponent
      Parameters:
      o - - any object where the string representation is used for rendering
    • getContent

      public Object getContent()
      Set the href attribute.
      Specified by:
      getContent in interface Component
      Overrides:
      getContent in class AbstractComponent
      Returns:
      the href attribute
    • compareTo

      public int compareTo(Object o)
      Specified by:
      compareTo in interface Comparable<Object>