com.google.gwt.widgetideas.table.client
Class TableController

java.lang.Object
  extended by com.google.gwt.widgetideas.table.client.TableController
Direct Known Subclasses:
CachedTableController

public class TableController
extends java.lang.Object

A controller that interfaces between a TableModel and one or more views of the 2-dimensional data. This model does not include any internal caching, and as such it will send a new request to the TableModel with every request for rows.


Nested Class Summary
 class TableController.ControllableTableCallback
          A callback that automatically updates a ControllableTable.
 
Constructor Summary
TableController(TableModel tableModel)
          Constructor.
 
Method Summary
 void addControllableTable(ControllableTable controllableTable)
          Add a new ControllableTable.
 int getNumRows()
           
 TableModel getTableModel()
           
 void insertRow(int beforeRow)
          Insert a row of data.
 void removeControllableTable(ControllableTable controllableTable)
          Remove a ControllableTable.
 void removeRow(int row)
          Remove a row of data and decrement all rows after the removed row.
 void setData(int row, int column, java.lang.Object data)
          Set data in the controller.
 void setNumRows(int numRows)
          Set the total number of rows.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableController

public TableController(TableModel tableModel)
Constructor.

Parameters:
tableModel - the underlying TableModel
Method Detail

addControllableTable

public void addControllableTable(ControllableTable controllableTable)
Add a new ControllableTable.

Parameters:
controllableTable - the ControllableTable widget to add

getNumRows

public int getNumRows()
Returns:
the number of rows, or -1 if unknown

getTableModel

public TableModel getTableModel()
Returns:
the underlying TableModel

insertRow

public void insertRow(int beforeRow)
Insert a row of data.

Parameters:
beforeRow - the row to insert

removeControllableTable

public void removeControllableTable(ControllableTable controllableTable)
Remove a ControllableTable.

Parameters:
controllableTable - the ControllableTable to remove

removeRow

public void removeRow(int row)
Remove a row of data and decrement all rows after the removed row.

Parameters:
row - the row to remove
Throws:
java.lang.IndexOutOfBoundsException

setData

public void setData(int row,
                    int column,
                    java.lang.Object data)
Set data in the controller.

Parameters:
row - the row index
column - the column index
data - the data to set

setNumRows

public void setNumRows(int numRows)
Set the total number of rows. Pass in -1 if the number of rows is not known.

Parameters:
numRows - the total number of rows