GWT 2.4.0

com.google.gwt.user.cellview.client
Class AbstractCellTable<T>

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.Composite
              extended by com.google.gwt.user.cellview.client.AbstractHasData<T>
                  extended by com.google.gwt.user.cellview.client.AbstractCellTable<T>
Type Parameters:
T - the data type of each row
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, HasKeyboardPagingPolicy, HasKeyboardSelectionPolicy, EventListener, Focusable, HasVisibility, IsRenderable, IsWidget, HasCellPreviewHandlers<T>, HasData<T>, HasKeyProvider<T>, HasRows
Direct Known Subclasses:
CellTable, DataGrid

public abstract class AbstractCellTable<T>
extends AbstractHasData<T>

Abstract base class for tabular views that supports paging and columns.

Columns

The 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.

Headers and Footers

A Header can be placed at the top (header) or bottom (footer) of the AbstractCellTable. You can specify a header as text using 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.


Nested Class Summary
static interface AbstractCellTable.Resources
          A ClientBundle that provides images for this widget.
static interface AbstractCellTable.Style
          Styles used by this widget.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.cellview.client.HasKeyboardPagingPolicy
HasKeyboardPagingPolicy.KeyboardPagingPolicy
 
Nested classes/interfaces inherited from interface com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy
HasKeyboardSelectionPolicy.KeyboardSelectionPolicy
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
AbstractCellTable(Element elem, int pageSize, AbstractCellTable.Resources resources, ProvidesKey<T> keyProvider)
          Constructs a table with the given page size, the specified AbstractCellTable.Style, and the given key provider.
AbstractCellTable(Widget widget, int pageSize, AbstractCellTable.Resources resources, ProvidesKey<T> keyProvider)
          Constructs a table with the given page size, the specified AbstractCellTable.Style, and the given key provider.
 
Method Summary
 void addColumn(Column<T,?> col)
          Adds a column to the end of the table.
 void addColumn(Column<T,?> col, Header<?> header)
          Adds a column to the end of the table with an associated header.
 void addColumn(Column<T,?> col, Header<?> header, Header<?> footer)
          Adds a column to the end of the table with an associated header and footer.
 void addColumn(Column<T,?> col, SafeHtml headerHtml)
          Adds a column to the end of the table with an associated SafeHtml header.
 void addColumn(Column<T,?> col, SafeHtml headerHtml, SafeHtml footerHtml)
          Adds a column to the end of the table with an associated SafeHtml header and footer.
 void addColumn(Column<T,?> col, java.lang.String headerString)
          Adds a column to the end of the table with an associated String header.
 void addColumn(Column<T,?> col, java.lang.String headerString, java.lang.String footerString)
          Adds a column to the end of the table with an associated String header and footer.
 HandlerRegistration addColumnSortHandler(ColumnSortEvent.Handler handler)
          Add a handler to handle ColumnSortEvents.
abstract  void addColumnStyleName(int index, java.lang.String styleName)
          Add a style name to the col element at the specified index, creating it if necessary.
 void clearColumnWidth(Column<T,?> column)
          Clear the width of the specified Column.
protected  Element convertToElements(SafeHtml html)
          Convert the specified HTML into DOM elements and return the parent of the DOM elements.
protected  boolean dependsOnSelection()
          Check whether or not the cells in the view depend on the selection state.
protected  void doSelection(Event event, T value, int row, int column)
          Deprecated. use AbstractHasData.addCellPreviewHandler(com.google.gwt.view.client.CellPreviewEvent.Handler) instead
protected abstract  void doSetColumnWidth(int column, java.lang.String width)
          Set the width of a column.
protected abstract  void doSetHeaderVisible(boolean isFooter, boolean isVisible)
          Show or hide a header section.
 void flush()
          Flush all pending changes to the table and render immediately.
protected  Element getChildContainer()
          Return the element that holds the rendered cells.
 Column<T,?> getColumn(int col)
          Get the column at the specified index.
 int getColumnCount()
          Get the number of columns in the table.
 int getColumnIndex(Column<T,?> column)
          Get the index of the specified column.
 ColumnSortList getColumnSortList()
          Get the ColumnSortList that specifies which columns are sorted.
 java.lang.String getColumnWidth(Column<T,?> column)
          Get the width of a Column.
 Widget getEmptyTableWidget()
          Get the widget displayed when the table has no rows.
protected  Element getKeyboardSelectedElement()
          Get the element that has keyboard selection.
 Widget getLoadingIndicator()
          Get the widget displayed when the data is loading.
 TableRowElement getRowElement(int row)
          Get the TableRowElement for the specified row.
