com.ibm.as400.util.html

Class HTMLTableRow

  • All Implemented Interfaces:
    HTMLConstants, HTMLTagElement, java.io.Serializable


    public class HTMLTableRow
    extends HTMLTagAttributes
    implements HTMLConstants, java.io.Serializable
    The HTMLTableRow class represents an HTML row tag.

    This example creates an HTMLTableRow object and sets the attributes.

      HTMLTableRow row = new HTMLTableRow();
      row.setHorizontalAlignment(HTMLTableRow.CENTER);
      row.setVerticalAlignment(HTMLTableRow.MIDDLE);
      // Add the columns to the row (Assume that the HTMLTableCell objects are already created).
      row.addColumn(column1);
      row.addColumn(column2);
      row.addColumn(column3);
      row.addColumn(column4);
      System.out.println(row.getTag());
      
    Here is the output of the tag:
      <tr align="center" valign="middle">
      <td>data1</td>
      <td>data2</td>
      <td>data3</td>
      <td>data4</td>
      </tr>
      

    Using XSL Formatting Objects, the output generated is:

      <fo:table-row text-align="center">
      <fo:table-cell border-style='solid' border-width='1px' padding='1px'><fo:block-container>
      <fo:block>data1</fo:block>
      </fo:block-container>
      </fo:table-cell>
      <fo:table-cell border-style='solid' border-width='1px' padding='1px'><fo:block-container>
      <fo:block>data2</fo:block>
      </fo:block-container>
      </fo:table-cell>
      <fo:table-cell border-style='solid' border-width='1px' padding='1px'><fo:block-container>
      <fo:block>data3</fo:block>
      </fo:block-container>
      </fo:table-cell>
      <fo:table-cell border-style='solid' border-width='1px' padding='1px'><fo:block-container>
      <fo:block>data4</fo:block>
      </fo:block-container>
      </fo:table-cell>
      </fo:table-row>
      

    HTMLTableRow objects generate the following events:

    • ElementEvent - The events fired are:
      • elementAdded
      • elementChanged
      • elementRemoved
    • PropertyChangeEvent
    • VetoableChangeEvent
    See Also:
    HTMLTable, HTMLTableCell, Serialized Form
    • Constructor Detail

      • HTMLTableRow

        public HTMLTableRow()
        Constructs a default HTMLTableRow object.
      • HTMLTableRow

        public HTMLTableRow(HTMLTableCell[] cells)
        Constructs an HTMLTableRow object with the specified cells.
        Parameters:
        cells - The HTMLTableCell array.
    • Method Detail

      • addColumn

        public void addColumn(HTMLTableCell cell)
        Adds the column to the row.
        Parameters:
        cell - The HTMLTableCell containing the column data.
      • 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)
      • getColumn

        public HTMLTableCell getColumn(int columnIndex)
        Returns the column at the specified columnIndex.
        Parameters:
        columnIndex - - The column index.
        Returns:
        An HTMLTableCell object with the column data.
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the row.
        Returns:
        The number of columns.
      • getColumnIndex

        public int getColumnIndex(HTMLTableCell cell)
        Returns the column index of the specified cell.
        Parameters:
        cell - An HTMLTableCell object that contains the cell data.
        Returns:
        The column index of the cell. Returns -1 if the column is not found.
      • getColumnIndex

        public int getColumnIndex(HTMLTableCell cell,
                         int index)
        Returns the column index of the specified cell.
        Parameters:
        cell - An HTMLTableCell object that contains the cell data.
        index - The column index to start searching from.
        Returns:
        The column index of the cell. Returns -1 if the column is not found.
      • getDirection

        public java.lang.String getDirection()
        Returns the direction of the text interpretation.
        Returns:
        The direction of the text.
      • getHorizontalAlignment

        public java.lang.String getHorizontalAlignment()
        Returns the global horizontal alignment for the row.
        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 caption.
        Returns:
        The language of the caption.
      • getTag

        public java.lang.String getTag()
        Returns the table row tag.
        Specified by:
        getTag in interface HTMLTagElement
        Returns:
        The tag.
      • getFOTag

        public java.lang.String getFOTag()
        Returns the XSL-FO table row tag. The valign, halign, and language attributes are not supported in XSL-FO.
        Specified by:
        getFOTag in interface HTMLTagElement
        Returns:
        The xsl-fo tag.
      • getVerticalAlignment

        public java.lang.String getVerticalAlignment()
        Returns the global vertical alignment for the row.
        Returns:
        The vertical alignment. One of the following constants defined in HTMLConstants: BASELINE, BOTTOM, MIDDLE, or TOP.
        See Also:
        HTMLConstants
      • 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.
      • removeAllColumns

        public void removeAllColumns()
        Removes all the columns from the row.
      • removeColumn

        public void removeColumn(HTMLTableCell cell)
        Removes the column element from the row.
        Parameters:
        cell - The HTMLTableCell object to be removed.
      • removeColumn

        public void removeColumn(int columnIndex)
        Removes the column at the specified columnIndex.
        Parameters:
        columnIndex - The column index.
      • 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)
      • setColumn

        public void setColumn(HTMLTableCell cell,
                     int columnIndex)
        Sets the column element at the specified column.
        Parameters:
        cell - The HTMLTableCell object to be added.
        columnIndex - The column index.
      • 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
      • setHorizontalAlignment

        public void setHorizontalAlignment(java.lang.String alignment)
                                    throws java.beans.PropertyVetoException
        Sets the global horizontal alignment for the row.
        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 caption.
        Parameters:
        lang - The language. Example language tags include: en and en-US.
        Throws:
        java.beans.PropertyVetoException - If a change is vetoed.
      • 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. The default value is 1.
        Parameters:
        cellPadding - The cell padding.
      • 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.
      • setVerticalAlignment

        public void setVerticalAlignment(java.lang.String alignment)
                                  throws java.beans.PropertyVetoException
        Sets the global vertical alignment for the row.
        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
      • toString

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