public class

CompositeCell

extends AbstractCell<C>
java.lang.Object
   ↳ com.google.gwt.cell.client.AbstractCell<C>
     ↳ com.google.gwt.cell.client.CompositeCell<C>

Class Overview

A Cell that is composed of other Cells.

When this cell is rendered, it will render each component Cell inside a span. If the component Cell uses block level elements (such as a Div), the component cells will stack vertically.

Summary

Public Constructors
CompositeCell(List<HasCell<C, ?>> hasCells)
Construct a new CompositeCell.
Public Methods
boolean dependsOnSelection()
Check if this cell depends on the selection state.
Set<String> getConsumedEvents()
Get the set of events that this cell consumes.
boolean handlesSelection()
Check if this cell handles selection.
void onBrowserEvent(Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater)
Handle a browser event that took place within the cell.

If you override this method to add support for events, remember to pass the event types that the cell expects into the constructor.

void render(Cell.Context context, C value, SafeHtmlBuilder sb)
Render a cell as HTML into a SafeHtmlBuilder, suitable for passing to setInnerHTML(String) on a container element.
boolean resetFocus(Cell.Context context, Element parent, C value)
Reset focus on the Cell.

This method is a no-op and returns false.

void setValue(Cell.Context context, Element parent, C object)
This method may be used by cell containers to set the value on a single cell directly, rather than using setInnerHTML(String).
Protected Methods
Element getContainerElement(Element parent)
Get the element that acts as the container for all children.
<X> void render(Cell.Context context, C value, SafeHtmlBuilder sb, HasCell<C, X> hasCell)
Render the composite cell as HTML into a SafeHtmlBuilder, suitable for passing to setInnerHTML(String) on a container element.
[Expand]
Inherited Methods
From class com.google.gwt.cell.client.AbstractCell
From class java.lang.Object
From interface com.google.gwt.cell.client.Cell

Public Constructors

public CompositeCell (List<HasCell<C, ?>> hasCells)

Construct a new CompositeCell.

Parameters
hasCells the cells that makeup the composite

Public Methods

public boolean dependsOnSelection ()

Check if this cell depends on the selection state.

Returns
  • true if dependent on selection, false if not

public Set<String> getConsumedEvents ()

Get the set of events that this cell consumes. The container that uses this cell should only pass these events to when the event occurs.

The returned value should not be modified, and may be an unmodifiable set. Changes to the return value may not be reflected in the cell.

Returns
  • the consumed events, or null if no events are consumed

public boolean handlesSelection ()

Check if this cell handles selection. If the cell handles selection, then its container should not automatically handle selection.

Returns
  • true if the cell handles selection, false if not

public void onBrowserEvent (Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater)

Handle a browser event that took place within the cell. The default implementation returns null.

If you override this method to add support for events, remember to pass the event types that the cell expects into the constructor.

Parameters
context the Context of the cell
parent the parent Element
value the value associated with the cell
event the native browser event
valueUpdater a ValueUpdater, or null if not specified

public void render (Cell.Context context, C value, SafeHtmlBuilder sb)

Render a cell as HTML into a SafeHtmlBuilder, suitable for passing to setInnerHTML(String) on a container element.

Note: If your cell contains natively focusable elements, such as buttons or input elements, be sure to set the tabIndex to -1 so that they do not steal focus away from the containing widget.

Parameters
context the Context of the cell
value the cell value to be rendered
sb the SafeHtmlBuilder to be written to

public boolean resetFocus (Cell.Context context, Element parent, C value)

Reset focus on the Cell. This method is called if the cell has focus when it is refreshed.

This method is a no-op and returns false. If your cell is editable or can be focused by the user, override this method to reset focus when the containing widget is refreshed.

Parameters
context the Context of the cell
parent the parent Element
value the value associated with the cell
Returns
  • true if focus is taken, false if not

public void setValue (Cell.Context context, Element parent, C object)

This method may be used by cell containers to set the value on a single cell directly, rather than using setInnerHTML(String). See AbstractCell#setValue(Context) for a default implementation that uses .

Parameters
context the Context of the cell
parent the parent Element
object the value associated with the cell

Protected Methods

protected Element getContainerElement (Element parent)

Get the element that acts as the container for all children. If children are added directly to the parent, the parent is the container. If children are added in a table row, the row is the parent.

Parameters
parent the parent element of the cell
Returns
  • the container element

protected void render (Cell.Context context, C value, SafeHtmlBuilder sb, HasCell<C, X> hasCell)

Render the composite cell as HTML into a SafeHtmlBuilder, suitable for passing to setInnerHTML(String) on a container element.

Note: If your cell contains natively focusable elements, such as buttons or input elements, be sure to set the tabIndex to -1 so that they do not steal focus away from the containing widget.

Parameters
context the Context of the cell
value the cell value to be rendered
sb the SafeHtmlBuilder to be written to
hasCell a HasCell instance containing the cells to be rendered within this cell