Class CompositeCell<C>
- java.lang.Object
-
- com.google.gwt.cell.client.AbstractCell<C>
-
- com.google.gwt.cell.client.CompositeCell<C>
-
- Type Parameters:
C
- the type that this Cell represents
- All Implemented Interfaces:
Cell<C>
public class CompositeCell<C> extends AbstractCell<C>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.gwt.cell.client.Cell
Cell.Context
-
-
Constructor Summary
Constructors Constructor Description CompositeCell(java.util.List<HasCell<C,?>> hasCells)
Construct a newCompositeCell
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
dependsOnSelection()
Check if this cell depends on the selection state.java.util.Set<java.lang.String>
getConsumedEvents()
Get the set of events that this cell consumes (seeBrowserEvents
for useful constants).protected Element
getContainerElement(Element parent)
Get the element that acts as the container for all children.java.util.List<HasCell<C,?>>
getHasCells()
Returns the readonly list ofHasCell
's that make up this composite.boolean
handlesSelection()
Check if this cell handles selection.boolean
isEditing(Cell.Context context, Element parent, C value)
Returns false.void
onBrowserEvent(Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater)
Handle a browser event that took place within the cell.void
render(Cell.Context context, C value, SafeHtmlBuilder sb)
Render a cell as HTML into aSafeHtmlBuilder
, suitable for passing toElement.setInnerHTML(String)
on a container element.protected <X> void
render(Cell.Context context, C value, SafeHtmlBuilder sb, HasCell<C,X> hasCell)
Render the composite cell as HTML into aSafeHtmlBuilder
, suitable for passing toElement.setInnerHTML(java.lang.String)
on a container element.boolean
resetFocus(Cell.Context context, Element parent, C value)
Reset focus on the Cell.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 usingElement.setInnerHTML(String)
.-
Methods inherited from class com.google.gwt.cell.client.AbstractCell
onEnterKeyDown
-
-
-
-
Constructor Detail
-
CompositeCell
public CompositeCell(java.util.List<HasCell<C,?>> hasCells)
Construct a newCompositeCell
.- Parameters:
hasCells
- the cells that makeup the composite
-
-
Method Detail
-
dependsOnSelection
public boolean dependsOnSelection()
Description copied from interface:Cell
Check if this cell depends on the selection state.- Specified by:
dependsOnSelection
in interfaceCell<C>
- Overrides:
dependsOnSelection
in classAbstractCell<C>
- Returns:
- true if dependent on selection, false if not
-
getConsumedEvents
public java.util.Set<java.lang.String> getConsumedEvents()
Description copied from interface:Cell
Get the set of events that this cell consumes (seeBrowserEvents
for useful constants). The container that uses this cell should only pass these events toCell.onBrowserEvent(Context, Element, Object, NativeEvent, ValueUpdater)
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.
- Specified by:
getConsumedEvents
in interfaceCell<C>
- Overrides:
getConsumedEvents
in classAbstractCell<C>
- Returns:
- the consumed events, or null if no events are consumed
- See Also:
BrowserEvents
-
handlesSelection
public boolean handlesSelection()
Description copied from interface:Cell
Check if this cell handles selection. If the cell handles selection, then its container should not automatically handle selection.- Specified by:
handlesSelection
in interfaceCell<C>
- Overrides:
handlesSelection
in classAbstractCell<C>
- Returns:
- true if the cell handles selection, false if not
-
isEditing
public boolean isEditing(Cell.Context context, Element parent, C value)
Description copied from class:AbstractCell
Returns false. Subclasses that support editing should override this method to return the current editing status.- Specified by:
isEditing
in interfaceCell<C>
- Overrides:
isEditing
in classAbstractCell<C>
- Parameters:
context
- theCell.Context
of the cellparent
- the parent Elementvalue
- the value associated with the cell- Returns:
- true if the cell is in edit mode
-
onBrowserEvent
public void onBrowserEvent(Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater)
Description copied from class:AbstractCell
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.
- Specified by:
onBrowserEvent
in interfaceCell<C>
- Overrides:
onBrowserEvent
in classAbstractCell<C>
- Parameters:
context
- theCell.Context
of the cellparent
- the parent Elementvalue
- the value associated with the cellevent
- the native browser eventvalueUpdater
- aValueUpdater
, or null if not specified
-
render
public void render(Cell.Context context, C value, SafeHtmlBuilder sb)
Description copied from interface:Cell
Render a cell as HTML into aSafeHtmlBuilder
, suitable for passing toElement.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.
- Specified by:
render
in interfaceCell<C>
- Specified by:
render
in classAbstractCell<C>
- Parameters:
context
- theCell.Context
of the cellvalue
- the cell value to be renderedsb
- theSafeHtmlBuilder
to be written to
-
resetFocus
public boolean resetFocus(Cell.Context context, Element parent, C value)
Description copied from class:AbstractCell
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.
- Specified by:
resetFocus
in interfaceCell<C>
- Overrides:
resetFocus
in classAbstractCell<C>
- Parameters:
context
- theCell.Context
of the cellparent
- the parent Elementvalue
- the value associated with the cell- Returns:
- true if focus is taken, false if not
-
setValue
public void setValue(Cell.Context context, Element parent, C object)
Description copied from interface:Cell
This method may be used by cell containers to set the value on a single cell directly, rather than usingElement.setInnerHTML(String)
. SeeAbstractCell.setValue(Context, Element, Object)
for a default implementation that usesCell.render(Context, Object, SafeHtmlBuilder)
.- Specified by:
setValue
in interfaceCell<C>
- Overrides:
setValue
in classAbstractCell<C>
- Parameters:
context
- theCell.Context
of the cellparent
- the parent Elementobject
- the value associated with the cell
-
getHasCells
public java.util.List<HasCell<C,?>> getHasCells()
Returns the readonly list ofHasCell
's that make up this composite.
-
getContainerElement
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
-
render
protected <X> void render(Cell.Context context, C value, SafeHtmlBuilder sb, HasCell<C,X> hasCell)
Render the composite cell as HTML into aSafeHtmlBuilder
, suitable for passing toElement.setInnerHTML(java.lang.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
- theContext
of the cellvalue
- the cell value to be renderedsb
- theSafeHtmlBuilder
to be written tohasCell
- aHasCell
instance containing the cells to be rendered within this cell
-
-