public class HTMLHeading extends HTMLTagAttributes implements java.io.Serializable
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:
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.
|
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.
|
addPropertyChangeListener, getAttributes, getAttributeString, removePropertyChangeListener, setAttributes
public HTMLHeading()
public HTMLHeading(int level)
level
- The heading level.public HTMLHeading(int level, java.lang.String text)
level
- The heading level.text
- The heading text.public HTMLHeading(int level, java.lang.String text, java.lang.String align)
level
- The heading level.text
- The heading text.align
- The heading alignment. One of the following constants
defined in HTMLConstants: LEFT, RIGHT, or CENTER.public java.lang.String getAlign()
public java.lang.String getDirection()
public java.lang.String getLanguage()
public int getLevel()
public java.lang.String getText()
public java.lang.String getTag()
getTag
in interface HTMLTagElement
public java.lang.String getFOTag()
getFOTag
in interface HTMLTagElement
public boolean isUseFO()
public void setAlign(java.lang.String align)
align
- The alignment. One of the following constants
defined in HTMLConstants: LEFT, RIGHT, or CENTER.HTMLConstants
public void setDirection(java.lang.String dir)
dir
- The direction. One of the following constants
defined in HTMLConstants: LTR or RTL.HTMLConstants
public void setLanguage(java.lang.String lang)
lang
- The language. Example language tags include:
en and en-US.public void setLevel(int level)
level
- The heading level (1 - 6).HTMLConstants
public void setText(java.lang.String text)
text
- The text.public void setUseFO(boolean useFO)
useFO
- - true if output generated is an XSL formatting object, false if the output generated is HTML.public java.lang.String toString()
toString
in class java.lang.Object