public class

FlexTable

extends HTMLTable
java.lang.Object
   ↳ com.google.gwt.user.client.ui.UIObject
     ↳ com.google.gwt.user.client.ui.Widget
       ↳ com.google.gwt.user.client.ui.Panel
         ↳ com.google.gwt.user.client.ui.HTMLTable
           ↳ com.google.gwt.user.client.ui.FlexTable

Class Overview

A flexible table that creates cells on demand. It can be jagged (that is, each row can contain a different number of cells) and individual cells can be set to span multiple rows or columns.

Example

{@example com.google.gwt.examples.FlexTableExample}

Summary

Nested Classes
class FlexTable.FlexCellFormatter FlexTable-specific implementation of HTMLTable.CellFormatter
[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
Public Constructors
FlexTable()
Public Methods
void addCell(int row)
Appends a cell to the specified row.
int getCellCount(int row)
Gets the number of cells on a given row.
FlexTable.FlexCellFormatter getFlexCellFormatter()
Explicitly gets the FlexTable.FlexCellFormatter.
int getRowCount()
Gets the number of rows.
void insertCell(int beforeRow, int beforeColumn)
Inserts a cell into the FlexTable.
int insertRow(int beforeRow)
Inserts a row into the FlexTable.
void removeAllRows()
Remove all rows in this table.
void removeCell(int row, int col)
Removes the specified cell from the table.
void removeCells(int row, int column, int num)
Removes a number of cells from a row in the table.
void removeRow(int row)
Removes the specified row from the table.
Protected Methods
void prepareCell(int row, int column)
Ensure that the cell exists.
void prepareRow(int row)
Ensure that the row exists.
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.HTMLTable
From class com.google.gwt.user.client.ui.Panel
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.event.dom.client.HasClickHandlers
From interface com.google.gwt.event.dom.client.HasDoubleClickHandlers
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.ui.HasWidgets
From interface com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
From interface com.google.gwt.user.client.ui.IsWidget
From interface com.google.gwt.user.client.ui.SourcesTableEvents
From interface java.lang.Iterable

Public Constructors

public FlexTable ()

Public Methods

public void addCell (int row)

Appends a cell to the specified row.

Parameters
row the row to which the new cell will be added

public int getCellCount (int row)

Gets the number of cells on a given row.

Parameters
row the row whose cells are to be counted
Returns
  • the number of cells present

public FlexTable.FlexCellFormatter getFlexCellFormatter ()

Explicitly gets the FlexTable.FlexCellFormatter. The results of getCellFormatter() may also be downcast to a FlexTable.FlexCellFormatter.

Returns
  • the FlexTable's cell formatter

public int getRowCount ()

Gets the number of rows.

Returns
  • number of rows

public void insertCell (int beforeRow, int beforeColumn)

Inserts a cell into the FlexTable.

Parameters
beforeRow the cell's row
beforeColumn the cell's column

public int insertRow (int beforeRow)

Inserts a row into the FlexTable.

Parameters
beforeRow the row to insert
Returns
  • the index of the newly-created row

public void removeAllRows ()

Remove all rows in this table.

public void removeCell (int row, int col)

Removes the specified cell from the table.

Parameters
row the row of the cell to remove
col the column of cell to remove

public void removeCells (int row, int column, int num)

Removes a number of cells from a row in the table.

Parameters
row the row of the cells to be removed
column the column of the first cell to be removed
num the number of cells to be removed

public void removeRow (int row)

Removes the specified row from the table.

Parameters
row the index of the row to be removed

Protected Methods

protected void prepareCell (int row, int column)

Ensure that the cell exists.

Parameters
row the row to prepare.
column the column to prepare.
Throws
IndexOutOfBoundsException if the row is negative

protected void prepareRow (int row)

Ensure that the row exists.

Parameters
row The row to prepare.
Throws
IndexOutOfBoundsException if the row is negative