protected abstract  TableSectionElement getTableBodyElement()
          Get the tbody element that contains the render row values.
protected abstract  TableSectionElement getTableFootElement()
          Get the tfoot element that contains the footers.
protected abstract  TableSectionElement getTableHeadElement()
          Get the thead element that contains theh eaders.
 void insertColumn(int beforeIndex, Column<T,?> col)
          Inserts a column into the table at the specified index.
 void insertColumn(int beforeIndex, Column<T,?> col, Header<?> header)
          Inserts a column into the table at the specified index with an associated header.
 void insertColumn(int beforeIndex, Column<T,?> col, Header<?> header, Header<?> footer)
          Inserts a column into the table at the specified index with an associated header and footer.
 void insertColumn(int beforeIndex, Column<T,?> col, SafeHtml headerHtml)
          Inserts a column into the table at the specified index with an associated SafeHtml header.
 void insertColumn(int beforeIndex, Column<T,?> col, SafeHtml headerHtml, SafeHtml footerHtml)
          Inserts a column into the table at the specified index with an associated SafeHtml header and footer.
 void insertColumn(int beforeIndex, Column<T,?> col, java.lang.String headerString)
          Inserts a column into the table at the specified index with an associated String header.
 void insertColumn(int beforeIndex, Column<T,?> col, java.lang.String headerString, java.lang.String footerString)
          Inserts a column into the table at the specified index with an associated String header and footer.
protected  boolean isKeyboardNavigationSuppressed()
          Check if keyboard navigation is being suppressed, such as when the user is editing a cell.
protected  void onBlur()
          Called when the widget is blurred.
protected  void onBrowserEvent2(Event event)
          Called after AbstractHasData.onBrowserEvent(Event) completes.
protected  void onFocus()
          Called when the widget is focused.
 void redraw()
          Redraw the widget using the existing data.
 void redrawFooters()
          Redraw the table's footers.
 void redrawHeaders()
          Redraw the table's headers.
protected  void refreshColumnWidths()
           
 void removeColumn(Column<T,?> col)
          Remove a column.
 void removeColumn(int index)
          Remove a column.
abstract  void removeColumnStyleName(int index, java.lang.String styleName)
          Remove a style from the col element at the specified index.
protected  void renderRowValues(SafeHtmlBuilder sb, java.util.List<T> values, int start, SelectionModel<? super T> selectionModel)
          Render all row values into the specified SafeHtmlBuilder.
protected  void replaceAllChildren(java.util.List<T> values, SafeHtml html)
          Replace all children with the specified html.
protected  boolean resetFocusOnCell()
          Reset focus on the currently focused cell.
 void setColumnWidth(Column<T,?> column, double width, Style.Unit unit)
          Set the width of a Column.
 void setColumnWidth(Column<T,?> column, java.lang.String width)
          Set the width of a Column.
 void setEmptyTableWidget(Widget widget)
          Set the widget to display when the table has no rows.
protected  void setKeyboardSelected(int index, boolean selected, boolean stealFocus)
          Update an element to reflect its keyboard selected state.
 void setLoadingIndicator(Widget widget)
          Set the widget to display when the data is loading.
 void setRowStyles(RowStyles<T> rowStyles)
          Sets the object used to determine how a row is styled; the change will take effect the next time that the table is rendered.
protected  void setSelected(Element elem, boolean selected)
          Deprecated. this method is never called by AbstractHasData, render the selected styles in renderRowValues(SafeHtmlBuilder, List, int, SelectionModel)
 
Methods inherited from class com.google.gwt.user.cellview.client.AbstractHasData
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, onLoadingStateChanged, onUnload, onUpdateSelection, replaceChildren, setAccessKey, setFocus, setFocusable, setKeyboardPagingPolicy, setKeyboardSelectionPolicy, setPageSize, setPageStart, setRowCount, setRowCount, setRowData, setRowData, setSelectionModel, setSelectionModel, setTabIndex, setVisibleRange, setVisibleRange, setVisibleRangeAndClearData
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onAttach, onDetach, performDetachedInitialization, render, render, resolvePotentialElement, setWidget, wrapElement
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, removeFromParent, setLayoutData, sinkEvents
 
Methods 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, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

AbstractCellTable

public AbstractCellTable(Element elem,
                         int pageSize,
                         AbstractCellTable.Resources resources,
                         ProvidesKey<T> keyProvider)
Constructs a table with the given page size, the specified AbstractCellTable.Style, and the given key provider.

Parameters:
elem - the parent Element
pageSize - the page size
resources - the resources to apply to the widget
keyProvider - an instance of ProvidesKey, or null if the record object should act as its own key

AbstractCellTable

public AbstractCellTable(Widget widget,
                         int pageSize,
                         AbstractCellTable.Resources resources,
                         ProvidesKey<T> keyProvider)
Constructs a table with the given page size, the specified AbstractCellTable.Style, and the given key provider.

Parameters:
widget - the parent widget
pageSize - the page size
resources - the resources to apply to the widget
keyProvider - an instance of ProvidesKey, or null if the record object should act as its own key
Method Detail

addColumn

public void addColumn(Column<T,?> col)
Adds a column to the end of the table.

Parameters:
col - the column to be added

addColumn

public void addColumn(Column<T,?> col,
                      Header<?> header)
Adds a column to the end of the table with an associated header.

Parameters:
col - the column to be added
header - the associated Header

addColumn

public void addColumn(Column<T,?> col,
                      Header<?> header,
                      Header<?> footer)
Adds a column to the end of the table with an associated header and footer.

Parameters:
col - the column to be added
header - the associated Header
footer - the associated footer (as a Header object)

addColumn

public void addColumn(Column<T,?> col,
                      java.lang.String headerString)
Adds a column to the end of the table with an associated String header.

Parameters:
col - the column to be added
headerString - the associated header text, as a String

addColumn

public void addColumn(Column<T,?> col,
                      SafeHtml headerHtml)
Adds a column to the end of the table with an associated SafeHtml header.

Parameters:
col - the column to be added
headerHtml - the associated header text, as safe HTML

addColumn

public void addColumn(Column<T,?> col,
                      java.lang.String headerString,
                      java.lang.String footerString)
Adds a column to the end of the table with an associated String header and footer.

Parameters:
col - the column to be added
headerString - the associated header text, as a String
footerString - the associated footer text, as a String

addColumn

public void addColumn(Column<T,?> col,
                      SafeHtml headerHtml,
                      SafeHtml footerHtml)
Adds a column to the end of the table with an associated SafeHtml header and footer.

Parameters:
col - the column to be added
headerHtml - the associated header text, as safe HTML
footerHtml - the associated footer text, as safe HTML

addColumnSortHandler

public HandlerRegistration addColumnSortHandler(ColumnSortEvent.Handler handler)
Add a handler to handle ColumnSortEvents.

Parameters:
handler - the ColumnSortEvent.Handler to add
Returns:
a HandlerRegistration to remove the handler

addColumnStyleName

public abstract void addColumnStyleName(int index,
                                        java.lang.String styleName)
Add a style name to the col element at the specified index, creating it if necessary.

Parameters:
index - the column index
styleName - the style name to add

clearColumnWidth

public void clearColumnWidth(Column<T,?> column)
Clear the width of the specified Column.

Parameters:
column - the column

flush

public void flush()
Flush all pending changes to the table and render immediately.

Modifications to the table, such as adding columns or setting data, are not rendered immediately. Instead, changes are coalesced at the end of the current event loop to avoid rendering the table multiple times. Use this method to force the table to render all pending modifications immediately.


getColumn

public Column<T,?> getColumn(int col)
Get the column at the specified index.

Parameters:
col - the index of the column to retrieve
Returns:
the Column at the index

getColumnCount

public int getColumnCount()
Get the number of columns in the table.

Returns:
the column count

getColumnIndex

public int getColumnIndex(Column<T,?> column)
Get the index of the specified column.

Parameters:
column - the column to search for
Returns:
the index of the column, or -1 if not found

getColumnSortList

public ColumnSortList getColumnSortList()
Get the ColumnSortList that specifies which columns are sorted. Modifications to the ColumnSortList will be reflected in the table header.

Returns:
the ColumnSortList

getColumnWidth

public java.lang.String getColumnWidth(Column<T,?> column)
Get the width of a Column.

Parameters:
column - the column
Returns:
the width of the column, or null if not set
See Also:
#setColumnWidth(Column, double, Unit)

getEmptyTableWidget

public Widget getEmptyTableWidget()
Get the widget displayed when the table has no rows.

Returns:
the empty table widget

getLoadingIndicator

public Widget getLoadingIndicator()
Get the widget displayed when the data is loading.

Returns:
the loading indicator

getRowElement

public TableRowElement getRowElement(int row)
Get the TableRowElement for the specified row. If the row element has not been created, null is returned.

Parameters:
row - the row index
Returns:
the row element, or null if it doesn't exists
Throws:
java.lang.IndexOutOfBoundsException - if the row index is outside of the current page

insertColumn

public void insertColumn(int beforeIndex,
                         Column<T,?> col)
Inserts a column into the table at the specified index.

Parameters:
beforeIndex - the index to insert the column
col - the column to be added

insertColumn

public void insertColumn(int beforeIndex,
                         Column<T,?> col,
                         Header<?> header)
Inserts a column into the table at the specified index with an associated header.

Parameters:
beforeIndex - the index to insert the column
col - the column to be added
header - the associated Header

insertColumn

public void insertColumn(int beforeIndex,
                         Column<T,?> col,
                         Header<?> header,
                         Header<?> footer)
Inserts a column into the table at the specified index with an associated header and footer.

Parameters:
beforeIndex - the index to insert the column
col - the column to be added
header - the associated Header
footer - the associated footer (as a Header object)
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

insertColumn

public void insertColumn(int beforeIndex,
                         Column<T,?> col,
                         java.lang.String headerString)
Inserts a column into the table at the specified index with an associated String header.

Parameters:
beforeIndex - the index to insert the column
col - the column to be added
headerString - the associated header text, as a String

insertColumn

public void insertColumn(int beforeIndex,
                         Column<T,?> col,
                         SafeHtml headerHtml)
Inserts a column into the table at the specified index with an associated SafeHtml header.

Parameters:
beforeIndex - the index to insert the column
col - the column to be added
headerHtml - the associated header text, as safe HTML

insertColumn

public void insertColumn(int beforeIndex,
                         Column<T,?> col,
                         java.lang.String headerString,
                         java.lang.String footerString)
Inserts a column into the table at the specified index with an associated String header and footer.

Parameters:
beforeIndex - the index to insert the column
col - the column to be added
headerString - the associated header text, as a String
footerString - the associated footer text, as a String

insertColumn

public void insertColumn(int beforeIndex,
                         Column<T,?> col,
                         SafeHtml headerHtml,
                         SafeHtml footerHtml)
Inserts a column into the table at the specified index with an associated SafeHtml header and footer.

Parameters:
beforeIndex - the index to insert the column
col - the column to be added
headerHtml - the associated header text, as safe HTML
footerHtml - the associated footer text, as safe HTML

redraw

public void redraw()
Description copied from class: AbstractHasData
Redraw the widget using the existing data.

Overrides:
redraw in class AbstractHasData<T>

redrawFooters

public void redrawFooters()
Redraw the table's footers.


redrawHeaders

public void redrawHeaders()
Redraw the table's headers.


removeColumn

public void removeColumn(Column<T,?> col)
Remove a column.

Parameters:
col - the column to remove

removeColumn

public void removeColumn(int index)
Remove a column.

Parameters:
index - the column index

removeColumnStyleName

public abstract void removeColumnStyleName(int index,
                                           java.lang.String styleName)
Remove a style from the col element at the specified index.

Parameters:
index - the column index
styleName - the style name to remove

setColumnWidth

public void setColumnWidth(Column<T,?> column,
                           java.lang.String width)
Set the width of a Column.

Parameters:
column - the column
width - the width of the column

setColumnWidth

public void setColumnWidth(Column<T,?> column,
                           double width,
                           Style.Unit unit)
Set the width of a Column.

Parameters:
column - the column
width - the width of the column
unit - the Style.Unit of measurement

setEmptyTableWidget

public void setEmptyTableWidget(Widget widget)
Set the widget to display when the table has no rows.

Parameters:
widget - the empty table widget, or null to disable

setLoadingIndicator

public void setLoadingIndicator(Widget widget)
Set the widget to display when the data is loading.

Parameters:
widget - the loading indicator, or null to disable

setRowStyles

public void setRowStyles(RowStyles<T> rowStyles)
Sets the object used to determine how a row is styled; the change will take effect the next time that the table is rendered.

Parameters:
rowStyles - a RowStyles object

convertToElements

protected Element convertToElements(SafeHtml html)
Description copied from class: AbstractHasData
Convert the specified HTML into DOM elements and return the parent of the DOM elements.

Overrides:
convertToElements in class AbstractHasData<T>
Parameters:
html - the HTML to convert
Returns:
the parent element

dependsOnSelection

protected boolean dependsOnSelection()
Description copied from class: AbstractHasData
Check whether or not the cells in the view depend on the selection state.

Specified by:
dependsOnSelection in class AbstractHasData<T>
Returns:
true if cells depend on selection, false if not

doSelection

