|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.widgetideas.table.client.TableController
com.google.gwt.widgetideas.table.client.CachedTableController
public class CachedTableController
A controller that interfaces between a TableModel
and mutliple views
of the data. This controller has its own cache so subsequent requests for the
same data will not require another TableModel
request.
The CachedTableController supports caching rows of data before they are needed, allowing listeners to request data much more quickly. When another class requests data, the CachedTableController will feed data from its cache if available, and then it will request unavailable data from your specific implementation.
The pre cache and post cache refers to the number of rows to request in addition to the actual request. Pre cache refers to rows before the request, and post cache refers to rows after the request. For example, in applications where you expect the user to move forward quickly, you would want a large post cache.
The size of your cache depends on the implementation and usage of your view
component. If you are using a view that supports paging, such as the
PagingGrid
, you should set your cache to a multiple of the page size
so the user can go to the next and previous pages quickly.
This cache controller has some significant limitations. Row values are not cached for performance reasons and are not passed to the Controlled Tables, even on new requests to the model. You need to set them manually or keep track of them separately if they are important to you.
Additionally, the cache is cleared every time the sort order changes. However, if you disallow column sorting or expect that the user will not sort the columns repeatedly, the cache will still improve paging performance.
Nested Class Summary | |
---|---|
class |
CachedTableController.CacheCallback
A callback that automatically updates a ControllableTable . |
Nested classes/interfaces inherited from class com.google.gwt.widgetideas.table.client.TableController |
---|
TableController.ControllableTableCallback |
Constructor Summary | |
---|---|
CachedTableController(TableModel tableModel)
Constructor. |
Method Summary | |
---|---|
java.lang.Object |
getData(int row,
int column)
Get data from the cache. |
int |
getNumPostCachedRows()
|
int |
getNumPreCachedRows()
|
void |
insertRow(int beforeRow)
Insert a row of data. |
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 |
setNumPostCachedRows(int postCacheRows)
Set the number of rows to cache after the visible data area. |
void |
setNumPreCachedRows(int preCacheRows)
Set the number of rows to cache before the visible data area. |
Methods inherited from class com.google.gwt.widgetideas.table.client.TableController |
---|
addControllableTable, getNumRows, getTableModel, removeControllableTable, setNumRows |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CachedTableController(TableModel tableModel)
tableModel
- the underlying TableModel
Method Detail |
---|
public java.lang.Object getData(int row, int column)
row
- the row indexcolumn
- the column index
public int getNumPostCachedRows()
public int getNumPreCachedRows()
public void insertRow(int beforeRow)
TableController
insertRow
in class TableController
beforeRow
- the row to insertTableController
public void removeRow(int row)
TableController
removeRow
in class TableController
row
- the row to removeTableController
public void setData(int row, int column, java.lang.Object data)
TableController
setData
in class TableController
row
- the row indexcolumn
- the column indexdata
- the data to setTableController
public void setNumPostCachedRows(int postCacheRows)
postCacheRows
- the number of rows to post cachepublic void setNumPreCachedRows(int preCacheRows)
preCacheRows
- the number of rows to pre cache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |