com.ibm.as400.util.html
Class HTMLHeading
- java.lang.Object
-
- com.ibm.as400.util.html.HTMLTagAttributes
-
- com.ibm.as400.util.html.HTMLHeading
-
- All Implemented Interfaces:
- HTMLTagElement, java.io.Serializable
public class HTMLHeading extends HTMLTagAttributes implements java.io.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:
- PropertyChangeEvent
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description HTMLHeading()
Constructs a default HTMLHeading object.HTMLHeading(int level)
Constructs an HTMLHeading object with the specified heading level.HTMLHeading(int level, java.lang.String text)
Constructs an HTMLHeading object with the specified heading level and text.HTMLHeading(int level, java.lang.String text, java.lang.String align)
Constructs an HTMLHeading object with the specified heading level, text, and align.
-
Method Summary
Methods Modifier and Type Method and Description java.lang.String
getAlign()
Returns the alignment of the header.java.lang.String
getDirection()
Returns the direction of the text interpretation.java.lang.String
getFOTag()
Returns the tag for the XSL-FO heading.java.lang.String
getLanguage()
Returns the language of the input element.int
getLevel()
Returns the level of the header.java.lang.String
getTag()
Returns the tag for the HTML heading.java.lang.String
getText()
Returns the text of the header.boolean
isUseFO()
Returns if Formatting Object tags are outputted.void
setAlign(java.lang.String align)
Sets the horizontal alignment for the header.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
setLevel(int level)
Sets the level of the header.void
setText(java.lang.String text)
Set the visible text to display in the header.void
setUseFO(boolean useFO)
Sets if Formatting Object tags should be used.java.lang.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
-
-
-
-
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, java.lang.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, java.lang.String text, java.lang.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 java.lang.String getAlign()
Returns the alignment of the header.- 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.
-
getLevel
public int getLevel()
Returns the level of the header.- Returns:
- The level.
-
getText
public java.lang.String getText()
Returns the text of the header.- Returns:
- The text.
-
getTag
public java.lang.String getTag()
Returns the tag for the HTML heading.- Specified by:
getTag
in interfaceHTMLTagElement
- Returns:
- The tag.
-
getFOTag
public java.lang.String getFOTag()
Returns the tag for the XSL-FO heading. The language attribute is not supported by XSL-FO.- Specified by:
getFOTag
in interfaceHTMLTagElement
- 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(java.lang.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(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 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(java.lang.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 java.lang.String toString()
Returns a String representation for the HTMLHeading tag.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The tag.
-
-