com.google.gwt.dom.client

## Class TableElement

- java.lang.Object
- - com.google.gwt.core.client.JavaScriptObject
  - - com.google.gwt.dom.client.Node
    - - com.google.gwt.dom.client.Element
      - - com.google.gwt.dom.client.TableElement

-     @TagName(value="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:
    W3C HTML Specification

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `TAG`

    - ### Fields inherited from class com.google.gwt.dom.client.Element

      `DRAGGABLE_AUTO, DRAGGABLE_FALSE, DRAGGABLE_TRUE`

    - ### Fields inherited from class com.google.gwt.dom.client.Node

      `DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TableElement()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TableElement` | `as(Element elem)` Assert that the given `Element` is compatible with this class and automatically typecast it.
    `TableCaptionElement` | `createCaption()` Create a new table caption object or return an existing one.
    `TableSectionElement` | `createTFoot()` Create a table footer row or return an existing one.
    `TableSectionElement` | `createTHead()` Create a table header row or return an existing one.
    `void` | `deleteCaption()` Delete the table caption, if one exists.
    `void` | `deleteRow(int index)` Delete a table row.
    `void` | `deleteTFoot()` Delete the header from the table, if one exists.
    `void` | `deleteTHead()` Delete the header from the table, if one exists.
    `int` | `getBorder()` The width of the border around the table.
    `TableCaptionElement` | `getCaption()` The table's CAPTION, or null if none exists.
    `int` | `getCellPadding()` Specifies the horizontal and vertical space between cell content and cell borders.
    `int` | `getCellSpacing()` Specifies the horizontal and vertical separation between cells.
    `java.lang.String` | `getFrame()` Specifies which external table borders to render.
    `NodeList<TableRowElement>` | `getRows()` Returns a collection of all the rows in the table, including all in THEAD, TFOOT, all TBODY elements.
    `java.lang.String` | `getRules()` Specifies which internal table borders to render.
    `NodeList<TableSectionElement>` | `getTBodies()` Returns a collection of the table bodies (including implicit ones).
    `TableSectionElement` | `getTFoot()` The table's TFOOT, or null if none exists.
    `TableSectionElement` | `getTHead()` The table's THEAD, or null if none exists.
    `java.lang.String` | `getWidth()` Specifies the desired table width.
    `TableRowElement` | `insertRow(int index)` Insert a new empty row in the table.
    `void` | `setBorder(int border)` The width of the border around the table.
    `void` | `setCaption(TableCaptionElement caption)` The table's CAPTION, or null if none exists.
    `void` | `setCellPadding(int cellPadding)` Specifies the horizontal and vertical space between cell content and cell borders.
    `void` | `setCellSpacing(int cellSpacing)` Specifies the horizontal and vertical separation between cells.
    `void` | `setFrame(java.lang.String frame)` Specifies which external table borders to render.
    `void` | `setRules(java.lang.String rules)` Specifies which internal table borders to render.
    `void` | `setTFoot(TableSectionElement tFoot)` The table's TFOOT, or null if none exists.
    `void` | `setTHead(TableSectionElement tHead)` The table's THEAD, or null if none exists.
    `void` | `setWidth(java.lang.String width)` Specifies the desired table width.

    - ### Methods inherited from class com.google.gwt.dom.client.Element

      `addClassName, as, as, blur, dispatchEvent, focus, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getAttribute, getClassName, getClientHeight, getClientWidth, getDir, getDraggable, getElementsByTagName, getFirstChildElement, getId, getInnerHTML, getInnerText, getLang, getNextSiblingElement, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getPreviousSiblingElement, getPropertyBoolean, getPropertyDouble, getPropertyInt, getPropertyJSO, getPropertyObject, getPropertyString, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getString, getStyle, getTabIndex, getTagName, getTitle, hasAttribute, hasTagName, indexOfName, is, is, removeAttribute, removeClassName, replaceClassName, scrollIntoView, setAttribute, setClassName, setDir, setDraggable, setId, setInnerHTML, setInnerSafeHtml, setInnerText, setLang, setPropertyBoolean, setPropertyDouble, setPropertyInt, setPropertyJSO, setPropertyObject, setPropertyString, setScrollLeft, setScrollTop, setTabIndex, setTitle`

    - ### Methods inherited from class com.google.gwt.dom.client.Node

      `appendChild, cloneNode, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, hasChildNodes, hasParentElement, insertAfter, insertBefore, insertFirst, isOrHasChild, removeChild, removeFromParent, replaceChild, setNodeValue`

    - ### Methods inherited from class com.google.gwt.core.client.JavaScriptObject

      `cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### TAG

          public static final java.lang.String TAG

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TableElement

          protected TableElement()

  - ### Method Detail

    - #### as

          public static TableElement as(Element elem)

      Assert that the given `Element` is compatible with this class and automatically typecast it.

    - #### 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:
        W3C HTML Specification

    - #### 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:
        W3C HTML Specification

    - #### getCellSpacing

          public final int getCellSpacing()

      Specifies the horizontal and vertical separation between cells.
      See Also:
        W3C HTML Specification

    - #### getFrame

          public final java.lang.String getFrame()

      Specifies which external table borders to render.
      See Also:
        W3C HTML Specification

    - #### 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 java.lang.String getRules()

      Specifies which internal table borders to render.
      See Also:
        W3C HTML Specification

    - #### 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 java.lang.String getWidth()

      Specifies the desired table width.
      See Also:
        W3C HTML Specification

    - #### 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:
        W3C HTML Specification

    - #### 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:
        W3C HTML Specification

    - #### setCellSpacing

          public final void setCellSpacing(int cellSpacing)

      Specifies the horizontal and vertical separation between cells.
      See Also:
        W3C HTML Specification

    - #### setFrame

          public final void setFrame(java.lang.String frame)

      Specifies which external table borders to render.
      See Also:
        W3C HTML Specification

    - #### setRules

          public final void setRules(java.lang.String rules)

      Specifies which internal table borders to render.
      See Also:
        W3C HTML Specification

    - #### 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(java.lang.String width)

      Specifies the desired table width.
      See Also:
        W3C HTML Specification