com.ibm.as400.util.html

Class HTMLAlign

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


    public class HTMLAlign
    extends HTMLTagAttributes
    implements java.io.Serializable
    The HTMLAlign class represents a block formatting element, which uses the HTML <DIV> tag, within an HTML page. The tag has an implied line break before and after the tag.

    This example creates a HTMLAlign tag:

      // Create an ordered list.
      OrderedList list = new OrderedList(HTMLConstants.LARGE_ROMAN);
      OrderedListItem listItem = new OrderedListItem();
      listItem.setItemData(new HTMLText("my list item"));
      list.addListItem(listItem);
      
      // Align the list.
      HTMLAlign align = new HTMLAlign(list, HTMLConstants.CENTER);
      System.out.println(align);
      

    Here is the output of the HTMLAlign tag:

      <div align="center">
      <ol type="I">
      <li type="i">my list item</li>
      </ol>
      </div>
      

    Calling getFOTag() would produce the following:

      <fo:block text-align='center'>
      <fo:block-container>
      <fo:list-block>
      <fo:list-item>
      <fo:list-item-label>I.</fo:list-item-label>
      <fo:list-item-body><fo:block-container><fo:block>my list item</fo:block>
      </fo:block-container>
      </fo:list-item-body>
      </fo:list-item>
      </fo:list-block>
      </fo:block-container>
      </fo:block>
      

    HTMLAlign objects generate the following events:

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

      • HTMLAlign

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

        public HTMLAlign(HTMLTagElement data)
        Constructs an HTMLAlign object with the specified data. The default alignment is left.
        Parameters:
        data - The data to align.
      • HTMLAlign

        public HTMLAlign(HTMLTagElement data,
                 java.lang.String align)
        Constructs an HTMLAlign object with the specified data and align attribute.
        Parameters:
        data - The data to align.
        align - The type of alignment. One of the following constants defined in HTMLConstants: LEFT, RIGHT, or CENTER.
    • Method Detail

      • addItem

        public void addItem(HTMLTagElement data)
        Adds an HTMLTagElement to the list of tags to align.
        Parameters:
        data - The data to align.
      • addItemElementListener

        public void addItemElementListener(ElementListener listener)
        Adds an ElementListener.
        Parameters:
        listener - The ElementListener.
      • getAlign

        public java.lang.String getAlign()
        Returns the alignment of the HTMLAlign object.
        Returns:
        The alignment.
      • 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.
      • 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 alignment. The language attribute is not supported in XSL-FO.
        Specified by:
        getFOTag in interface HTMLTagElement
        Returns:
        The tag.
      • removeItemElementListener

        public void removeItemElementListener(ElementListener listener)
        Removes this ElementListener.
        Parameters:
        listener - The ElementListener.
      • 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.
      • removeItem

        public void removeItem(HTMLTagElement data)
        Removes an HTMLTagElement from the list of tags to align.
        Parameters:
        data - The data to remove.
      • setAlign

        public void setAlign(java.lang.String align)
        Sets the horizontal alignment for a block of HTML. The default is left alignment.
        Parameters:
        align - The alignment. One of the following constants defined in HTMLConstants: LEFT, RIGHT, or CENTER.
        See Also:
        HTMLConstants
      • setDirection

        public void setDirection(java.lang.String dir)
        Sets the direction of the text interpretation.
        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 HTMLAlign tag.
        Parameters:
        lang - The language. Example language tags include: en and en-US.
      • 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 HTMLAlign tag.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The tag.