com.ibm.as400.util.html
Class HTMLTableCell

java.lang.Object
  extended by com.ibm.as400.util.html.HTMLTagAttributes
      extended by com.ibm.as400.util.html.HTMLTableCell
All Implemented Interfaces:
HTMLConstants, HTMLTagElement, Serializable
Direct Known Subclasses:
HTMLTableHeader

public class HTMLTableCell
extends HTMLTagAttributes
implements HTMLConstants, Serializable

The HTMLTableCell class represents data in an HTML table cell.

This example creates an HTML text HTMLTableCell object.

  // 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());
  
Here is the output of the tag:

  
<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.

  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());
  
Here is the output of the tag:

  <td><form action="http://myCompany.com/myServlet" method="get">
  <input type="submit" value="Send" />
  </form></td>
  

HTMLTableCell objects generate the following events:

See Also:
HTMLTable, HTMLTableRow, Serialized Form

Field Summary
Modifier and Type Field and Description
 
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
Constructor and Description
HTMLTableCell()
          Constructs a default HTMLTableCell object.
HTMLTableCell(HTMLTagElement element)
          Constructs an HTMLTableCell.
 
Method Summary
Modifier and Type Method and Description
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds the VetoableChangeListener.
 int getColumnSpan()
          Returns the column span.
 String getDirection()
          Returns the direction of the text interpretation.
 HTMLTagElement getElement()
          Returns the table cell element.
 String getFOTag()
          Returns the XSL-FO table cell tag.
 String getFOTag(HTMLTagElement element)
          Returns the XSL-FO table cell tag with the specified element.
 int getHeight()
          Returns the height relative to the table in pixels or percent.
 String getHorizontalAlignment()
          Returns the horizontal alignment.
 String getLanguage()
          Returns the language of the table cell.
 int getRowSpan()
          Returns the row span.
 String getTag()
          Returns the table cell tag.
 String getTag(HTMLTagElement element)
          Returns the table cell tag with the specified element.
 String getVerticalAlignment()
          Returns the vertical alignment.
 int getWidth()
          Returns the width relative to the table in pixels or percent.
 boolean isHeightInPercent()
          Indicates if the height is in percent or pixels.
 boolean isUseFO()
          Returns if Formatting Object tags are outputted.
 boolean isWidthInPercent()
          Indicates if the width is in percent or pixels.
 boolean isWrap()
          Indicates if the cell data will use normal HTML linebreaking conventions.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes the VetoableChangeListener from the internal list.
 void setBorderWidth(int borderWidth)
          Sets the border width in pixels.
 void setCellPadding(int cellPadding)
          Sets the global table cell padding.
 void setColumnSpan(int span)
          Sets the column span.
 void setDirection(String dir)
          Sets the direction of the text interpretation.
 void setElement(HTMLTagElement element)
          Sets the table cell element.
 void setElement(String element)
          Sets the table cell element.
 void setHeight(int height)
          Sets the height relative to the table.
 void setHeight(int height, boolean heightInPercent)
          Sets the height relative to the table in pixels or percent.
 void setHeightInPercent(boolean heightInPercent)
          Sets the height unit in percent or pixels.
 void setHorizontalAlignment(String alignment)
          Sets the horizontal alignment.
 void setLanguage(String lang)
          Sets the language of the table cell.
 void setRowSpan(int span)
          Sets the row span.
 void setUseFO(boolean useFO)
          Sets if Formatting Object tags should be used.
 void setVerticalAlignment(String alignment)
          Sets the vertical alignment.
 void setWidth(int width)
          Sets the width relative to the table.
 void setWidth(int width, boolean widthInPercent)
          Sets the width relative to the table in percent or pixels.
 void setWidthInPercent(boolean widthInPercent)
          Sets the width unit in percent or pixels.
 void setWrap(boolean wrap)
          Sets if the cell data will use normal HTML linebreaking conventions.
 String toString()
          Returns the HTML table cell 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

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(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 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 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 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 String getTag()
Returns the table cell tag.

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

getFOTag

public String getFOTag()
Returns the XSL-FO table cell tag.

Specified by:
getFOTag in interface HTMLTagElement
Returns:
The cell tag.

getFOTag

public 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 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 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(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 PropertyVetoException
Sets the column span. The default value is one.

Parameters:
span - The column span.
Throws:
PropertyVetoException - If the change is vetoed.

setDirection

public void setDirection(String dir)
                  throws PropertyVetoException
Sets the direction of the text interpretation.

Parameters:
dir - The direction. One of the following constants defined in HTMLConstants: LTR or RTL.
Throws:
PropertyVetoException - If a change is vetoed.
See Also:
HTMLConstants

setElement

public void setElement(String element)
                throws PropertyVetoException
Sets the table cell element.

Parameters:
element - The cell element.
Throws:
PropertyVetoException - If the change is vetoed.

setElement

public void setElement(HTMLTagElement element)
                throws PropertyVetoException
Sets the table cell element.

Parameters:
element - The cell element.
Throws:
PropertyVetoException - If the change is vetoed.

setHeight

public void setHeight(int height)
               throws PropertyVetoException
Sets 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:
PropertyVetoException - If the change is vetoed.
See Also:
setHeightInPercent(boolean)

setHeight

public void setHeight(int height,
                      boolean heightInPercent)
               throws PropertyVetoException
Sets 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:
PropertyVetoException - If the change is vetoed.

setHeightInPercent

public void setHeightInPercent(boolean heightInPercent)
                        throws PropertyVetoException
Sets the height unit in percent or pixels. The default is false.

Parameters:
heightInPercent - true if unit is percent; false if pixels.
Throws:
PropertyVetoException - If the change is vetoed.
See Also:
setHeight(int)

setHorizontalAlignment

public void setHorizontalAlignment(String alignment)
                            throws PropertyVetoException
Sets 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:
PropertyVetoException - If the change is vetoed.
See Also:
HTMLConstants

setLanguage

public void setLanguage(String lang)
                 throws PropertyVetoException
Sets the language of the table cell.

Parameters:
lang - The language. Example language tags include: en and en-US.
Throws:
PropertyVetoException - If a change is vetoed.

setRowSpan

public void setRowSpan(int span)
                throws PropertyVetoException
Sets the row span. The default value is one.

Parameters:
span - The row span.
Throws:
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(String alignment)
                          throws PropertyVetoException
Sets the vertical alignment.

Parameters:
alignment - The vertical alignment. One of the following constants defined in HTMLConstants: BASELINE, BOTTOM, MIDDLE, or TOP.
Throws:
PropertyVetoException - If the change is vetoed.
See Also:
HTMLConstants

setWidth

public void setWidth(int width)
              throws PropertyVetoException
Sets 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:
PropertyVetoException - If the change is vetoed.
See Also:
setWidthInPercent(boolean)

setWidth

public void setWidth(int width,
                     boolean widthInPercent)
              throws PropertyVetoException
Sets 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:
PropertyVetoException - If the change is vetoed.

setWidthInPercent

public void setWidthInPercent(boolean widthInPercent)
                       throws PropertyVetoException
Sets the width unit in percent or pixels. The default is false.

Parameters:
widthInPercent - true if unit is percent; false if pixels.
Throws:
PropertyVetoException - If the change is vetoed.
See Also:
setWidth(int)

setWrap

public void setWrap(boolean wrap)
             throws PropertyVetoException
Sets 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:
PropertyVetoException - If the change is vetoed.

toString

public String toString()
Returns the HTML table cell tag.

Overrides:
toString in class Object
Returns:
The cell tag.