T
- the data type of each rowpublic class CellTable<T> extends AbstractCellTable<T> implements AbstractCellTable.TableSectionChangeHandler
Column
class defines the
Cell
used to render a column. Implement
Column.getValue(Object)
to retrieve the field value from the row
object that will be rendered in the Cell
.
Header
can be placed at the top
(header) or bottom (footer) of the CellTable
. You can specify a
header as text using AbstractCellTable.addColumn(Column, String)
, or you can create a
custom Header
that can change with the value of the cells, such as a
column total. The Header
will be rendered every time the row data
changes or the table is redrawn. If you pass the same header instance (==)
into adjacent columns, the header will span the columns.
List
)Modifier and Type | Class and Description |
---|---|
static interface |
CellTable.BasicResources
Resources that match the GWT standard style theme.
|
static interface |
CellTable.Resources
A ClientBundle that provides images for this widget.
|
static interface |
CellTable.Style
Styles used by this widget.
|
AbstractCellTable.CellTableKeyboardSelectionHandler<T>, AbstractCellTable.TableSectionChangeHandler
AbstractHasData.DefaultKeyboardSelectionHandler<T>
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasKeyboardPagingPolicy.KeyboardPagingPolicy
HasKeyboardSelectionPolicy.KeyboardSelectionPolicy
DEBUG_ID_PREFIX
Constructor and Description |
---|
CellTable()
Constructs a table with a default page size of 15.
|
CellTable(int pageSize)
Constructs a table with the given page size.
|
CellTable(int pageSize,
CellTable.Resources resources)
Constructs a table with the given page size with the specified
CellTable.Resources . |
CellTable(int pageSize,
CellTable.Resources resources,
ProvidesKey<T> keyProvider)
Constructs a table with the given page size, the specified
CellTable.Resources , and the given key provider. |
CellTable(int pageSize,
CellTable.Resources resources,
ProvidesKey<T> keyProvider,
Widget loadingIndicator)
Constructs a table with the specified page size,
CellTable.Resources , key
provider, and loading indicator. |
CellTable(int pageSize,
CellTable.Resources resources,
ProvidesKey<T> keyProvider,
Widget loadingIndicator,
boolean enableColGroup,
boolean attachLoadingPanel)
Constructs a table with the specified page size,
CellTable.Resources , key
provider, and loading indicator. |
CellTable(int pageSize,
ProvidesKey<T> keyProvider)
Constructs a table with the given page size and the given
key provider . |
CellTable(ProvidesKey<T> keyProvider)
Constructs a table with a default page size of 15, and the given
key provider . |
Modifier and Type | Method and Description |
---|---|
void |
addColumnStyleName(int index,
String styleName)
Add a style name to the
col element at the specified index,
creating it if necessary. |
protected void |
doSetColumnWidth(int column,
String width)
Set the width of a column.
|
protected void |
doSetHeaderVisible(boolean isFooter,
boolean isVisible)
Show or hide a header section.
|
int |
getBodyHeight()
Return the height of the table body.
|
int |
getHeaderHeight()
Return the height of the table header.
|
protected TableSectionElement |
getTableBodyElement()
Get the tbody element that contains the render row values.
|
protected TableSectionElement |
getTableFootElement()
Get the tfoot element that contains the footers.
|
protected TableSectionElement |
getTableHeadElement()
Get the thead element that contains the headers.
|
TableSectionElement |
getTableLoadingSection()
Return the section that display loading indicator and the empty table widget.
|
protected void |
onLoadingStateChanged(LoadingStateChangeEvent.LoadingState state)
Called when the loading state changes.
|
void |
onTableBodyChange(TableSectionElement newTBody)
Notify that a table body section has been changed.
|
void |
onTableFootChange(TableSectionElement newTFoot)
Notify that a table body section has been changed.
|
void |
onTableHeadChange(TableSectionElement newTHead)
Notify that a table head section has been changed.
|
protected void |
refreshColumnWidths() |
void |
removeColumnStyleName(int index,
String styleName)
Remove a style from the
col element at the specified index. |
void |
setColumnWidth(Column<T,?> column,
double width,
Style.Unit unit)
Set the width of a
Column . |
void |
setColumnWidth(Column<T,?> column,
String width)
Set the width of a
Column . |
void |
setEmptyTableWidget(Widget widget)
Set the widget to display when the table has no rows.
|
void |
setLoadingIndicator(Widget widget)
Set the widget to display when the data is loading.
|
void |
setTableLayoutFixed(boolean isFixed)
Enable or disable fixed table layout.
|
void |
setWidth(String width,
boolean isFixedLayout)
Set the width of the width and specify whether or not it should use fixed
table layout.
|
addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumnSortHandler, addRowHoverHandler, clearColumnWidth, clearColumnWidth, convertToElements, dependsOnSelection, flush, getChildContainer, getChildElement, getColumn, getColumnCount, getColumnIndex, getColumnSortList, getColumnWidth, getEmptyTableWidget, getFooter, getFooterBuilder, getHeader, getHeaderBuilder, getKeyboardSelectedColumn, getKeyboardSelectedElement, getKeyboardSelectedSubRow, getLoadingIndicator, getRealColumnCount, getResources, getRowElement, getRowStyles, getSubRowElement, insertColumn, insertColumn, insertColumn, insertColumn, insertColumn, insertColumn, insertColumn, isAutoFooterRefreshDisabled, isAutoHeaderRefreshDisabled, isKeyboardNavigationSuppressed, isSkipRowHoverCheck, isSkipRowHoverFloatElementCheck, isSkipRowHoverStyleUpdate, onBlur, onBrowserEvent2, onFocus, redrawFooters, redrawHeaders, removeColumn, removeColumn, renderRowValues, renderRowValuesLegacy, replaceAllChildren, replaceChildren, resetFocusOnCell, setAutoFooterRefreshDisabled, setAutoHeaderRefreshDisabled, setColumnWidth, setColumnWidth, setFooterBuilder, setHeaderBuilder, setKeyboardSelected, setKeyboardSelectedColumn, setKeyboardSelectedColumn, setKeyboardSelectedRow, setKeyboardSelectedRow, setRowStyles, setSkipRowHoverCheck, setSkipRowHoverFloatElementCheck, setSkipRowHoverStyleUpdate, setTableBuilder
addCellPreviewHandler, addLoadingStateChangeHandler, addRangeChangeHandler, addRowCountChangeHandler, cellConsumesEventType, checkRowBounds, getAccessKey, getDisplayedItem, getDisplayedItems, getKeyboardPagingPolicy, getKeyboardSelectedRow, getKeyboardSelectionPolicy, getKeyProvider, getPageSize, getPageStart, getRowContainer, getRowCount, getSelectionModel, getTabIndex, getValueKey, getVisibleItem, getVisibleItemCount, getVisibleItems, getVisibleRange, isRowCountExact, isRowWithinBounds, onBrowserEvent, onUnload, redraw, redrawRow, setAccessKey, setFocus, setFocusable, setKeyboardPagingPolicy, setKeyboardSelectedRow, setKeyboardSelectionHandler, setKeyboardSelectionPolicy, setPageSize, setPageStart, setRowCount, setRowCount, setRowData, setRowData, setSelected, setSelectionModel, setSelectionModel, setTabIndex, setVisibleRange, setVisibleRange, setVisibleRangeAndClearData
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
fireEvent
public CellTable()
public CellTable(int pageSize)
pageSize
- the page sizepublic CellTable(ProvidesKey<T> keyProvider)
key provider
.keyProvider
- an instance of ProvidesKeypublic CellTable(int pageSize, CellTable.Resources resources)
CellTable.Resources
.pageSize
- the page sizeresources
- the resources to use for this widgetpublic CellTable(int pageSize, ProvidesKey<T> keyProvider)
key provider
.pageSize
- the page sizekeyProvider
- an instance of ProvidesKeypublic CellTable(int pageSize, CellTable.Resources resources, ProvidesKey<T> keyProvider)
CellTable.Resources
, and the given key provider.pageSize
- the page sizeresources
- the resources to use for this widgetkeyProvider
- an instance of ProvidesKeypublic CellTable(int pageSize, CellTable.Resources resources, ProvidesKey<T> keyProvider, Widget loadingIndicator)
CellTable.Resources
, key
provider, and loading indicator.pageSize
- the page sizeresources
- the resources to use for this widgetkeyProvider
- an instance of ProvidesKeyloadingIndicator
- the widget to use as a loading indicator, or null
to disablepublic CellTable(int pageSize, CellTable.Resources resources, ProvidesKey<T> keyProvider, Widget loadingIndicator, boolean enableColGroup, boolean attachLoadingPanel)
CellTable.Resources
, key
provider, and loading indicator.pageSize
- the page sizeresources
- the resources to use for this widgetkeyProvider
- an instance of ProvidesKeyloadingIndicator
- the widget to use as a loading indicator, or null
to disableenableColGroup
- enable colgroup element. This is used when the table is using fixed
layout and when column style is added. Ignoring this element will boost rendering
performance. Note that when colgroup is disabled, setColumnWidth(com.google.gwt.user.cellview.client.Column<T, ?>, java.lang.String)
,
setTableLayoutFixed
and addColumnStyleName
are no longe supportedattachLoadingPanel
- attaching the table section that contains the empty table widget and
the loading indicator. Attaching this to the table significantly improve the rendering
performance in webkit based browsers but also introduces significantly larger latency
in IE. If the panel is not attached to the table, it won't be displayed. But the user
can call getTableLoadingSection()
and attach it to other elements outside the
table elementpublic void addColumnStyleName(int index, String styleName)
AbstractCellTable
col
element at the specified index,
creating it if necessary.addColumnStyleName
in class AbstractCellTable<T>
index
- the column indexstyleName
- the style name to addpublic int getBodyHeight()
public int getHeaderHeight()
public TableSectionElement getTableLoadingSection()
public void onTableBodyChange(TableSectionElement newTBody)
AbstractCellTable.TableSectionChangeHandler
onTableBodyChange
in interface AbstractCellTable.TableSectionChangeHandler
newTBody
- the new body sectionpublic void onTableFootChange(TableSectionElement newTFoot)
AbstractCellTable.TableSectionChangeHandler
onTableFootChange
in interface AbstractCellTable.TableSectionChangeHandler
newTFoot
- the new foot sectionpublic void onTableHeadChange(TableSectionElement newTHead)
AbstractCellTable.TableSectionChangeHandler
onTableHeadChange
in interface AbstractCellTable.TableSectionChangeHandler
newTHead
- the new head sectionpublic void removeColumnStyleName(int index, String styleName)
AbstractCellTable
col
element at the specified index.removeColumnStyleName
in class AbstractCellTable<T>
index
- the column indexstyleName
- the style name to removepublic void setColumnWidth(Column<T,?> column, String width)
Column
. The width will persist with the column
and takes precedence of any width set via
AbstractCellTable.setColumnWidth(int, String)
.
The layout behavior depends on whether or not the table is using fixed layout.
setColumnWidth
in class AbstractCellTable<T>
column
- the columnwidth
- the width of the columnsetTableLayoutFixed(boolean)
public void setColumnWidth(Column<T,?> column, double width, Style.Unit unit)
Column
. The width will persist with the column
and takes precedence of any width set via
#setColumnWidth(int, double, Unit)
.
The layout behavior depends on whether or not the table is using fixed layout.
setColumnWidth
in class AbstractCellTable<T>
column
- the columnwidth
- the width of the columnunit
- the Style.Unit
of measurementsetTableLayoutFixed(boolean)
public void setEmptyTableWidget(Widget widget)
AbstractCellTable
setEmptyTableWidget
in class AbstractCellTable<T>
widget
- the empty table widget, or null to disablepublic void setLoadingIndicator(Widget widget)
AbstractCellTable
setLoadingIndicator
in class AbstractCellTable<T>
widget
- the loading indicator, or null to disablepublic void setTableLayoutFixed(boolean isFixed)
Enable or disable fixed table layout.
isFixed
- true to use fixed table layout, false not topublic final void setWidth(String width, boolean isFixedLayout)
setTableLayoutFixed(boolean)
for more
information about fixed layout tables.width
- the width of the tableisFixedLayout
- true to use fixed width layout, false not tosetTableLayoutFixed(boolean)
,
W3C HTML
Specificationprotected void doSetColumnWidth(int column, String width)
AbstractCellTable
doSetColumnWidth
in class AbstractCellTable<T>
column
- the column indexwidth
- the width, or null to clear the widthprotected void doSetHeaderVisible(boolean isFooter, boolean isVisible)
AbstractCellTable
doSetHeaderVisible
in class AbstractCellTable<T>
isFooter
- true for the footer, false for the headerisVisible
- true to show, false to hideprotected TableSectionElement getTableBodyElement()
AbstractCellTable
getTableBodyElement
in class AbstractCellTable<T>
protected TableSectionElement getTableFootElement()
AbstractCellTable
getTableFootElement
in class AbstractCellTable<T>
protected TableSectionElement getTableHeadElement()
AbstractCellTable
getTableHeadElement
in class AbstractCellTable<T>
protected void onLoadingStateChanged(LoadingStateChangeEvent.LoadingState state)
onLoadingStateChanged
in class AbstractHasData<T>
state
- the new loading stateprotected void refreshColumnWidths()
refreshColumnWidths
in class AbstractCellTable<T>
Copyright © 2018. All rights reserved.