Class TableElement


@TagName("table") public class TableElement extends Element
The create* and delete* methods on the table allow authors to construct and modify tables. [HTML 4.01] specifies that only one of each of the CAPTION, THEAD, and TFOOT elements may exist in a table. Therefore, if one exists, and the createTHead() or createTFoot() method is called, the method returns the existing THead or TFoot element.
See Also:
  • Field Details

  • Constructor Details

    • TableElement

      protected TableElement()
  • Method Details

    • as

      public static TableElement as(Element elem)
      Assert that the given Element is compatible with this class and automatically typecast it.
    • is

      public static boolean is(JavaScriptObject o)
      Determines whether the given JavaScriptObject can be cast to this class. A null object will cause this method to return false.
    • is

      public static boolean is(Node node)
      Determine whether the given Node can be cast to this class. A null node will cause this method to return false.
    • is

      public static boolean is(Element elem)
      Determine whether the given Element can be cast to this class. A null node will cause this method to return false.
    • createCaption

      public final TableCaptionElement createCaption()
      Create a new table caption object or return an existing one.
      Returns:
      A CAPTION element.
    • createTFoot

      public final TableSectionElement createTFoot()
      Create a table footer row or return an existing one.
      Returns:
      A footer element (TFOOT)
    • createTHead

      public final TableSectionElement createTHead()
      Create a table header row or return an existing one.
      Returns:
      A new table header element (THEAD)
    • deleteCaption

      public final void deleteCaption()
      Delete the table caption, if one exists.
    • deleteRow

      public final void deleteRow(int index)
      Delete a table row.
      Parameters:
      index - The index of the row to be deleted. This index starts from 0 and is relative to the logical order (not document order) of all the rows contained inside the table. If the index is -1 the last row in the table is deleted
    • deleteTFoot

      public final void deleteTFoot()
      Delete the header from the table, if one exists.
    • deleteTHead

      public final void deleteTHead()
      Delete the header from the table, if one exists.
    • getBorder

      public final int getBorder()
      The width of the border around the table.
      See Also:
    • getCaption

      public final TableCaptionElement getCaption()
      The table's CAPTION, or null if none exists.
    • getCellPadding

      public final int getCellPadding()
      Specifies the horizontal and vertical space between cell content and cell borders.
      See Also:
    • getCellSpacing

      public final int getCellSpacing()
      Specifies the horizontal and vertical separation between cells.
      See Also:
    • getFrame

      public final String getFrame()
      Specifies which external table borders to render.
      See Also:
    • getRows

      public final NodeList<TableRowElement> getRows()
      Returns a collection of all the rows in the table, including all in THEAD, TFOOT, all TBODY elements.
    • getRules

      public final String getRules()
      Specifies which internal table borders to render.
      See Also:
    • getTBodies

      public final NodeList<TableSectionElement> getTBodies()
      Returns a collection of the table bodies (including implicit ones).
    • getTFoot

      public final TableSectionElement getTFoot()
      The table's TFOOT, or null if none exists.
    • getTHead

      public final TableSectionElement getTHead()
      The table's THEAD, or null if none exists.
    • getWidth

      public final String getWidth()
      Specifies the desired table width.
      See Also:
    • insertRow

      public final TableRowElement insertRow(int index)
      Insert a new empty row in the table. The new row is inserted immediately before and in the same section as the current indexth row in the table. If index is -1 or equal to the number of rows, the new row is appended. In addition, when the table is empty the row is inserted into a TBODY which is created and inserted into the table. Note: A table row cannot be empty according to [HTML 4.01].
      Parameters:
      index - The row number where to insert a new row. This index starts from 0 and is relative to the logical order (not document order) of all the rows contained inside the table
      Returns:
      The newly created row
    • setBorder

      public final void setBorder(int border)
      The width of the border around the table.
      See Also:
    • setCaption

      public final void setCaption(TableCaptionElement caption)
      The table's CAPTION, or null if none exists.
    • setCellPadding

      public final void setCellPadding(int cellPadding)
      Specifies the horizontal and vertical space between cell content and cell borders.
      See Also:
    • setCellSpacing

      public final void setCellSpacing(int cellSpacing)
      Specifies the horizontal and vertical separation between cells.
      See Also:
    • setFrame

      public final void setFrame(String frame)
      Specifies which external table borders to render.
      See Also:
    • setRules

      public final void setRules(String rules)
      Specifies which internal table borders to render.
      See Also:
    • setTFoot

      public final void setTFoot(TableSectionElement tFoot)
      The table's TFOOT, or null if none exists.
    • setTHead

      public final void setTHead(TableSectionElement tHead)
      The table's THEAD, or null if none exists.
    • setWidth

      public final void setWidth(String width)
      Specifies the desired table width.
      See Also: