public class

TableElement

extends Element
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

Class Overview

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.

Summary

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

Protected Constructors

protected TableElement ()

Public Methods

public static TableElement as (Element elem)

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

public final TableCaptionElement createCaption ()

Create a new table caption object or return an existing one.

Returns
  • A CAPTION element.

public final TableSectionElement createTFoot ()

Create a table footer row or return an existing one.

Returns
  • A footer element (TFOOT)

public final TableSectionElement createTHead ()

Create a table header row or return an existing one.

Returns
  • A new table header element (THEAD)

public final void deleteCaption ()

Delete the table caption, if one exists.

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

public final void deleteTFoot ()

Delete the header from the table, if one exists.

public final void deleteTHead ()

Delete the header from the table, if one exists.

public final int getBorder ()

The width of the border around the table.

public final TableCaptionElement getCaption ()

The table's CAPTION, or null if none exists.

public final int getCellPadding ()

Specifies the horizontal and vertical space between cell content and cell borders.

public final int getCellSpacing ()

Specifies the horizontal and vertical separation between cells.

public final String getFrame ()

Specifies which external table borders to render.

public final NodeList<TableRowElement> getRows ()

Returns a collection of all the rows in the table, including all in THEAD, TFOOT, all TBODY elements.

public final String getRules ()

Specifies which internal table borders to render.

public final NodeList<TableSectionElement> getTBodies ()

Returns a collection of the table bodies (including implicit ones).

public final TableSectionElement getTFoot ()

The table's TFOOT, or null if none exists.

public final TableSectionElement getTHead ()

The table's THEAD, or null if none exists.

public final String getWidth ()

Specifies the desired table width.

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

public final void setBorder (int border)

The width of the border around the table.

public final void setCaption (TableCaptionElement caption)

The table's CAPTION, or null if none exists.

public final void setCellPadding (int cellPadding)

Specifies the horizontal and vertical space between cell content and cell borders.

public final void setCellSpacing (int cellSpacing)

Specifies the horizontal and vertical separation between cells.

public final void setFrame (String frame)

Specifies which external table borders to render.

public final void setRules (String rules)

Specifies which internal table borders to render.

public final void setTFoot (TableSectionElement tFoot)

The table's TFOOT, or null if none exists.

public final void setTHead (TableSectionElement tHead)

The table's THEAD, or null if none exists.

public final void setWidth (String width)

Specifies the desired table width.