com.google.gwt.widgetideas.table.client.overrides
Class Grid

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.widgetideas.table.client.overrides.HTMLTable
                  extended by com.google.gwt.widgetideas.table.client.overrides.Grid
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.SourcesTableEvents
Direct Known Subclasses:
SelectionGrid

public class Grid
extends HTMLTable

This class should replace the actual class of the same name. TODO: Incorporate changes into actual class.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.overrides.HTMLTable
HTMLTable.CellFormatter, HTMLTable.ColumnFormatter, HTMLTable.RowFormatter, HTMLTable.WidgetMapper
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
protected  int numColumns
          Number of columns in the current grid.
protected  int numRows
          Number of rows in the current grid.
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Grid()
          Constructor for Grid.
Grid(int rows, int columns)
          Constructs a grid with the requested size.
 
Method Summary
protected  com.google.gwt.user.client.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  int insertRow(int beforeRow)
          Inserts a new row into the table.
protected  void prepareCell(int row, int column)
          Checks that a cell is a valid cell in the table.
protected  void prepareColumn(int column)
          Checks that the column index is valid.
protected  void prepareRow(int row)
          Checks that the row index is valid.
protected  void removeRow(int row)
          Removes the specified row from the table.
 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.widgetideas.table.client.overrides.HTMLTable
addTableListener, checkCellBounds, checkRowBounds, cleanCell, clear, clearAll, clearCell, getBodyElement, getCellContainer, getCellContainer, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getDOMCellCount, getDOMCellCount, getDOMRowCount, getDOMRowCount, getEventTargetCell, getEventTargetRow, getHTML, getRowFormatter, getRowIndex, getText, getWidget, getWidgetMap, insertCell, insertCells, internalClearCell, isCellPresent, iterator, onBrowserEvent, remove, removeCell, removeTableListener, setBodyElement, setBorderWidth, setCellFormatter, setCellPadding, setCellSpacing, setClearText, setColumnFormatter, setElement, setHTML, setRowFormatter, setText, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onAttach, onDetach, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numColumns

protected int numColumns
Number of columns in the current grid.


numRows

protected int numRows
Number of rows in the current grid.

Constructor Detail

Grid

public Grid()
Constructor for 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:
java.lang.IndexOutOfBoundsException
Method Detail

getCellCount

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

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:
java.lang.IndexOutOfBoundsException

resizeColumns

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

Parameters:
columns - the number of columns
Throws:
java.lang.IndexOutOfBoundsException

resizeRows

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

Parameters:
rows - the number of rows
Throws:
java.lang.IndexOutOfBoundsException

createCell

protected com.google.gwt.user.client.Element createCell()
Creates a new, empty cell.

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

insertRow

protected int insertRow(int beforeRow)
Description copied from class: HTMLTable
Inserts a new row into the table.

Overrides:
insertRow in class HTMLTable
Parameters:
beforeRow - the index before which the new row will be inserted
Returns:
the index of the newly-created row
See Also:
HTMLTable

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:
java.lang.IndexOutOfBoundsException

prepareColumn

protected void prepareColumn(int column)
Checks that the column index is valid.

Overrides:
prepareColumn in class HTMLTable
Parameters:
column - The column index to be checked
Throws:
java.lang.IndexOutOfBoundsException - if the column is negative

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:
java.lang.IndexOutOfBoundsException - if the row is negative

removeRow

protected void removeRow(int row)
Description copied from class: HTMLTable
Removes the specified row from the table.

Overrides:
removeRow in class HTMLTable
Parameters:
row - the index of the row to be removed
See Also:
HTMLTable