C
- the type that this Cell representspublic class ButtonCellBase<C> extends AbstractCell<C> implements IsCollapsible, HasEnabled
Modifier and Type | Class and Description |
---|---|
static interface |
ButtonCellBase.Appearance<C>
The appearance used to render this Cell.
|
static class |
ButtonCellBase.Decoration
The decoration applied to the button.
|
static class |
ButtonCellBase.DefaultAppearance<C>
The default implementation of the
ButtonCellBase.Appearance . |
Cell.Context
Constructor and Description |
---|
ButtonCellBase(ButtonCellBase.Appearance<C> appearance)
Construct a new
ButtonCellBase using the specified
ButtonCellBase.Appearance to render the contents. |
Modifier and Type | Method and Description |
---|---|
char |
getAccessKey()
Get the access key.
|
ButtonCellBase.Decoration |
getDecoration()
Get the decoration style of the button.
|
ImageResource |
getIcon()
Get the icon displayed next to the button text.
|
int |
getTabIndex()
Return the tab index that is given to all rendered cells.
|
boolean |
isCollapseLeft()
Check whether or not the left-side of the UI component is collapsed
(sharing border with the component to its left).
|
boolean |
isCollapseRight()
right Check whether or not the left-side of the UI component is collapsed
(sharing border with the component to its left).
|
boolean |
isEnabled()
Returns true if the widget is enabled, false if not.
|
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. |
void |
setAccessKey(char key)
Sets the cell's 'access key'.
|
void |
setCollapseLeft(boolean isCollapsed)
Sets whether the left-side of the UI component is collapsed (sharing border
with the component to its left).
|
void |
setCollapseRight(boolean isCollapsed)
Sets whether the right-side of the UI component is collapsed (sharing
border with the component to its right).
|
void |
setDecoration(ButtonCellBase.Decoration decoration)
Set the
ButtonCellBase.Decoration of the button. |
void |
setEnabled(boolean isEnabled)
Sets whether this widget is enabled.
|
void |
setFocus(Element parent,
boolean focused)
Explicitly focus/unfocus this cell.
|
void |
setIcon(ImageResource icon)
Set the icon to display next to the button text.
|
void |
setTabIndex(int tabIndex)
Set the tab index to apply to the button.
|
dependsOnSelection, getConsumedEvents, handlesSelection, isEditing, resetFocus, setValue
public ButtonCellBase(ButtonCellBase.Appearance<C> appearance)
ButtonCellBase
using the specified
ButtonCellBase.Appearance
to render the contents.appearance
- the appearance of the cellpublic char getAccessKey()
public ButtonCellBase.Decoration getDecoration()
public ImageResource getIcon()
public int getTabIndex()
public boolean isCollapseLeft()
IsCollapsible
isCollapseLeft
in interface IsCollapsible
public boolean isCollapseRight()
IsCollapsible
isCollapseRight
in interface IsCollapsible
public boolean isEnabled()
HasEnabled
isEnabled
in interface HasEnabled
public 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 topublic void setAccessKey(char key)
The change takes effect the next time the Cell is rendered.
key
- the cell's access keypublic void setCollapseLeft(boolean isCollapsed)
The change takes effect the next time the Cell is rendered.
setCollapseLeft
in interface IsCollapsible
isCollapsed
- true if collapsed, false if notpublic void setCollapseRight(boolean isCollapsed)
The change takes effect the next time the Cell is rendered.
setCollapseRight
in interface IsCollapsible
isCollapsed
- true if collapsed, false if notpublic void setDecoration(ButtonCellBase.Decoration decoration)
ButtonCellBase.Decoration
of the button.
This change takes effect the next time the cell is rendered.
decoration
- the button decorationpublic void setEnabled(boolean isEnabled)
The change takes effect the next time the Cell is rendered.
setEnabled
in interface HasEnabled
isEnabled
- true
to enable the widget, false
to disable itpublic void setFocus(Element parent, boolean focused)
parent
- the parent elementfocused
- whether this cell should take focus or release itpublic void setIcon(ImageResource icon)
icon
- the icon resource, or null not to show an iconpublic void setTabIndex(int tabIndex)
tabIndex
- the tab indexprotected 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 specifiedCopyright © 2018. All rights reserved.