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

java.lang.Object
  extended by com.google.gwt.widgetideas.table.client.TableBulkRenderer
Direct Known Subclasses:
FlexTableBulkRenderer, GridBulkRenderer

public abstract class TableBulkRenderer
extends java.lang.Object

Enables bulk rendering of tables. Each subclass that needs special handling for bulk rendering should have its own bulk renderer.


Nested Class Summary
static class TableBulkRenderer.CellRenderer
          Controls how each cell is rendered.
protected  class TableBulkRenderer.RenderingOptions
          Convenience class used to specify rendering options for the table.
static class TableBulkRenderer.StringCellRenderer
          Controls how each cell is rendered.
 
Field Summary
static int MAX_TIME
          Maximum time allowable to create the table string.
static int ROWS_PER_TIME_CHECK
          How many rows should be processed before time is checked and the event loop is potentially flushed.
static int TIME_SLICE
          Time slice in milliseconds that the construction of the string can take before flushing the event cue.
 
Constructor Summary
TableBulkRenderer(HTMLTable table)
          Constructor for the bulk renderer.
TableBulkRenderer(HTMLTable table, TableBulkRenderer.CellRenderer renderer)
          Constructor for the bulk renderer.
 
Method Summary
 TableBulkRenderer.CellRenderer getCellRenderer()
          Gets the cell renderer.
protected  HTMLTable getTable()
           
 void renderRows(java.util.Iterator<java.util.Iterator<java.lang.Object>> rows, RendererCallback callback)
          Removes all rows in the current table replaces them with the roews supplied by the iterator.
protected  void renderRows(java.util.Iterator<java.util.Iterator<java.lang.Object>> rows, TableBulkRenderer.RenderingOptions options)
          Work horse protected rendering method.
 void renderRows(java.util.List<java.util.List<java.lang.Object>> rows, RendererCallback callback)
          Removes all rows in the current table replaces them with the list of rows provided.
 void renderRows(TableModel<?> tableModel, int startRow, int numRows, RendererCallback callback)
          Removes all rows in the current table replaces them with the rows supplied by the provided TableModel.
 void renderRows(TableModel<?> tableModel, RendererCallback callback)
          Removes all rows in the current table replaces them with the rows supplied by the provided TableModel.
protected  void renderRows(TableModel<?> tableModel, TableBulkRenderer.RenderingOptions options)
          Render rows using a table model.
 void setCellRenderer(TableBulkRenderer.CellRenderer renderer)
          Sets the cell renderer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIME_SLICE

public static int TIME_SLICE
Time slice in milliseconds that the construction of the string can take before flushing the event cue.


MAX_TIME

public static int MAX_TIME
Maximum time allowable to create the table string. Ever.


ROWS_PER_TIME_CHECK

public static int ROWS_PER_TIME_CHECK
How many rows should be processed before time is checked and the event loop is potentially flushed.

Constructor Detail

TableBulkRenderer

public TableBulkRenderer(HTMLTable table)
Constructor for the bulk renderer.

Parameters:
table - the table to be bulk rendered

TableBulkRenderer

public TableBulkRenderer(HTMLTable table,
                         TableBulkRenderer.CellRenderer renderer)
Constructor for the bulk renderer.

Parameters:
table - the table to be bulk rendered
renderer - the renderer that should be used during bulk rendering
Method Detail

getCellRenderer

public TableBulkRenderer.CellRenderer getCellRenderer()
Gets the cell renderer.

Returns:
the renderer

renderRows

public final void renderRows(java.util.Iterator<java.util.Iterator<java.lang.Object>> rows,
                             RendererCallback callback)
Removes all rows in the current table replaces them with the roews supplied by the iterator. Each element of the rows iterator is an Iterator which represents a single row.

Parameters:
rows - iterator of row iterators
callback - callback to be called after the rows are rendered

renderRows

public final void renderRows(java.util.List<java.util.List<java.lang.Object>> rows,
                             RendererCallback callback)
Removes all rows in the current table replaces them with the list of rows provided.

This method should only be used when the number of rows is known and of reasonable size, therefore this call is synchronous by default.

Parameters:
rows - list of rows. Each row itself must be another list
callback - callback to be called after the rows are rendered

renderRows

public final void renderRows(TableModel<?> tableModel,
                             int startRow,
                             int numRows,
                             RendererCallback callback)
Removes all rows in the current table replaces them with the rows supplied by the provided TableModel.

Parameters:
tableModel - the table data
startRow - the tableModel's start row index
numRows - the number of rows to request from the tableModel -1 indicates all of them *
callback - callback to call after the table is finished being rendered

renderRows

public final void renderRows(TableModel<?> tableModel,
                             RendererCallback callback)
Removes all rows in the current table replaces them with the rows supplied by the provided TableModel.

Parameters:
tableModel - the table model
callback - callback to call after the table is finished being rendered

setCellRenderer

public void setCellRenderer(TableBulkRenderer.CellRenderer renderer)
Sets the cell renderer.

Parameters:
renderer - the renderer to set

getTable

protected HTMLTable getTable()

renderRows

protected void renderRows(java.util.Iterator<java.util.Iterator<java.lang.Object>> rows,
                          TableBulkRenderer.RenderingOptions options)
Work horse protected rendering method.

Parameters:
rows - Iterator of row iterators
options - rendering options for this table

renderRows

protected final void renderRows(TableModel<?> tableModel,
                                TableBulkRenderer.RenderingOptions options)
Render rows using a table model.

Parameters:
tableModel - table model
options - options