com.google.gwt.widgetideas.table.client
Class ListTableModel<R>

java.lang.Object
  extended by com.google.gwt.widgetideas.table.client.TableModel<R>
      extended by com.google.gwt.widgetideas.table.client.ClientTableModel<R>
          extended by com.google.gwt.widgetideas.table.client.ListTableModel<R>
Type Parameters:
R - the data type of the row values
All Implemented Interfaces:
SourceTableModelEvents

public class ListTableModel<R>
extends ClientTableModel<R>

A class to retrieve row data to be used in a table.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.ClientTableModel
ClientTableModel.ClientResponse<R>
 
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.TableModel
TableModel.Callback<R>, TableModel.ColumnSortInfo, TableModel.ColumnSortList, TableModel.Request, TableModel.Response<R>, TableModel.SerializableResponse<R extends java.io.Serializable>
 
Field Summary
 
Fields inherited from class com.google.gwt.widgetideas.table.client.TableModel
ALL_ROWS, UNKNOWN_ROW_COUNT
 
Constructor Summary
ListTableModel(java.util.List<java.util.List<java.lang.Object>> rows)
          Constructor.
 
Method Summary
 java.lang.Object getCell(int rowNum, int cellNum)
          Get the value for a given cell.
protected  boolean onRowInserted(int beforeRow)
          Event fired when a row is inserted.
protected  boolean onRowRemoved(int row)
          Event fired when a row is removed.
protected  boolean onSetData(int row, int cell, java.lang.Object data)
          Event fired when the local data changes.
 
Methods inherited from class com.google.gwt.widgetideas.table.client.ClientTableModel
requestRows
 
Methods inherited from class com.google.gwt.widgetideas.table.client.TableModel
addTableModelListener, getRowCount, insertRow, removeRow, removeTableModelListener, setData, setRowCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListTableModel

public ListTableModel(java.util.List<java.util.List<java.lang.Object>> rows)
Constructor.

Parameters:
rows - the data that this model feeds from
Method Detail

getCell

public java.lang.Object getCell(int rowNum,
                                int cellNum)
Description copied from class: ClientTableModel
Get the value for a given cell. Return null if no more values are available.

Specified by:
getCell in class ClientTableModel<R>
Parameters:
rowNum - the row index
cellNum - the column index
Returns:
the value at the given row and column
See Also:
ClientTableModel

onRowInserted

protected boolean onRowInserted(int beforeRow)
Description copied from class: TableModel
Event fired when a row is inserted. Returning true will increment the row count by one.

Specified by:
onRowInserted in class TableModel<R>
Parameters:
beforeRow - the row index of the new row
Returns:
true if the action is successful

onRowRemoved

protected boolean onRowRemoved(int row)
Description copied from class: TableModel
Event fired when a row is removed. Returning true will decrement the row count by one.

Specified by:
onRowRemoved in class TableModel<R>
Parameters:
row - the row index of the removed row
Returns:
true if the action is successful

onSetData

protected boolean onSetData(int row,
                            int cell,
                            java.lang.Object data)
Description copied from class: TableModel
Event fired when the local data changes. Returning true will ensure that the row count is at least as one greater than the row index.

Specified by:
onSetData in class TableModel<R>
Parameters:
row - the row index
cell - the cell index
data - the new contents of the cell
Returns:
true if the action is successful