com.google.gwt.user.client.ui
Class Grid

java.lang.Object
  extended bycom.google.gwt.user.client.ui.UIObject
      extended bycom.google.gwt.user.client.ui.Widget
          extended bycom.google.gwt.user.client.ui.Panel
              extended bycom.google.gwt.user.client.ui.HTMLTable
                  extended bycom.google.gwt.user.client.ui.Grid
All Implemented Interfaces:
EventListener, HasWidgets, SourcesTableEvents

public class Grid
extends HTMLTable

A rectangular grid that can contain text, html, or a child Widget within its cells. It must be resized explicitly to the desired number of rows and columns.

Example

code


Nested Class Summary
 
Nested classes inherited from class com.google.gwt.user.client.ui.HTMLTable
HTMLTable.CellFormatter, HTMLTable.RowFormatter
 
Field Summary
protected  int numColumns
           
protected  int numRows
           
 
Fields inherited from class java.lang.Object
typeId, typeName
 
Constructor Summary
Grid()
           
Grid(int rows, int columns)
          Constructs a grid with the requested size.
 
Method Summary
 boolean clearCell(int row, int column)
          Replaces the contents of the specified cell with a single space.
protected  Element createCell()
          Creates a new, empty cell.
 int getCellCount(int row)
          Return number of columns.
 int getColumnCount()
          Gets the number of columns in this grid.
 int getRowCount()
          Return number of rows
protected  void prepareCell(int row, int column)
          Checks that a cell is a valid cell in the table.
protected  void prepareRow(int row)
          Checks that the row index is valid.
 void resize(int rows, int columns)
          Resizes the grid.
 void resizeColumns(int columns)
          Resizes the grid to the specified number of columns.
 void resizeRows(int rows)
          Resizes the grid to the specified number of rows.
 
Methods inherited from class com.google.gwt.user.client.ui.HTMLTable
add, addTableListener, checkCellBounds, checkRowBounds, clear, computeKey, getBodyElement, getCellFormatter, getCellPadding, getCellSpacing, getDOMCellCount, getDOMRowCount, getHTML, getRowFormatter, getText, getWidget, insertCell, insertCells, insertRow, internalClearCell, isCellPresent, iterator, onBrowserEvent, remove, removeCell, removeRow, removeTableListener, setBorderWidth, setCellFormatter, setCellPadding, setCellSpacing, setHTML, setRowFormatter, setText, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, disown, onAttach, onDetach
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onLoad
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, finalize, hashCode
 

Field Detail

numColumns

protected int numColumns

numRows

protected int numRows
Constructor Detail

Grid

public Grid()

Grid

public Grid(int rows,
            int columns)
Constructs a grid with the requested size.

Parameters:
rows - the number of rows
columns - the number of columns
Throws:
IndexOutOfBoundsException
Method Detail

clearCell

public boolean clearCell(int row,
                         int column)
Replaces the contents of the specified cell with a single space.

Overrides:
clearCell in class HTMLTable
Parameters:
row - the cell's row
column - the widget's column
Returns:
true if a widget was removed
Throws:
IndexOutOfBoundsException

getCellCount

public int getCellCount(int row)
Return number of columns. For grid, row arguement is ignored as all grids are rectangler.

Specified by:
getCellCount in class HTMLTable
Parameters:
row - the row whose cells are to be counted
Returns:
the number of cells present in the row

getColumnCount

public int getColumnCount()
Gets the number of columns in this grid.

Returns:
the number of columns

getRowCount

public int getRowCount()
Return number of rows

Specified by:
getRowCount in class HTMLTable
Returns:
the table's row count

resize

public void resize(int rows,
                   int columns)
Resizes the grid.

Parameters:
rows - the number of rows
columns - the number of columns
Throws:
IndexOutOfBoundsException

resizeColumns

public void resizeColumns(int columns)
Resizes the grid to the specified number of columns.

Parameters:
columns - the number of columns
Throws:
IndexOutOfBoundsException

resizeRows

public void resizeRows(int rows)
Resizes the grid to the specified number of rows.

Parameters:
rows - the number of rows
Throws:
IndexOutOfBoundsException

createCell

protected Element createCell()
Creates a new, empty cell.

Overrides:
createCell in class HTMLTable
Returns:
the newly created TD

prepareCell

protected void prepareCell(int row,
                           int column)
Checks that a cell is a valid cell in the table.

Specified by:
prepareCell in class HTMLTable
Parameters:
row - the cell's row
column - the cell's column
Throws:
IndexOutOfBoundsException

prepareRow

protected void prepareRow(int row)
Checks that the row index is valid.

Specified by:
prepareRow in class HTMLTable
Parameters:
row - The row index to be checked
Throws:
IndexOutOfBoundException - if the row is negative


This javadoc distribution was not produced by Google. The official documentation is here.