com.ibm.as400.util.html

Class HTMLHyperlink

  • All Implemented Interfaces:
    HTMLConstants, HTMLTagElement, java.io.Serializable
    Direct Known Subclasses:
    ServletHyperlink


    public class HTMLHyperlink
    extends HTMLTagAttributes
    implements HTMLConstants, java.io.Serializable
    The HTMLHyperlink class represents an HTML hyperlink tag.

    This example creates an HTMLHyperlink and displays the HTML tag.

      HTMLHyperlink link = new HTMLHyperlink("http://www.myCompany.com", "myCompany Home Page");
      System.out.println(link.getTag());
      

    Here is the output of the HTMLHyperlink:

      <a href="http://www.myCompany.com">myCompany Home Page</a>
      

    This example creates an HTMLHyperlink and sets two properties.

      HTMLHyperlink link = new HTMLHyperlink("http://www.myCompany.com", "myCompany Home Page");
      Properties properties = new Properties();
      properties.put("userID", "fred");
      properties.put("employeeID", "01234567");
      link.setProperties(properties);
      System.out.println(link.getTag());
      

    Here is the output of the HTMLHyperlink:

      <a href="http://www.myCompany.com?userid=fred&employeeID=01234567">myCompany Home Page</a>
      

    HTMLHyperlink objects generate the following events:

    • PropertyChangeEvent
    • VetoableChangeEvent
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      HTMLHyperlink()
      Creates a default HTMLHyperlink object.
      HTMLHyperlink(java.lang.String link)
      Creates an HTMLHyperlink object with the specified resource link.
      HTMLHyperlink(java.lang.String link, java.lang.String text)
      Creates an HTMLHyperlink object with the specified resource link represented by the specified text.
      HTMLHyperlink(java.lang.String link, java.lang.String text, java.lang.String target)
      Creates an HTMLHyperlink object with the specified resource link and target frame represented by the specified text.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Adds the VetoableChangeListener.
      java.lang.Object clone()
      Returns a copy of the HTMLHyperlink.
      java.lang.String getDirection()
      Returns the direction of the text interpretation.
      java.lang.String getFOTag()
      Returns a comment tag.
      java.lang.String getLanguage()
      Returns the language of the input element.
      java.lang.String getLink()
      Returns the Uniform Resource Identifier (URI) for the resource link.
      java.lang.String getLocation()
      Returns the bookmark locatoin of the resource link.
      java.lang.String getName()
      Returns the bookmark name.
      java.util.Properties getProperties()
      Returns the properties associated with the link resource.
      java.lang.String getTag()
      Returns the HTML tag that represents the resource link.
      java.lang.String getTag(java.lang.String text, java.util.Properties properties)
      Returns the HTML tag that represents the resource link with the specified text and properties.
      java.lang.String getTag(java.lang.String text, java.lang.String name, java.lang.String link, java.util.Properties properties)
      Returns the HTML tag that represents the resource link with the specified text, bookmark name, resource link, and properties.
      java.lang.String getTarget()
      Returns the target frame for the resource link.
      java.lang.String getText()
      Returns the text that represents the resource link.
      java.lang.String getTitle()
      Returns the title for the resource link.
      void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Removes the VetoableChangeListener from the internal list.
      void setDirection(java.lang.String dir)
      Sets the direction of the text interpretation.
      void setLanguage(java.lang.String lang)
      Sets the language of the input tag.
      void setLink(java.lang.String link)
      Sets the Uniform Resource Identifier (URI) for the resource link.
      void setLocation(java.lang.String location)
      Sets the bookmark location of the resource link within a document.
      void setName(java.lang.String name)
      Sets the bookmark name.
      void setProperties(java.util.Properties properties)
      Sets the properties associated with the resource link.
      void setTarget(java.lang.String target)
      Sets the target frame for the resource link.
      void setText(java.lang.String text)
      Sets the text representation for the resource link.
      void setTitle(java.lang.String title)
      Sets the title for the resource link.
      java.lang.String toString()
      Returns the HTML tag that represents the resource link.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HTMLHyperlink

        public HTMLHyperlink()
        Creates a default HTMLHyperlink object.
      • HTMLHyperlink

        public HTMLHyperlink(java.lang.String link)
        Creates an HTMLHyperlink object with the specified resource link.
        Parameters:
        link - The Uniform Resource Identifier (URI).
      • HTMLHyperlink

        public HTMLHyperlink(java.lang.String link,
                     java.lang.String text)
        Creates an HTMLHyperlink object with the specified resource link represented by the specified text.
        Parameters:
        link - The Uniform Resource Identifier (URI).
        text - The text representation for the resource.
      • HTMLHyperlink

        public HTMLHyperlink(java.lang.String link,
                     java.lang.String text,
                     java.lang.String target)
        Creates an HTMLHyperlink object with the specified resource link and target frame represented by the specified text.
        Parameters:
        link - The Uniform Resource Identifier (URI).
        text - The text representation for the resource.
        target - The target frame.
    >
    • Method Detail

      • addVetoableChangeListener

        public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
        Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method is called each time the value of any constrained property is changed.
        Parameters:
        listener - The VetoableChangeListener.
        See Also:
        removeVetoableChangeListener(java.beans.VetoableChangeListener)
      • clone

        public java.lang.Object clone()
        Returns a copy of the HTMLHyperlink.
        Overrides:
        clone in class java.lang.Object
        Returns:
        An HTMLHyperlink.
      • getDirection

        public java.lang.String getDirection()
        Returns the direction of the text interpretation.
        Returns:
        The direction of the text.
      • getLanguage

        public java.lang.String getLanguage()
        Returns the language of the input element.
        Returns:
        The language of the input element.
      • getLink

        public java.lang.String getLink()
        Returns the Uniform Resource Identifier (URI) for the resource link.
        Returns:
        The Uniform Resource Identifier.
      • getLocation

        public java.lang.String getLocation()
        Returns the bookmark locatoin of the resource link.
        Returns:
        The location.
      • getName

        public java.lang.String getName()
        Returns the bookmark name.
        Returns:
        The name.
      • getProperties

        public java.util.Properties getProperties()
        Returns the properties associated with the link resource.
        Returns:
        The properties.
      • getTarget

        public java.lang.String getTarget()
        Returns the target frame for the resource link.
        Returns:
        The target frame. a user-defined frame or one of the following constants defined in HTMLConstants: TARGET_BLANK, TARGET_PARENT, TARGET_SELF, or TARGET_TOP.
        See Also:
        HTMLConstants
      • getText

        public java.lang.String getText()
        Returns the text that represents the resource link. This the text that is shown in the HTML document.
        Returns:
        The text.
      • getTitle

        public java.lang.String getTitle()
        Returns the title for the resource link.
        Returns:
        The title.
      • getFOTag

        public java.lang.String getFOTag()
        Returns a comment tag. This method should not be called. There is no XSL-FO support for this class.
        Specified by:
        getFOTag in interface HTMLTagElement
        Returns:
        The comment tag.
      • getTag

        public java.lang.String getTag()
        Returns the HTML tag that represents the resource link.
        Specified by:
        getTag in interface HTMLTagElement
        Returns:
        The HTML tag.
      • getTag

        public java.lang.String getTag(java.lang.String text,
                              java.util.Properties properties)
        Returns the HTML tag that represents the resource link with the specified text and properties. The original HTMLHyperlink object text and properties are not changed/updated.
        Parameters:
        text - The text.
        properties - The Properties.
        Returns:
        The HTML tag.
      • getTag

        public java.lang.String getTag(java.lang.String text,
                              java.lang.String name,
                              java.lang.String link,
                              java.util.Properties properties)
        Returns the HTML tag that represents the resource link with the specified text, bookmark name, resource link, and properties. The original HTMLHyperlink object text, bookmark name, resource link, and properties are not changed/updated.
        Parameters:
        text - The text.
        name - The bookmark name.
        link - The Uniform Resource Identifier (URI).
        properties - The Properties.
        Returns:
        The HTML tag.
      • removeVetoableChangeListener

        public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
        Removes the VetoableChangeListener from the internal list. If the VetoableChangeListener is not on the list, nothing is done.
        Parameters:
        listener - The VetoableChangeListener.
        See Also:
        addVetoableChangeListener(java.beans.VetoableChangeListener)
      • setDirection

        public void setDirection(java.lang.String dir)
                          throws java.beans.PropertyVetoException
        Sets the direction of the text interpretation.
        Parameters:
        dir - The direction. One of the following constants defined in HTMLConstants: LTR or RTL.
        Throws:
        java.beans.PropertyVetoException - If a change is vetoed.
        See Also:
        HTMLConstants
      • setLanguage

        public void setLanguage(java.lang.String lang)
                         throws java.beans.PropertyVetoException
        Sets the language of the input tag.
        Parameters:
        lang - The language. Example language tags include: en and en-US.
        Throws:
        java.beans.PropertyVetoException - If a change is vetoed.
      • setLocation

        public void setLocation(java.lang.String location)
        Sets the bookmark location of the resource link within a document. The location is denoted with the # symbol at the end of the link followed by a location. (ie - http://myPage.html#myBookmarkLocation)
        Parameters:
        location - The location.
      • setLink

        public void setLink(java.lang.String link)
                     throws java.beans.PropertyVetoException
        Sets the Uniform Resource Identifier (URI) for the resource link.
        Parameters:
        link - The Uniform Resource Identifier.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setName

        public void setName(java.lang.String name)
                     throws java.beans.PropertyVetoException
        Sets the bookmark name.
        Parameters:
        name - The bookmark name.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setProperties

        public void setProperties(java.util.Properties properties)
                           throws java.beans.PropertyVetoException
        Sets the properties associated with the resource link. The properties are the attributes associated with the Uniform Resource Identifier.
        Parameters:
        properties - The properties.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setTarget

        public void setTarget(java.lang.String target)
                       throws java.beans.PropertyVetoException
        Sets the target frame for the resource link.
        Parameters:
        target - The target frame. A user-defined frame or one of the following constants defined in HTMLConstants: TARGET_BLANK, TARGET_PARENT, TARGET_SELF, or TARGET_TOP.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
        See Also:
        HTMLConstants
      • setText

        public void setText(java.lang.String text)
                     throws java.beans.PropertyVetoException
        Sets the text representation for the resource link. This is the text that is shown in the HTML document.
        Parameters:
        text - The text.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setTitle

        public void setTitle(java.lang.String title)
                      throws java.beans.PropertyVetoException
        Sets the title for the resource link.
        Parameters:
        title - The title.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • toString

        public java.lang.String toString()
        Returns the HTML tag that represents the resource link.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The HTML tag.