com.google.gwt.widget.client

## Class ButtonBase<C>

- java.lang.Object
- - com.google.gwt.user.client.ui.UIObject
  - - com.google.gwt.user.client.ui.Widget
    - - com.google.gwt.user.cellview.client.CellWidget<C>
      - - com.google.gwt.widget.client.ButtonBase<C>

- Type Parameters:
    `C` - the data type of the button's contents
  All Implemented Interfaces:
    IsCollapsible, IsEditor<LeafValueEditor<C>>, HasAllFocusHandlers, HasAllKeyHandlers, HasBlurHandlers, HasClickHandlers, HasFocusHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasMouseDownHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasAttachHandlers, HasValueChangeHandlers<C>, HasHandlers, EventListener, TakesValue<C>, Focusable, HasEnabled, HasValue<C>, HasVisibility, IsWidget, HasKeyProvider<C>
  Direct Known Subclasses:
    TextButton

      public class ButtonBase<C>
      extends CellWidget<C>
      implements HasEnabled, Focusable, IsCollapsible, HasAllFocusHandlers, HasMouseDownHandlers, HasMouseUpHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasClickHandlers, HasAllKeyHandlers

  Base class for buttons that supports content decoration.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

      `UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

  - ### Field Summary

    - ### Fields inherited from class com.google.gwt.user.client.ui.UIObject

      `DEBUG_ID_PREFIX`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ButtonBase(ButtonCellBase<C> cell)` Construct a new `ButtonBase` with the specified cell and an initial value of `null`.
    `protected` | `ButtonBase(ButtonCellBase<C> cell, C initialValue)` Construct a new `ButtonBase` with the specified cell and initial value.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HandlerRegistration` | `addBlurHandler(BlurHandler handler)` Adds a `BlurEvent` handler.
    `HandlerRegistration` | `addClickHandler(ClickHandler handler)` Adds a `ClickEvent` handler.
    `HandlerRegistration` | `addFocusHandler(FocusHandler handler)` Adds a `FocusEvent` handler.
    `HandlerRegistration` | `addKeyDownHandler(KeyDownHandler handler)` Adds a `KeyDownEvent` handler.
    `HandlerRegistration` | `addKeyPressHandler(KeyPressHandler handler)` Adds a `KeyPressEvent` handler.
    `HandlerRegistration` | `addKeyUpHandler(KeyUpHandler handler)` Adds a `KeyUpEvent` handler.
    `HandlerRegistration` | `addMouseDownHandler(MouseDownHandler handler)` Adds a `MouseDownEvent` handler.
    `HandlerRegistration` | `addMouseOutHandler(MouseOutHandler handler)` Adds a `MouseOutEvent` handler.
    `HandlerRegistration` | `addMouseOverHandler(MouseOverHandler handler)` Adds a `MouseOverEvent` handler.
    `HandlerRegistration` | `addMouseUpHandler(MouseUpHandler handler)` Adds a `MouseUpEvent` handler.
    `ButtonCellBase.Decoration` | `getDecoration()` Get the decoration style of the button.
    `int` | `getTabIndex()` Gets the widget's position in the tab index.
    `(package private) static <C extends ButtonCellBase<?>> C` | `initializeCell(C cell)` Initialize the tab index of the cell and return it.
    `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` | `setAccessKey(char key)` Sets the widget'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 enabled)` Sets whether this widget is enabled.
    `void` | `setFocus(boolean focused)` Explicitly focus/unfocus this widget.
    `void` | `setTabIndex(int index)` Sets the widget's position in the tab index.

    - ### Methods inherited from class com.google.gwt.user.cellview.client.CellWidget

      `addValueChangeHandler, asEditor, getCell, getKeyProvider, getValue, onBrowserEvent, redraw, setValue, setValue, setValue`

    - ### Methods inherited from class com.google.gwt.user.client.ui.Widget

      `addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents`

    - ### Methods inherited from class com.google.gwt.user.client.ui.UIObject

      `addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

      `fireEvent`

- - ### Constructor Detail

    - #### ButtonBase

          protected ButtonBase(ButtonCellBase<C> cell)

      Construct a new `ButtonBase` with the specified cell and an initial value of `null`.
      Parameters:
        `cell` - the cell to wrap

    - #### ButtonBase

          protected ButtonBase(ButtonCellBase<C> cell,
                    C initialValue)

      Construct a new `ButtonBase` with the specified cell and initial value.
      Parameters:
        `cell` - the cell to wrap
        `initialValue` - the initial value of the Cell

  - ### Method Detail

    - #### initializeCell

          static <C extends ButtonCellBase<?>> C initializeCell(C cell)

      Initialize the tab index of the cell and return it. This is needed so we can modify the cell before calling the super constructor.
      Type Parameters:
        `C` - the cell type
      Parameters:
        `cell` - the cell

    - #### addBlurHandler

          public HandlerRegistration addBlurHandler(BlurHandler handler)

      Description copied from interface: `HasBlurHandlers`
      Adds a `BlurEvent` handler.
      Specified by:
        `addBlurHandler` in interface `HasBlurHandlers`
      Parameters:
        `handler` - the blur handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addClickHandler

          public HandlerRegistration addClickHandler(ClickHandler handler)

      Description copied from interface: `HasClickHandlers`
      Adds a `ClickEvent` handler.
      Specified by:
        `addClickHandler` in interface `HasClickHandlers`
      Parameters:
        `handler` - the click handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addFocusHandler

          public HandlerRegistration addFocusHandler(FocusHandler handler)

      Description copied from interface: `HasFocusHandlers`
      Adds a `FocusEvent` handler.
      Specified by:
        `addFocusHandler` in interface `HasFocusHandlers`
      Parameters:
        `handler` - the focus handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addKeyDownHandler

          public HandlerRegistration addKeyDownHandler(KeyDownHandler handler)

      Description copied from interface: `HasKeyDownHandlers`
      Adds a `KeyDownEvent` handler.
      Specified by:
        `addKeyDownHandler` in interface `HasKeyDownHandlers`
      Parameters:
        `handler` - the key down handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addKeyPressHandler

          public HandlerRegistration addKeyPressHandler(KeyPressHandler handler)

      Description copied from interface: `HasKeyPressHandlers`
      Adds a `KeyPressEvent` handler.
      Specified by:
        `addKeyPressHandler` in interface `HasKeyPressHandlers`
      Parameters:
        `handler` - the key press handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addKeyUpHandler

          public HandlerRegistration addKeyUpHandler(KeyUpHandler handler)

      Description copied from interface: `HasKeyUpHandlers`
      Adds a `KeyUpEvent` handler.
      Specified by:
        `addKeyUpHandler` in interface `HasKeyUpHandlers`
      Parameters:
        `handler` - the key up handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addMouseDownHandler

          public HandlerRegistration addMouseDownHandler(MouseDownHandler handler)

      Description copied from interface: `HasMouseDownHandlers`
      Adds a `MouseDownEvent` handler.
      Specified by:
        `addMouseDownHandler` in interface `HasMouseDownHandlers`
      Parameters:
        `handler` - the mouse down handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addMouseOutHandler

          public HandlerRegistration addMouseOutHandler(MouseOutHandler handler)

      Description copied from interface: `HasMouseOutHandlers`
      Adds a `MouseOutEvent` handler.
      Specified by:
        `addMouseOutHandler` in interface `HasMouseOutHandlers`
      Parameters:
        `handler` - the mouse out handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addMouseOverHandler

          public HandlerRegistration addMouseOverHandler(MouseOverHandler handler)

      Description copied from interface: `HasMouseOverHandlers`
      Adds a `MouseOverEvent` handler.
      Specified by:
        `addMouseOverHandler` in interface `HasMouseOverHandlers`
      Parameters:
        `handler` - the mouse over handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addMouseUpHandler

          public HandlerRegistration addMouseUpHandler(MouseUpHandler handler)

      Description copied from interface: `HasMouseUpHandlers`
      Adds a `MouseUpEvent` handler.
      Specified by:
        `addMouseUpHandler` in interface `HasMouseUpHandlers`
      Parameters:
        `handler` - the mouse up handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### getDecoration

          public ButtonCellBase.Decoration getDecoration()

      Get the decoration style of the button.

    - #### getTabIndex

          public int getTabIndex()

      Description copied from interface: `Focusable`
      Gets the widget's position in the tab index.
      Specified by:
        `getTabIndex` in interface `Focusable`
      Returns:
        the widget's tab index

    - #### isCollapseLeft

          public boolean isCollapseLeft()

      Description copied from interface: `IsCollapsible`
      Check whether or not the left-side of the UI component is collapsed (sharing border with the component to its left).
      Specified by:
        `isCollapseLeft` in interface `IsCollapsible`
      Returns:
        true if collapsed, false if not

    - #### isCollapseRight

          public boolean isCollapseRight()

      Description copied from interface: `IsCollapsible`
      right Check whether or not the left-side of the UI component is collapsed (sharing border with the component to its left).
      Specified by:
        `isCollapseRight` in interface `IsCollapsible`
      Returns:
        true if collapsed, false if not

    - #### isEnabled

          public boolean isEnabled()

      Description copied from interface: `HasEnabled`
      Returns true if the widget is enabled, false if not.
      Specified by:
        `isEnabled` in interface `HasEnabled`

    - #### setAccessKey

          public void setAccessKey(char key)

      Description copied from interface: `Focusable`
      Sets the widget's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.
      Specified by:
        `setAccessKey` in interface `Focusable`
      Parameters:
        `key` - the widget's access key

    - #### setCollapseLeft

          public void setCollapseLeft(boolean isCollapsed)

      Description copied from interface: `IsCollapsible`
      Sets whether the left-side of the UI component is collapsed (sharing border with the component to its left).
      Specified by:
        `setCollapseLeft` in interface `IsCollapsible`
      Parameters:
        `isCollapsed` - true if collapsed, false if not

    - #### setCollapseRight

          public void setCollapseRight(boolean isCollapsed)

      Description copied from interface: `IsCollapsible`
      Sets whether the right-side of the UI component is collapsed (sharing border with the component to its right).
      Specified by:
        `setCollapseRight` in interface `IsCollapsible`
      Parameters:
        `isCollapsed` - true if collapsed, false if not

    - #### setDecoration

          public void setDecoration(ButtonCellBase.Decoration decoration)

      Set the `ButtonCellBase.Decoration` of the button.
      Parameters:
        `decoration` - the button decoration

    - #### setEnabled

          public void setEnabled(boolean enabled)

      Description copied from interface: `HasEnabled`
      Sets whether this widget is enabled.
      Specified by:
        `setEnabled` in interface `HasEnabled`
      Parameters:
        `enabled` - `true` to enable the widget, `false` to disable it

    - #### setFocus

          public void setFocus(boolean focused)

      Description copied from interface: `Focusable`
      Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events.
      Specified by:
        `setFocus` in interface `Focusable`
      Parameters:
        `focused` - whether this widget should take focus or release it

    - #### setTabIndex

          public void setTabIndex(int index)

      Description copied from interface: `Focusable`
      Sets the widget's position in the tab index. If more than one widget has the same tab index, each such widget will receive focus in an arbitrary order. Setting the tab index to `-1` will cause this widget to be removed from the tab order.
      Specified by:
        `setTabIndex` in interface `Focusable`
      Parameters:
        `index` - the widget's tab index