com.ibm.as400.util.html

Class HTMLHead

  • All Implemented Interfaces:
    HTMLTagElement, java.io.Serializable


    public class HTMLHead
    extends HTMLTagAttributes
    implements java.io.Serializable
    The HTMLHead class represents an HTML head tag, which contains information about the HTML document.

    This example creates an HTMLHead tag:

      // Create an HTMLHead with a title.
      HTMLHead head = new HTMLHead("My HTML Document");
      
      // Create an HTMLMeta.
      HTMLMeta meta = new HTMLMeta("expires", "Mon, 01 Jun 2000 12:00:00 CST");
      HTMLMeta meta2 = new HTMLMeta("refresh", "5", "http://www.sample.com/next.html");
      
      // Add the meta information to the HTMLHead
      head.addMetaInformation(meta);
      head.addMetaInformation(meta2);
      

    Here is the output of the HTMLHead tag:

      <head>
      <meta http-equiv="expired" content="Mon, 06 Jun 2000 12:00:00 CST" />
      <meta http-equiv="refresh" content="5; URL=http://www.sample.com/next.html" />
      <title>My HTML Document</title>
      </head>
      
    Using XSL Formatting Objects, the head tag represents a page header.

    Calling getFOTag() would produce the following.

      <fo:static-content flow-name='xsl-region-before'>
      <fo:block-container>
      My HTML Document</fo:block-container>
      </fo:static-content>
      

    HTMLHead objects generate the following events:

    • ElementEvent - The events fired are:
      • elementAdded
      • elementRemoved
    • PropertyChangeEvent
    See Also:
    Serialized Form
    • Constructor Detail

      • HTMLHead

        public HTMLHead()
        Constructs a default HTMLHead object.
      • HTMLHead

        public HTMLHead(java.lang.String title)
        Constructs an HTMLHead object with the specified title.
        Parameters:
        title - The title of the HTML document.
      • HTMLHead

        public HTMLHead(java.lang.String title,
                HTMLMeta meta)
        Constructs an HTMLHead object with the specified title and meta information.
        Parameters:
        title - The title of the HTML document.
        meta - The HTML meta information.
    • Method Detail

      • addMetaInformation

        public void addMetaInformation(HTMLMeta meta)
        Adds HTMLMeta information to the HTMLHead. The <head> tag contains a list of <meta> tags.
        Parameters:
        meta - The meta information to add.
      • addMetaInformationElementListener

        public void addMetaInformationElementListener(ElementListener listener)
        Adds an ElementListener.
        Parameters:
        listener - The ElementListener.
      • 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 head element.
        Returns:
        The language of the head element.
      • getTag

        public java.lang.String getTag()
        Returns the tag for the HTML alignment.
        Specified by:
        getTag in interface HTMLTagElement
        Returns:
        The tag.
      • getFOTag

        public java.lang.String getFOTag()
        Returns the tag for the XSL-FO header. The language attribute and Meta tags are not supported in XSL-FO.
        Specified by:
        getFOTag in interface HTMLTagElement
        Returns:
        The tag.
      • getTitle

        public java.lang.String getTitle()
        Returns the title of the HTMLHead object.
        Returns:
        The title.
      • isUseFO

        public boolean isUseFO()
        Returns if Formatting Object tags are outputted. The default value is false.
        Returns:
        true if the output generated is an XSL formatting object, false if the output generated is HTML.
      • removeMetaInformationElementListener

        public void removeMetaInformationElementListener(ElementListener listener)
        Removes this ElementListener.
        Parameters:
        listener - The ElementListener.
      • removeMetaInformation

        public void removeMetaInformation(HTMLMeta meta)
        Removes an HTMLMeta from the HTMLHead.
        Parameters:
        meta - The meta information to remove.
      • setDirection

        public void setDirection(java.lang.String dir)
        Sets the direction of the text interpretation. Setting the direction will add the dir attribute to both the head tag and the title tag if one is being used.
        Parameters:
        dir - The direction. One of the following constants defined in HTMLConstants: LTR or RTL.
        See Also:
        HTMLConstants
      • setLanguage

        public void setLanguage(java.lang.String lang)
        Sets the language of the HTMLHead tag. Setting the language will add the lang attribute to both the head tag and the title tag if one is being used.
        Parameters:
        lang - The language. Example language tags include: en and en-US.
      • setTitle

        public void setTitle(java.lang.String title)
        Sets the title of the HTML document.
        Parameters:
        title - The title of the HTML document.
      • setUseFO

        public void setUseFO(boolean useFO)
        Sets if Formatting Object tags should be used. The default value is false.
        Parameters:
        useFO - - true if output generated is an XSL formatting object, false if the output generated is HTML.
      • toString

        public java.lang.String toString()
        Returns a String representation for the HTMLHead tag.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The tag.