|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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.Grid
public class Grid
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.
public class GridExample implements EntryPoint { public void onModuleLoad() { // Grids must be sized explicitly, though they can be resized later. Grid g = new Grid(5, 5); // Put some values in the grid cells. for (int row = 0; row < 5; ++row) { for (int col = 0; col < 5; ++col) g.setText(row, col, "" + row + ", " + col); } // Just for good measure, let's put a button in the center. g.setWidget(2, 2, new Button("Does nothing, but could")); // You can use the CellFormatter to affect the layout of the grid's cells. g.getCellFormatter().setWidth(0, 2, "256px"); RootPanel.get().add(g); } }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.HTMLTable |
---|
HTMLTable.CellFormatter, HTMLTable.ColumnFormatter, HTMLTable.RowFormatter |
Field Summary | |
---|---|
protected int |
numColumns
Number of columns in the current grid. |
protected int |
numRows
Number of rows in the current grid. |
Constructor Summary | |
---|---|
Grid()
Constructor for 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 |
prepareColumn(int column)
Checks that the column index is valid. |
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 |
---|
addTableListener, checkCellBounds, checkRowBounds, clear, getBodyElement, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getDOMCellCount, getDOMCellCount, getDOMRowCount, getDOMRowCount, getEventTargetCell, getHTML, getRowFormatter, getText, getWidget, insertCell, insertCells, insertRow, internalClearCell, isCellPresent, iterator, onBrowserEvent, remove, removeCell, removeRow, removeTableListener, setBorderWidth, setCellFormatter, setCellPadding, setCellSpacing, setColumnFormatter, 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, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, 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 |
---|
protected int numColumns
protected int numRows
Constructor Detail |
---|
public Grid()
Grid
.
public Grid(int rows, int columns)
rows
- the number of rowscolumns
- the number of columns
java.lang.IndexOutOfBoundsException
Method Detail |
---|
public boolean clearCell(int row, int column)
clearCell
in class HTMLTable
row
- the cell's rowcolumn
- the cell's column
java.lang.IndexOutOfBoundsException
public int getCellCount(int row)
getCellCount
in class HTMLTable
row
- the row whose cells are to be counted
public int getColumnCount()
public int getRowCount()
getRowCount
in class HTMLTable
public void resize(int rows, int columns)
rows
- the number of rowscolumns
- the number of columns
java.lang.IndexOutOfBoundsException
public void resizeColumns(int columns)
columns
- the number of columns
java.lang.IndexOutOfBoundsException
public void resizeRows(int rows)
rows
- the number of rows
java.lang.IndexOutOfBoundsException
protected Element createCell()
createCell
in class HTMLTable
protected void prepareCell(int row, int column)
prepareCell
in class HTMLTable
row
- the cell's rowcolumn
- the cell's column
java.lang.IndexOutOfBoundsException
protected void prepareColumn(int column)
prepareColumn
in class HTMLTable
column
- The column index to be checked
java.lang.IndexOutOfBoundsException
- if the column is negativeprotected void prepareRow(int row)
prepareRow
in class HTMLTable
row
- The row index to be checked
java.lang.IndexOutOfBoundsException
- if the row is negative
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |