
public class Grid extends HTMLTable
Widget within its cells. It must be
resized explicitly to the desired number of rows and columns.
Grid widget consists of <g:row> elements. Each <g:row> element
can contain one or more <g:cell> or <g:customCell> elements.
Using <g:cell> attribute it is possible to place pure HTML content.
<g:customCell> is used as a container for
Widget type objects. (Note that the
tags of the row, cell and customCell elements are not capitalized. This
is meant to signal that the item is not a runtime object, and so cannot
have a ui:field attribute.)
For example:
<g:Grid>
<g:row styleName="optionalHeaderStyle">
<g:customCell styleName="optionalFooCellStyle">
<g:Label>foo</g:Label>
</g:customCell>
<g:customCell styleName="optionalBarCellStyle">
<g:Label>bar</g:Label>
</g:customCell>
</g:row>
<g:row>
<g:cell>
<div>foo</div>
</g:cell>
<g:cell>
<div>bar</div>
</g:cell>
</g:row>
</g:Grid>
HTMLTable.Cell, HTMLTable.CellFormatter, HTMLTable.ColumnFormatter, HTMLTable.RowFormatterUIObject.DebugIdImpl, UIObject.DebugIdImplEnabledHasWidgets.ForIsWidget| Modifier and Type | Field and Description |
|---|---|
protected int |
numColumns
Number of columns in the current grid.
|
protected int |
numRows
Number of rows in the current grid.
|
DEBUG_ID_PREFIX| Constructor and Description |
|---|
Grid()
Constructor for
Grid. |
Grid(int rows,
int columns)
Constructs a grid with the requested size.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.
|
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.
|
addClickHandler, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addTableListener, checkCellBounds, checkRowBounds, clear, clear, getBodyElement, getCellForEvent, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getDOMCellCount, getDOMCellCount, getDOMCellCount, getDOMRowCount, getDOMRowCount, getDOMRowCount, getEventTargetCell, getHTML, getRowFormatter, getText, getWidget, insertCell, insertCells, internalClearCell, internalClearCell, isCellPresent, iterator, onEnsureDebugId, remove, removeCell, removeTableListener, setBorderWidth, setCellFormatter, setCellPadding, setCellSpacing, setColumnFormatter, setHTML, setHTML, setRowFormatter, setText, setWidget, setWidgetadd, add, adopt, doAttachChildren, doDetachChildren, orphan, removeaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringfireEventprotected int numColumns
protected int numRows
public Grid()
Grid.public Grid(int rows,
int columns)
rows - the number of rowscolumns - the number of columnsIndexOutOfBoundsExceptionpublic boolean clearCell(int row,
int column)
clearCell in class HTMLTablerow - the cell's rowcolumn - the cell's columnIndexOutOfBoundsExceptionpublic int getCellCount(int row)
getCellCount in class HTMLTablerow - the row whose cells are to be countedpublic int getColumnCount()
public int getRowCount()
getRowCount in class HTMLTablepublic int insertRow(int beforeRow)
resize(int, int) or resizeRows(int) as they are more
efficient.insertRow in class HTMLTablebeforeRow - the index before which the new row will be insertedIndexOutOfBoundsExceptionpublic void removeRow(int row)
HTMLTablepublic void resize(int rows,
int columns)
rows - the number of rowscolumns - the number of columnsIndexOutOfBoundsExceptionpublic void resizeColumns(int columns)
columns - the number of columnsIndexOutOfBoundsExceptionpublic void resizeRows(int rows)
rows - the number of rowsIndexOutOfBoundsExceptionprotected Element createCell()
createCell in class HTMLTableprotected void prepareCell(int row,
int column)
prepareCell in class HTMLTablerow - the cell's rowcolumn - the cell's columnIndexOutOfBoundsExceptionprotected void prepareColumn(int column)
prepareColumn in class HTMLTablecolumn - The column index to be checkedIndexOutOfBoundsException - if the column is negativeprotected void prepareRow(int row)
prepareRow in class HTMLTablerow - The row index to be checkedIndexOutOfBoundsException - if the row is negativeCopyright © 2018. All rights reserved.