C
- the type that this Cell representspublic class ActionCell<C> extends AbstractCell<C>
Modifier and Type | Class and Description |
---|---|
static interface |
ActionCell.Delegate<T>
The delegate that will handle events from the cell.
|
Cell.Context
Constructor and Description |
---|
ActionCell(SafeHtml message,
ActionCell.Delegate<C> delegate)
Construct a new
ActionCell . |
ActionCell(java.lang.String text,
ActionCell.Delegate<C> delegate)
Construct a new
ActionCell with a text String that does not contain
HTML markup. |
Modifier and Type | Method and Description |
---|---|
void |
onBrowserEvent(Cell.Context context,
Element parent,
C value,
NativeEvent event,
ValueUpdater<C> valueUpdater)
Handle a browser event that took place within the cell.
|
protected void |
onEnterKeyDown(Cell.Context context,
Element parent,
C value,
NativeEvent event,
ValueUpdater<C> valueUpdater)
Called when the user triggers a
keydown event with the ENTER
key while focused on the cell. |
void |
render(Cell.Context context,
C value,
SafeHtmlBuilder sb)
Render a cell as HTML into a
SafeHtmlBuilder , suitable for passing
to Element.setInnerHTML(String) on a container element. |
dependsOnSelection, getConsumedEvents, handlesSelection, isEditing, resetFocus, setValue
public ActionCell(SafeHtml message, ActionCell.Delegate<C> delegate)
ActionCell
.message
- the message to display on the buttondelegate
- the delegate that will handle eventspublic ActionCell(java.lang.String text, ActionCell.Delegate<C> delegate)
ActionCell
with a text String that does not contain
HTML markup.text
- the text to display on the buttondelegate
- the delegate that will handle eventspublic void onBrowserEvent(Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater)
AbstractCell
If you override this method to add support for events, remember to pass the event types that the cell expects into the constructor.
onBrowserEvent
in interface Cell<C>
onBrowserEvent
in class AbstractCell<C>
context
- the Cell.Context
of the cellparent
- the parent Elementvalue
- the value associated with the cellevent
- the native browser eventvalueUpdater
- a ValueUpdater
, or null if not specifiedpublic void render(Cell.Context context, C value, SafeHtmlBuilder sb)
Cell
SafeHtmlBuilder
, suitable for passing
to Element.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.
render
in interface Cell<C>
render
in class AbstractCell<C>
context
- the Cell.Context
of the cellvalue
- the cell value to be renderedsb
- the SafeHtmlBuilder
to be written toprotected void onEnterKeyDown(Cell.Context context, Element parent, C value, NativeEvent event, ValueUpdater<C> valueUpdater)
AbstractCell
keydown
event with the ENTER
key while focused on the cell. If your cell interacts with the user, you
should override this method to provide a consistent user experience. Your
widget must consume keydown
events for this method to be
called.onEnterKeyDown
in class AbstractCell<C>
context
- the Context
of the cellparent
- the parent Elementvalue
- the value associated with the cellevent
- the native browser eventvalueUpdater
- a ValueUpdater
, or null if not specified