com.ibm.as400.util.html
Class HTMLTableCell
- java.lang.Object
-
- com.ibm.as400.util.html.HTMLTagAttributes
-
- com.ibm.as400.util.html.HTMLTableCell
-
- All Implemented Interfaces:
- HTMLConstants, HTMLTagElement, java.io.Serializable
- Direct Known Subclasses:
- HTMLTableHeader
public class HTMLTableCell extends HTMLTagAttributes implements HTMLConstants, java.io.Serializable
The HTMLTableCell class represents data in an HTML table cell.This example creates an HTML text HTMLTableCell object.
Here is the output of the tag:// Create an HTMLText object. HTMLText ibmText = new HTMLText("IBM"); ibmText.setBold(true); ibmText.setItalic(true); HTMLTableCell textCell = new HTMLTableCell(ibmText); textCell.setHorizontalAlignment(HTMLConstants.CENTER); System.out.println(textCell.getTag());
<td align="center"><b><i>IBM</i></b></td>Calling getFOTag() produces the following:
<fo:table-cell border-style='solid' border-width='1px' padding='1px' text-align='center'><fo:block-container> <fo:block font-weight='bold' font-style='italic'>IBM</fo:block> </fo:block-container> </fo:table-cell>
This example creates an HTMLTableCell object with the element as an HTMLForm object containing a submit button.
Here is the output of the tag:HTMLTableCell formCell = new HTMLTableCell(); // create an HTMLForm object. SubmitFormInput submitButton = new SubmitFormInput("Submit", "Send"); HTMLForm form = new HTMLForm("http://myCompany.com/myServlet"); form.addElement(submitButton); // add the form to the table cell. formCell.setElement(form); System.out.println(formCell.getTag());<td><form action="http://myCompany.com/myServlet" method="get"> <input type="submit" value="Send" /> </form></td>
HTMLTableCell objects generate the following events:
- PropertyChangeEvent
- VetoableChangeEvent
- See Also:
HTMLTable,HTMLTableRow, Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.ibm.as400.util.html.HTMLConstants
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CAPITALS, CENTER, CIRCLE, DISC, JUSTIFY, LARGE_ROMAN, LEFT, LOWER_CASE, LTR, MIDDLE, NUMBERS, RIGHT, RTL, SMALL_ROMAN, SQUARE, TARGET_BLANK, TARGET_PARENT, TARGET_SELF, TARGET_TOP, TEXTTOP, TOP
-
-
Constructor Summary
Constructors Constructor and Description HTMLTableCell()Constructs a default HTMLTableCell object.HTMLTableCell(HTMLTagElement element)Constructs an HTMLTableCell.
-
Method Summary
Methods Modifier and Type Method and Description voidaddVetoableChangeListener(java.beans.VetoableChangeListener listener)Adds the VetoableChangeListener.intgetColumnSpan()Returns the column span.java.lang.StringgetDirection()Returns the direction of the text interpretation.HTMLTagElementgetElement()Returns the table cell element.java.lang.StringgetFOTag()Returns the XSL-FO table cell tag.java.lang.StringgetFOTag(HTMLTagElement element)Returns the XSL-FO table cell tag with the specified element.intgetHeight()Returns the height relative to the table in pixels or percent.java.lang.StringgetHorizontalAlignment()Returns the horizontal alignment.java.lang.StringgetLanguage()Returns the language of the table cell.intgetRowSpan()Returns the row span.java.lang.StringgetTag()Returns the table cell tag.java.lang.StringgetTag(HTMLTagElement element)Returns the table cell tag with the specified element.java.lang.StringgetVerticalAlignment()Returns the vertical alignment.intgetWidth()Returns the width relative to the table in pixels or percent.booleanisHeightInPercent()Indicates if the height is in percent or pixels.booleanisUseFO()Returns if Formatting Object tags are outputted.booleanisWidthInPercent()Indicates if the width is in percent or pixels.booleanisWrap()Indicates if the cell data will use normal HTML linebreaking conventions.voidremoveVetoableChangeListener(java.beans.VetoableChangeListener listener)Removes the VetoableChangeListener from the internal list.voidsetBorderWidth(int borderWidth)Sets the border width in pixels.voidsetCellPadding(int cellPadding)Sets the global table cell padding.voidsetColumnSpan(int span)Sets the column span.voidsetDirection(java.lang.String dir)Sets the direction of the text interpretation.voidsetElement(HTMLTagElement element)Sets the table cell element.voidsetElement(java.lang.String element)Sets the table cell element.voidsetHeight(int height)Sets the height relative to the table.voidsetHeight(int height, boolean heightInPercent)Sets the height relative to the table in pixels or percent.voidsetHeightInPercent(boolean heightInPercent)Sets the height unit in percent or pixels.voidsetHorizontalAlignment(java.lang.String alignment)Sets the horizontal alignment.voidsetLanguage(java.lang.String lang)Sets the language of the table cell.voidsetRowSpan(int span)Sets the row span.voidsetUseFO(boolean useFO)Sets if Formatting Object tags should be used.voidsetVerticalAlignment(java.lang.String alignment)Sets the vertical alignment.voidsetWidth(int width)Sets the width relative to the table.voidsetWidth(int width, boolean widthInPercent)Sets the width relative to the table in percent or pixels.voidsetWidthInPercent(boolean widthInPercent)Sets the width unit in percent or pixels.voidsetWrap(boolean wrap)Sets if the cell data will use normal HTML linebreaking conventions.java.lang.StringtoString()Returns the HTML table cell tag.-
Methods inherited from class com.ibm.as400.util.html.HTMLTagAttributes
addPropertyChangeListener, getAttributes, getAttributeString, removePropertyChangeListener, setAttributes
-
-
-
-
Constructor Detail
-
HTMLTableCell
public HTMLTableCell()
Constructs a default HTMLTableCell object.
-
HTMLTableCell
public HTMLTableCell(HTMLTagElement element)
Constructs an HTMLTableCell.- Parameters:
element- The table cell element.
-
-
Method Detail
-
addVetoableChangeListener
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method is called each time the value of any constrained property is changed.- Parameters:
listener- The VetoableChangeListener.- See Also:
removeVetoableChangeListener(java.beans.VetoableChangeListener)
-
getColumnSpan
public int getColumnSpan()
Returns the column span. The default value is one.- Returns:
- The column span.
-
getDirection
public java.lang.String getDirection()
Returns the direction of the text interpretation.- Returns:
- The direction of the text.
-
getElement
public HTMLTagElement getElement()
Returns the table cell element.- Returns:
- The cell element.
-
getHeight
public int getHeight()
Returns the height relative to the table in pixels or percent.- Returns:
- The height.
-
getHorizontalAlignment
public java.lang.String getHorizontalAlignment()
Returns the horizontal alignment. The default value is LEFT.- Returns:
- The horizontal alignment. One of the following constants defined in HTMLConstants: CENTER, LEFT, or RIGHT.
- See Also:
HTMLConstants
-
getLanguage
public java.lang.String getLanguage()
Returns the language of the table cell.- Returns:
- The language of the table cell.
-
getRowSpan
public int getRowSpan()
Returns the row span. The default value is one.- Returns:
- The row span.
-
getTag
public java.lang.String getTag()
Returns the table cell tag.- Specified by:
getTagin interfaceHTMLTagElement- Returns:
- The cell tag.
-
getFOTag
public java.lang.String getFOTag()
Returns the XSL-FO table cell tag.- Specified by:
getFOTagin interfaceHTMLTagElement- Returns:
- The cell tag.
-
getFOTag
public java.lang.String getFOTag(HTMLTagElement element)
Returns the XSL-FO table cell tag with the specified element. It does not change the cell object's element attribute. The valign, wrap and laguage attributes are not supported in XSL-FO.- Parameters:
element- The table cell element.- Returns:
- The XSL-FO cell tag.
-
getTag
public java.lang.String getTag(HTMLTagElement element)
Returns the table cell tag with the specified element. It does not change the cell object's element attribute.- Parameters:
element- The table cell element.- Returns:
- The cell tag.
-
getVerticalAlignment
public java.lang.String getVerticalAlignment()
Returns the vertical alignment.- Returns:
- The vertical alignment. One of the following constants defined in HTMLConstants: BASELINE, BOTTOM, MIDDLE, or TOP.
- See Also:
HTMLConstants
-
getWidth
public int getWidth()
Returns the width relative to the table in pixels or percent.- Returns:
- The width.
-
isHeightInPercent
public boolean isHeightInPercent()
Indicates if the height is in percent or pixels. The default value is false.- Returns:
- true if percent; pixels otherwise.
-
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.
-
isWidthInPercent
public boolean isWidthInPercent()
Indicates if the width is in percent or pixels. The default value is false.- Returns:
- true if percent; pixels otherwise.
-
isWrap
public boolean isWrap()
Indicates if the cell data will use normal HTML linebreaking conventions. The default value is true.- Returns:
- true if normal HTML linebreaking is used; false otherwise.
-
removeVetoableChangeListener
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes the VetoableChangeListener from the internal list. If the VetoableChangeListener is not on the list, nothing is done.- Parameters:
listener- The VetoableChangeListener.- See Also:
addVetoableChangeListener(java.beans.VetoableChangeListener)
-
setColumnSpan
public void setColumnSpan(int span) throws java.beans.PropertyVetoExceptionSets the column span. The default value is one.- Parameters:
span- The column span.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.
-
setDirection
public void setDirection(java.lang.String dir) throws java.beans.PropertyVetoExceptionSets the direction of the text interpretation.- Parameters:
dir- The direction. One of the following constants defined in HTMLConstants: LTR or RTL.- Throws:
java.beans.PropertyVetoException- If a change is vetoed.- See Also:
HTMLConstants
-
setElement
public void setElement(java.lang.String element) throws java.beans.PropertyVetoExceptionSets the table cell element.- Parameters:
element- The cell element.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.
-
setElement
public void setElement(HTMLTagElement element) throws java.beans.PropertyVetoException
Sets the table cell element.- Parameters:
element- The cell element.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.
-
setHeight
public void setHeight(int height) throws java.beans.PropertyVetoExceptionSets the height relative to the table. The default unit is pixels. A table row can only have one height. If multiple cell heights are defined for different cells in the row, the outcome is browser dependent.- Parameters:
height- The height.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.- See Also:
setHeightInPercent(boolean)
-
setHeight
public void setHeight(int height, boolean heightInPercent) throws java.beans.PropertyVetoExceptionSets the height relative to the table in pixels or percent. A table row can only have one height. If multiple cell heights are defined for different cells in the row, the outcome is browser dependent.- Parameters:
height- The height.heightInPercent- true if unit is percent; false if pixels.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.
-
setHeightInPercent
public void setHeightInPercent(boolean heightInPercent) throws java.beans.PropertyVetoExceptionSets the height unit in percent or pixels. The default is false.- Parameters:
heightInPercent- true if unit is percent; false if pixels.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.- See Also:
setHeight(int)
-
setHorizontalAlignment
public void setHorizontalAlignment(java.lang.String alignment) throws java.beans.PropertyVetoExceptionSets the horizontal alignment. The default value is LEFT.- Parameters:
alignment- The horizontal alignment. One of the following constants defined in HTMLConstants: CENTER, LEFT, or RIGHT.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.- See Also:
HTMLConstants
-
setLanguage
public void setLanguage(java.lang.String lang) throws java.beans.PropertyVetoExceptionSets the language of the table cell.- Parameters:
lang- The language. Example language tags include: en and en-US.- Throws:
java.beans.PropertyVetoException- If a change is vetoed.
-
setRowSpan
public void setRowSpan(int span) throws java.beans.PropertyVetoExceptionSets the row span. The default value is one.- Parameters:
span- The row span.- Throws:
java.beans.PropertyVetoException- If the 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 a XSL formatting object, false if the output generated is HTML.
-
setBorderWidth
public void setBorderWidth(int borderWidth)
Sets the border width in pixels. A value of zero indicates no border. The default value is one.- Parameters:
borderWidth- The border width.
-
setCellPadding
public void setCellPadding(int cellPadding)
Sets the global table cell padding. The cell padding is the spacing between data in a table cell and the border of the cell.- Parameters:
cellPadding- The cell padding.
-
setVerticalAlignment
public void setVerticalAlignment(java.lang.String alignment) throws java.beans.PropertyVetoExceptionSets the vertical alignment.- Parameters:
alignment- The vertical alignment. One of the following constants defined in HTMLConstants: BASELINE, BOTTOM, MIDDLE, or TOP.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.- See Also:
HTMLConstants
-
setWidth
public void setWidth(int width) throws java.beans.PropertyVetoExceptionSets the width relative to the table. The default width unit is pixels. A table column can only have one width and the width used is usually the widest. If multiple cell widths are defined for different cells in the column, the outcome is browser dependent.- Parameters:
width- The width.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.- See Also:
setWidthInPercent(boolean)
-
setWidth
public void setWidth(int width, boolean widthInPercent) throws java.beans.PropertyVetoExceptionSets the width relative to the table in percent or pixels. A table column can only have one width and the width used is usually the widest. If multiple cell widths are defined for different cells in the column, the outcome is browser dependent.- Parameters:
width- The width.widthInPercent- true if unit is percent; false if pixels.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.
-
setWidthInPercent
public void setWidthInPercent(boolean widthInPercent) throws java.beans.PropertyVetoExceptionSets the width unit in percent or pixels. The default is false.- Parameters:
widthInPercent- true if unit is percent; false if pixels.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.- See Also:
setWidth(int)
-
setWrap
public void setWrap(boolean wrap) throws java.beans.PropertyVetoExceptionSets if the cell data will use normal HTML linebreaking conventions. The default value is true.- Parameters:
wrap- true if normal HTML linebreaking is used; false otherwise.- Throws:
java.beans.PropertyVetoException- If the change is vetoed.
-
toString
public java.lang.String toString()
Returns the HTML table cell tag.- Overrides:
toStringin classjava.lang.Object- Returns:
- The cell tag.
-
-