com.google.gwt.user.cellview.client
Class Column<T,C>

java.lang.Object
  extended by com.google.gwt.user.cellview.client.Column<T,C>
Type Parameters:
T - the row type
C - the column type
All Implemented Interfaces:
HasCell<T,C>, HasViewData
Direct Known Subclasses:
IdentityColumn, TextColumn

public abstract class Column<T,C>
extends java.lang.Object
implements HasViewData, HasCell<T,C>

A representation of a column in a table. The column may maintain view data for each cell on demand. New view data, if needed, is created by the cell's onBrowserEvent method, stored in the Column, and passed to future calls to Cell's Cell.onBrowserEvent(com.google.gwt.dom.client.Element, C, java.lang.Object, com.google.gwt.dom.client.NativeEvent, com.google.gwt.cell.client.ValueUpdater) and @link{Cell#render} methods.


Constructor Summary
Column(Cell<C> cell)
           
 
Method Summary
 boolean consumesEvents()
           
 boolean dependsOnSelection()
          Returns true if the contents of the column may depend on the current state of the selection model associated with the table that is displaying this column.
 Cell<C> getCell()
          Returns the Cell of type C.
 FieldUpdater<T,C> getFieldUpdater()
          Returns the FieldUpdater instance.
abstract  C getValue(T object)
          Returns the value of type C extracted from the record of type T.
 java.lang.Object getViewData(java.lang.Object key)
          Gets the view data associated with the given item.
 void onBrowserEvent(Element elem, int index, T object, NativeEvent event, ProvidesKey<T> providesKey)
           
 void render(T object, ProvidesKey<T> keyProvider, java.lang.StringBuilder sb)
          Render the object into the cell.
 void setFieldUpdater(FieldUpdater<T,C> fieldUpdater)
           
 void setViewData(java.lang.Object key, java.lang.Object viewData)
          Sets the view data associated with the given item.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Column

public Column(Cell<C> cell)
Method Detail

consumesEvents

public boolean consumesEvents()

dependsOnSelection

public boolean dependsOnSelection()
Returns true if the contents of the column may depend on the current state of the selection model associated with the table that is displaying this column. The default implementation returns false.


getCell

public Cell<C> getCell()
Description copied from interface: HasCell
Returns the Cell of type C.

Specified by:
getCell in interface HasCell<T,C>

getFieldUpdater

public FieldUpdater<T,C> getFieldUpdater()
Description copied from interface: HasCell
Returns the FieldUpdater instance.

Specified by:
getFieldUpdater in interface HasCell<T,C>
Returns:
an instance of FieldUpdater

getValue

public abstract C getValue(T object)
Description copied from interface: HasCell
Returns the value of type C extracted from the record of type T.

Specified by:
getValue in interface HasCell<T,C>
Parameters:
object - a record of type T
Returns:
a value of type C suitable for passing to the cell

getViewData

public java.lang.Object getViewData(java.lang.Object key)
Description copied from interface: HasViewData
Gets the view data associated with the given item.

Specified by:
getViewData in interface HasViewData
Parameters:
key - the key of the item whose view data is desired
Returns:
the view data

onBrowserEvent

public void onBrowserEvent(Element elem,
                           int index,
                           T object,
                           NativeEvent event,
                           ProvidesKey<T> providesKey)
Parameters:
providesKey - an instance of ProvidesKey, or null if the record object should act as its own key.

render

public void render(T object,
                   ProvidesKey<T> keyProvider,
                   java.lang.StringBuilder sb)
Render the object into the cell.

Parameters:
object - the object to render
keyProvider - the ProvidesKey for the object
sb - the buffer to render into

setFieldUpdater

public void setFieldUpdater(FieldUpdater<T,C> fieldUpdater)

setViewData

public void setViewData(java.lang.Object key,
                        java.lang.Object viewData)
Description copied from interface: HasViewData
Sets the view data associated with the given item.

Specified by:
setViewData in interface HasViewData
Parameters:
key - the key of the item whose view data will be set
viewData - the view data