com.ibm.as400.util.html
Class HTMLHeading

java.lang.Object
  extended by com.ibm.as400.util.html.HTMLTagAttributes
      extended by com.ibm.as400.util.html.HTMLHeading
All Implemented Interfaces:
HTMLTagElement, Serializable

public class HTMLHeading
extends HTMLTagAttributes
implements Serializable

The HTMLHeading class represents a section heading in an HTML page.

This example creates a HTMLHeading tag:

  // Create an HTMLHeading.
  HTMLHeading header = new HTMLHeading(1, "My Heading", HTMLConstants.CENTER);
  System.out.println(header);
  

Here is the output of the HTMLHeading tag:

  <h1 align="center">My Heading</h1>
  

Calling getFOTag() would produce the following XSL Formatting Object tag:

<fo:block-container> <fo:block font-size='25pt' text-align='center'>My Heading</fo:block> </fo:block-container>

HTMLHeading objects generate the following events:

See Also:
Serialized Form

Constructor Summary
Constructor and Description
HTMLHeading()
          Constructs a default HTMLHeading object.
HTMLHeading(int level)
          Constructs an HTMLHeading object with the specified heading level.
HTMLHeading(int level, String text)
          Constructs an HTMLHeading object with the specified heading level and text.
HTMLHeading(int level, String text, String align)
          Constructs an HTMLHeading object with the specified heading level, text, and align.
 
Method Summary
Modifier and Type Method and Description
 String getAlign()
          Returns the alignment of the header.
 String getDirection()
          Returns the direction of the text interpretation.
 String getFOTag()
          Returns the tag for the XSL-FO heading.
 String getLanguage()
          Returns the language of the input element.
 int getLevel()
          Returns the level of the header.
 String getTag()
          Returns the tag for the HTML heading.
 String getText()
          Returns the text of the header.
 boolean isUseFO()
          Returns if Formatting Object tags are outputted.
 void setAlign(String align)
          Sets the horizontal alignment for the header.
 void setDirection(String dir)
          Sets the direction of the text interpretation.
 void setLanguage(String lang)
          Sets the language of the input tag.
 void setLevel(int level)
          Sets the level of the header.
 void setText(String text)
          Set the visible text to display in the header.
 void setUseFO(boolean useFO)
          Sets if Formatting Object tags should be used.
 String toString()
          Returns a String representation for the HTMLHeading tag.
 
Methods inherited from class com.ibm.as400.util.html.HTMLTagAttributes
addPropertyChangeListener, getAttributes, getAttributeString, removePropertyChangeListener, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTMLHeading

public HTMLHeading()
Constructs a default HTMLHeading object.


HTMLHeading

public HTMLHeading(int level)
Constructs an HTMLHeading object with the specified heading level.

Parameters:
level - The heading level.

HTMLHeading

public HTMLHeading(int level,
                   String text)
Constructs an HTMLHeading object with the specified heading level and text.

Parameters:
level - The heading level.
text - The heading text.

HTMLHeading

public HTMLHeading(int level,
                   String text,
                   String align)
Constructs an HTMLHeading object with the specified heading level, text, and align.

Parameters:
level - The heading level.
text - The heading text.
align - The heading alignment. One of the following constants defined in HTMLConstants: LEFT, RIGHT, or CENTER.
Method Detail

getAlign

public String getAlign()
Returns the alignment of the header.

Returns:
The alignment.

getDirection

public String getDirection()
Returns the direction of the text interpretation.

Returns:
The direction of the text.

getLanguage

public String getLanguage()
Returns the language of the input element.

Returns:
The language of the input element.

getLevel

public int getLevel()
Returns the level of the header.

Returns:
The level.

getText

public String getText()
Returns the text of the header.

Returns:
The text.

getTag

public String getTag()
Returns the tag for the HTML heading.

Specified by:
getTag in interface HTMLTagElement
Returns:
The tag.

getFOTag

public String getFOTag()
Returns the tag for the XSL-FO heading. The language attribute is not supported by XSL-FO.

Specified by:
getFOTag in interface HTMLTagElement
Returns:
The 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.

setAlign

public void setAlign(String align)
Sets the horizontal alignment for the header.

Parameters:
align - The alignment. One of the following constants defined in HTMLConstants: LEFT, RIGHT, or CENTER.
See Also:
HTMLConstants

setDirection

public void setDirection(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(String lang)
Sets the language of the input tag.

Parameters:
lang - The language. Example language tags include: en and en-US.

setLevel

public void setLevel(int level)
Sets the level of the header. Heading 1(H1) is rendered as the largest and most important section heading while Heading 6(H6) is rendered as the smallest (lowest importance) heading.

Parameters:
level - The heading level (1 - 6).
See Also:
HTMLConstants

setText

public void setText(String text)
Set the visible text to display in the header.

Parameters:
text - The text.

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 a String representation for the HTMLHeading tag.

Overrides:
toString in class Object
Returns:
The tag.