@Deprecated
protected void doSelection(Event event,
                                      T value,
                                      int row,
                                      int column)
Deprecated. use AbstractHasData.addCellPreviewHandler(com.google.gwt.view.client.CellPreviewEvent.Handler) instead

Called when a user action triggers selection.

Parameters:
event - the event that triggered selection
value - the value that was selected
row - the row index of the value on the page
column - the column index where the event occurred

doSetColumnWidth

protected abstract void doSetColumnWidth(int column,
                                         java.lang.String width)
Set the width of a column.

Parameters:
column - the column index
width - the width, or null to clear the width

doSetHeaderVisible

protected abstract void doSetHeaderVisible(boolean isFooter,
                                           boolean isVisible)
Show or hide a header section.

Parameters:
isFooter - true for the footer, false for the header
isVisible - true to show, false to hide

getChildContainer

protected Element getChildContainer()
Description copied from class: AbstractHasData
Return the element that holds the rendered cells.

Specified by:
getChildContainer in class AbstractHasData<T>
Returns:
the container Element

getKeyboardSelectedElement

protected Element getKeyboardSelectedElement()
Description copied from class: AbstractHasData
Get the element that has keyboard selection.

Specified by:
getKeyboardSelectedElement in class AbstractHasData<T>
Returns:
the keyboard selected element

getTableBodyElement

protected abstract TableSectionElement getTableBodyElement()
Get the tbody element that contains the render row values.


getTableFootElement

protected abstract TableSectionElement getTableFootElement()
Get the tfoot element that contains the footers.


getTableHeadElement

protected abstract TableSectionElement getTableHeadElement()
Get the thead element that contains theh eaders.


isKeyboardNavigationSuppressed

protected boolean isKeyboardNavigationSuppressed()
Description copied from class: AbstractHasData
Check if keyboard navigation is being suppressed, such as when the user is editing a cell.

Specified by:
isKeyboardNavigationSuppressed in class AbstractHasData<T>
Returns:
true if suppressed, false if not

onBlur

protected void onBlur()
Description copied from class: AbstractHasData
Called when the widget is blurred.

Overrides:
onBlur in class AbstractHasData<T>

onBrowserEvent2

protected void onBrowserEvent2(Event event)
Description copied from class: AbstractHasData
Called after AbstractHasData.onBrowserEvent(Event) completes.

Overrides:
onBrowserEvent2 in class AbstractHasData<T>
Parameters:
event - the event that was fired

onFocus

protected void onFocus()
Description copied from class: AbstractHasData
Called when the widget is focused.

Overrides:
onFocus in class AbstractHasData<T>

refreshColumnWidths

protected void refreshColumnWidths()

renderRowValues

protected void renderRowValues(SafeHtmlBuilder sb,
                               java.util.List<T> values,
                               int start,
                               SelectionModel<? super T> selectionModel)
Description copied from class: AbstractHasData
Render all row values into the specified SafeHtmlBuilder.

Specified by:
renderRowValues in class AbstractHasData<T>
Parameters:
sb - the SafeHtmlBuilder to render into
values - the row values
start - the absolute start index of the values
selectionModel - the SelectionModel

replaceAllChildren

protected void replaceAllChildren(java.util.List<T> values,
                                  SafeHtml html)
Description copied from class: AbstractHasData
Replace all children with the specified html.

Overrides:
replaceAllChildren in class AbstractHasData<T>
Parameters:
values - the values of the new children
html - the html to render in the child

resetFocusOnCell

protected boolean resetFocusOnCell()
Description copied from class: AbstractHasData
Reset focus on the currently focused cell.

Specified by:
resetFocusOnCell in class AbstractHasData<T>
Returns:
true if focus is taken, false if not

setKeyboardSelected

protected void setKeyboardSelected(int index,
                                   boolean selected,
                                   boolean stealFocus)
Description copied from class: AbstractHasData
Update an element to reflect its keyboard selected state.

Specified by:
setKeyboardSelected in class AbstractHasData<T>
Parameters:
index - the index of the element
selected - true if selected, false if not
stealFocus - true if the row should steal focus, false if not

setSelected

@Deprecated
protected void setSelected(Element elem,
                                      boolean selected)
Deprecated. this method is never called by AbstractHasData, render the selected styles in renderRowValues(SafeHtmlBuilder, List, int, SelectionModel)

Description copied from class: AbstractHasData
Update an element to reflect its selected state.

Overrides:
setSelected in class AbstractHasData<T>
Parameters:
elem - the element to update
selected - true if selected, false if not

GWT 2.4.0