com.ibm.as400.util.html

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

      // 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:

    • PropertyChangeEvent
    • VetoableChangeEvent
    See Also:
    HTMLTable, HTMLTableRow, Serialized Form
    • 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:
        getTag in interface HTMLTagElement
        Returns:
        The cell tag.
      • getFOTag

        public java.lang.String getFOTag()
        Returns the XSL-FO table cell tag.
        Specified by:
        getFOTag in interface HTMLTagElement
        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.PropertyVetoException
        Sets 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.PropertyVetoException
        Sets 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.PropertyVetoException
        Sets 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.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:
        java.beans.PropertyVetoException - If the change is vetoed.
        See Also:
        setHeightInPercent(boolean)
      • setHeight

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

        public void setHeightInPercent(boolean heightInPercent)
                                throws java.beans.PropertyVetoException
        Sets 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.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:
        java.beans.PropertyVetoException - If the change is vetoed.
        See Also:
        HTMLConstants
      • setLanguage

        public void setLanguage(java.lang.String lang)
                         throws java.beans.PropertyVetoException
        Sets 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.PropertyVetoException
        Sets 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.PropertyVetoException
        Sets 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.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:
        java.beans.PropertyVetoException - If the change is vetoed.
        See Also:
        setWidthInPercent(boolean)
      • setWidth

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

        public void setWidthInPercent(boolean widthInPercent)
                               throws java.beans.PropertyVetoException
        Sets 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.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:
        java.beans.PropertyVetoException - If the change is vetoed.
      • toString

        public java.lang.String toString()
        Returns the HTML table cell tag.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The cell tag.