Package com.google.gwt.user.client.ui
Class FlexTable
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
- All Implemented Interfaces:
HasAllDragAndDropHandlers,HasClickHandlers,HasDoubleClickHandlers,HasDragEndHandlers,HasDragEnterHandlers,HasDragHandlers,HasDragLeaveHandlers,HasDragOverHandlers,HasDragStartHandlers,HasDropHandlers,HasAttachHandlers,HasHandlers,EventListener,HasVisibility,HasWidgets,HasWidgets.ForIsWidget,IsWidget,SourcesTableEvents,Iterable<Widget>
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
public class FlexTableExample implements EntryPoint {
public void onModuleLoad() {
// Tables have no explicit size -- they resize automatically on demand.
FlexTable t = new FlexTable();
// Put some text at the table's extremes. This forces the table to be
// 3 by 3.
t.setText(0, 0, "upper-left corner");
t.setText(2, 2, "bottom-right corner");
// Let's put a button in the middle...
t.setWidget(1, 0, new Button("Wide Button"));
// ...and set it's column span so that it takes up the whole row.
t.getFlexCellFormatter().setColSpan(1, 0, 3);
RootPanel.get().add(t);
}
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassFlexTable-specific implementation ofHTMLTable.CellFormatter.Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.HTMLTable
HTMLTable.Cell, HTMLTable.CellFormatter, HTMLTable.ColumnFormatter, HTMLTable.RowFormatterNested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget -
Field Summary
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSinkFields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCell(int row) Appends a cell to the specified row.intgetCellCount(int row) Gets the number of cells on a given row.Explicitly gets theFlexTable.FlexCellFormatter.intGets the number of rows.voidinsertCell(int beforeRow, int beforeColumn) Inserts a cell into the FlexTable.intinsertRow(int beforeRow) Inserts a row into the FlexTable.protected voidprepareCell(int row, int column) Ensure that the cell exists.protected voidprepareRow(int row) Ensure that the row exists.voidRemove all rows in this table.voidremoveCell(int row, int col) Removes the specified cell from the table.voidremoveCells(int row, int column, int num) Removes a number of cells from a row in the table.voidremoveRow(int row) Removes the specified row from the table.Methods inherited from class com.google.gwt.user.client.ui.HTMLTable
addCells, addClickHandler, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addTableListener, checkCellBounds, checkRowBounds, clear, clear, clearCell, createCell, getBodyElement, getCellForEvent, getCellFormatter, getCellPadding, getCellSpacing, getColumnFormatter, getDOMCellCount, getDOMCellCount, getDOMCellCount, getDOMRowCount, getDOMRowCount, getDOMRowCount, getEventTargetCell, getHTML, getRowFormatter, getText, getWidget, insertCells, internalClearCell, internalClearCell, isCellPresent, iterator, onEnsureDebugId, prepareColumn, remove, removeTableListener, setBorderWidth, setCellFormatter, setCellPadding, setCellSpacing, setColumnFormatter, setHTML, setHTML, setRowFormatter, setText, setWidget, setWidgetMethods inherited from class com.google.gwt.user.client.ui.Panel
add, add, adopt, doAttachChildren, doDetachChildren, orphan, removeMethods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEventsMethods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEventMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
FlexTable
public FlexTable()
-
-
Method Details
-
addCell
public void addCell(int row) Appends a cell to the specified row.- Parameters:
row- the row to which the new cell will be added- Throws:
IndexOutOfBoundsException
-
getCellCount
public int getCellCount(int row) Gets the number of cells on a given row.- Specified by:
getCellCountin classHTMLTable- Parameters:
row- the row whose cells are to be counted- Returns:
- the number of cells present
- Throws:
IndexOutOfBoundsException
-
getFlexCellFormatter
Explicitly gets theFlexTable.FlexCellFormatter. The results ofHTMLTable.getCellFormatter()may also be downcast to aFlexTable.FlexCellFormatter.- Returns:
- the FlexTable's cell formatter
-
getRowCount
public int getRowCount()Gets the number of rows.- Specified by:
getRowCountin classHTMLTable- Returns:
- number of rows
-
insertCell
public void insertCell(int beforeRow, int beforeColumn) Inserts a cell into the FlexTable.- Overrides:
insertCellin classHTMLTable- Parameters:
beforeRow- the cell's rowbeforeColumn- the cell's column
-
insertRow
public int insertRow(int beforeRow) Inserts a row into the FlexTable. -
removeAllRows
public void removeAllRows()Remove all rows in this table. -
removeCell
public void removeCell(int row, int col) Description copied from class:HTMLTableRemoves the specified cell from the table.- Overrides:
removeCellin classHTMLTable- Parameters:
row- the row of the cell to removecol- the column of cell to remove
-
removeCells
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 removedcolumn- the column of the first cell to be removednum- the number of cells to be removed- Throws:
IndexOutOfBoundsException
-
removeRow
public void removeRow(int row) Description copied from class:HTMLTableRemoves the specified row from the table. -
prepareCell
protected void prepareCell(int row, int column) Ensure that the cell exists.- Specified by:
prepareCellin classHTMLTable- Parameters:
row- the row to prepare.column- the column to prepare.- Throws:
IndexOutOfBoundsException- if the row is negative
-
prepareRow
protected void prepareRow(int row) Ensure that the row exists.- Specified by:
prepareRowin classHTMLTable- Parameters:
row- The row to prepare.- Throws:
IndexOutOfBoundsException- if the row is negative
-