com.google.gwt.cell.client
Interface Cell<C>

Type Parameters:
C - the type that this Cell represents
All Known Implementing Classes:
AbstractCell, ActionCell, ButtonCell, CheckboxCell, ClickableTextCell, CompositeCell, DateCell, DatePickerCell, EditTextCell, IconCellDecorator, NumberCell, SelectionCell, TextCell, TextInputCell

public interface Cell<C>

A light weight representation of a renderable object.

Note: This class is new and its interface subject to change.


Method Summary
 boolean consumesEvents()
          Returns true if the cell is interested in browser events.
 boolean dependsOnSelection()
          Check if this cell depends on the selection state.
 java.lang.Object onBrowserEvent(Element parent, C value, java.lang.Object viewData, NativeEvent event, ValueUpdater<C> valueUpdater)
          Handle a browser event that took place within the cell.
 void render(C value, java.lang.Object viewData, java.lang.StringBuilder sb)
          Render a cell as HTML into a StringBuilder, suitable for passing to Element.setInnerHTML(java.lang.String) on a container element.
 void setValue(Element parent, C value, java.lang.Object viewData)
          This method may be used by cell containers to set the value on a single cell directly, rather than using Element.setInnerHTML(String).
 

Method Detail

consumesEvents

boolean consumesEvents()
Returns true if the cell is interested in browser events. The default implementation returns false.


dependsOnSelection

boolean dependsOnSelection()
Check if this cell depends on the selection state.

Returns:
true if dependant on selection, false if not

onBrowserEvent

java.lang.Object onBrowserEvent(Element parent,
                                C value,
                                java.lang.Object viewData,
                                NativeEvent event,
                                ValueUpdater<C> valueUpdater)
Handle a browser event that took place within the cell. The default implementation returns null.

Parameters:
parent - the parent Element
value - the value associated with the cell
viewData - the view data associated with the cell, or null
event - the native browser event
valueUpdater - a ValueUpdater, or null
Returns:
a view data object which may be the one passed in or a new object

render

void render(C value,
            java.lang.Object viewData,
            java.lang.StringBuilder sb)
Render a cell as HTML into a StringBuilder, suitable for passing to Element.setInnerHTML(java.lang.String) on a container element.

Parameters:
value - the cell value to be rendered
viewData - view data associated with the cell
sb - the StringBuilder to be written to

setValue

void setValue(Element parent,
              C value,
              java.lang.Object viewData)
This method may be used by cell containers to set the value on a single cell directly, rather than using Element.setInnerHTML(String). See AbstractCell.setValue(Element, Object, Object) for a default implementation that uses render(Object, Object, StringBuilder).

Parameters:
parent - the parent Element
value - the value associated with the cell
viewData - the view data associated with the cell, or null