com.ibm.as400.util.html

Class HTMLTableCaption

  • All Implemented Interfaces:
    HTMLConstants, HTMLTagElement, Serializable


    public class HTMLTableCaption
    extends HTMLTagAttributes
    implements HTMLConstants, Serializable
    The HTMLTableCaption class represents an HTML Caption tag.

    This example creates an HTMLTableCaption object with an HTMLText object for the caption element.

      // Create an HTMLText object for the caption text.
      HTMLText captionText = new HTMLText("MY TABLE");
      // Create the HTMLTableCaption object with the new HTMLText object.
      HTMLTableCaption caption = new HTMLTableCaption(captionText);
      // Display the tag.
      System.out.println(caption.getTag());
      

    Here is the output of the tag:

      <caption>MY TABLE</caption>
      

    The equivalent tag using XSL Formatting Objects is:

    <fo:block><fo:block>MY TABLE</fo:block> </fo:block>

    This example creates an HTMLTableCaption object with an HTMLHyperlink object for the caption element.

      // Create an HTMLHyperlink object for the caption text.
      HTMLHyperlink companyLink = new HTMLHyperlink("http://www.myCompany.com", "My Company");
      // Create the HTMLTableCaption object with the new HTMLHyperlink object.
      HTMLTableCaption caption = new HTMLTableCaption(companyLink);
      caption.setAlignment(HTMLConstants.BOTTOM);
      // Display the tag.
      System.out.println(caption.getTag());
      

    Here is the output of the tag:

      <caption align="bottom"><a href="http://www.myCompany.com>My Company"</a></caption>
      

    HTMLTableCaption objects generate the following events:

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

      • HTMLTableCaption

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

        public HTMLTableCaption(HTMLTagElement element)
        Constructs an HTMLTableCaption object with the specified element.
        Parameters:
        element - An HTMLTagElement object.
    • Method Detail

      • getAlignment

        public String getAlignment()
        Returns the caption alignment relative to the table.
        Returns:
        The caption alignment. One of the following constants defined in HTMLConstants: BOTTOM, LEFT, RIGHT, or TOP.
        See Also:
        HTMLConstants
      • getDirection

        public String getDirection()
        Returns the direction of the text interpretation.
        Returns:
        The direction of the text.
      • getElement

        public HTMLTagElement getElement()
        Returns the element for the caption.
        Returns:
        An HTMLTagElement.
      • getLanguage

        public String getLanguage()
        Returns the language of the caption.
        Returns:
        The language of the caption.
      • getTag

        public String getTag()
        Returns the HTML caption tag.
        Specified by:
        getTag in interface HTMLTagElement
        Returns:
        The caption tag.
      • getFOTag

        public String getFOTag()
        Returns the XSL-FO caption tag. The language attribute is not supported in XSL-FO. The table caption will appear at the left of the page if align=left, right of the page if align=right, or at the center of the page for the rest of the alignments.
        Specified by:
        getFOTag in interface HTMLTagElement
        Returns:
        The caption tag.
      • 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.
      • setAlignment

        public void setAlignment(String alignment)
                          throws PropertyVetoException
        Sets the caption alignment relative to the table.
        Parameters:
        alignment - The caption alignment. One of the following constants defined in HTMLConstants: BOTTOM, LEFT, RIGHT, or TOP.
        Throws:
        PropertyVetoException - If the change is vetoed.
        See Also:
        HTMLConstants
      • setDirection

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

        public void setLanguage(String lang)
                         throws PropertyVetoException
        Sets the language of the caption.
        Parameters:
        lang - The language. Example language tags include: en and en-US.
        Throws:
        PropertyVetoException - If a change is vetoed.
      • 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 String toString()
        Returns the HTML caption tag.
        Overrides:
        toString in class Object
        Returns:
        The caption tag.