com.google.gwt.user.cellview.client

## Class CellWidget<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>

- Type Parameters:
    `C` - the type that the Cell represents
  All Implemented Interfaces:
    IsEditor<LeafValueEditor<C>>, HasAttachHandlers, HasValueChangeHandlers<C>, HasHandlers, EventListener, TakesValue<C>, HasValue<C>, HasVisibility, IsWidget, HasKeyProvider<C>

      public class CellWidget<C>
      extends Widget
      implements HasKeyProvider<C>, HasValue<C>, IsEditor<LeafValueEditor<C>>

  A `Widget` that wraps a `Cell`.

- - ### 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
    --- | ---
    `` | `CellWidget(Cell<C> cell)` Construct a new `CellWidget` with the specified cell and an initial value of `null`.
    `` | `CellWidget(Cell<C> cell, C initialValue)` Construct a new `CellWidget` with the specified cell and initial value.
    `` | `CellWidget(Cell<C> cell, C initialValue, ProvidesKey<C> keyProvider)` Construct a new `CellWidget` with the specified cell, initial value, and key provider.
    `protected` | `CellWidget(Cell<C> cell, C initialValue, ProvidesKey<C> keyProvider, Element elem)` Creates a `CellWidget` with the specified cell, initial value, key provider, using the specified element as the wrapper around the cell.
    `` | `CellWidget(Cell<C> cell, ProvidesKey<C> keyProvider)` Construct a new `CellWidget` with the specified cell and key provider, and an initial value of `null`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `HandlerRegistration` | `addValueChangeHandler(ValueChangeHandler<C> handler)` Adds a `ValueChangeEvent` handler.
    `LeafValueEditor<C>` | `asEditor()` Returns the Editor encapsulated by the view object.
    `Cell<C>` | `getCell()` Get the `Cell` wrapped by this widget.
    `ProvidesKey<C>` | `getKeyProvider()` Return the key provider.
    `C` | `getValue()` Gets this object's value.
    `void` | `onBrowserEvent(Event event)` Fired whenever a browser event is received.
    `void` | `redraw()` Redraw the widget.
    `void` | `setValue(C value)` Sets this object's value without firing any events.
    `void` | `setValue(C value, boolean fireEvents)` Sets this object's value.
    `void` | `setValue(C value, boolean fireEvents, boolean redraw)` Sets this object's value and optionally redraw the widget.

    - ### 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, unsinkEvents`

    - ### 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`

    - ### 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

    - #### CellWidget

          public CellWidget(Cell<C> cell)

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

    - #### CellWidget

          public CellWidget(Cell<C> cell,
                            ProvidesKey<C> keyProvider)

      Construct a new `CellWidget` with the specified cell and key provider, and an initial value of `null`.
      Parameters:
        `cell` - the cell to wrap
        `keyProvider` - the key provider used to get keys from values

    - #### CellWidget

          public CellWidget(Cell<C> cell,
                            C initialValue)

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

    - #### CellWidget

          public CellWidget(Cell<C> cell,
                            C initialValue,
                            ProvidesKey<C> keyProvider)

      Construct a new `CellWidget` with the specified cell, initial value, and key provider.
      Parameters:
        `cell` - the cell to wrap
        `initialValue` - the initial value of the Cell
        `keyProvider` - the key provider used to get keys from values

    - #### CellWidget

          protected CellWidget(Cell<C> cell,
                               C initialValue,
                               ProvidesKey<C> keyProvider,
                               Element elem)

      Creates a `CellWidget` with the specified cell, initial value, key provider, using the specified element as the wrapper around the cell.
      Parameters:
        `cell` - the cell to wrap
        `initialValue` - the initial value of the Cell
        `keyProvider` - the key provider used to get keys from values
        `elem` - the browser element to use

  - ### Method Detail

    - #### addValueChangeHandler

          public HandlerRegistration addValueChangeHandler(ValueChangeHandler<C> handler)

      Description copied from interface: `HasValueChangeHandlers`
      Adds a `ValueChangeEvent` handler.
      Specified by:
        `addValueChangeHandler` in interface `HasValueChangeHandlers<C>`
      Parameters:
        `handler` - the handler
      Returns:
        the registration for the event

    - #### asEditor

          public LeafValueEditor<C> asEditor()

      Description copied from interface: `IsEditor`
      Returns the Editor encapsulated by the view object.
      Specified by:
        `asEditor` in interface `IsEditor<LeafValueEditor<C>>`
      Returns:
        an `Editor` of type E

    - #### getCell

          public Cell<C> getCell()

      Get the `Cell` wrapped by this widget.
      Returns:
        the `Cell` being wrapped

    - #### getKeyProvider

          public ProvidesKey<C> getKeyProvider()

      Description copied from interface: `HasKeyProvider`
      Return the key provider.
      Specified by:
        `getKeyProvider` in interface `HasKeyProvider<C>`
      Returns:
        the `ProvidesKey` instance

    - #### getValue

          public C getValue()

      Description copied from interface: `HasValue`
      Gets this object's value.
      Specified by:
        `getValue` in interface `TakesValue<C>`
      Specified by:
        `getValue` in interface `HasValue<C>`
      Returns:
        the object's value
      See Also:
        `TakesValue.setValue(V)`

    - #### onBrowserEvent

          public void onBrowserEvent(Event event)

      Description copied from interface: `EventListener`
      Fired whenever a browser event is received.
      Specified by:
        `onBrowserEvent` in interface `EventListener`
      Overrides:
        `onBrowserEvent` in class `Widget`
      Parameters:
        `event` - the event received

    - #### redraw

          public void redraw()

      Redraw the widget.

    - #### setValue

          public void setValue(C value)

      Sets this object's value without firing any events. This should be identical to calling setValue(value, false).

      It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values.

      Widgets must accept null as a valid value. By convention, setting a widget to null clears value, calling getValue() on a cleared widget returns null. Widgets that can not be cleared (e.g. `CheckBox`) must find another valid meaning for null input.

      This method will redraw the widget if the new value does not equal the existing value.

      Specified by:
        `setValue` in interface `TakesValue<C>`
      Specified by:
        `setValue` in interface `HasValue<C>`
      Parameters:
        `value` - the object's new value
      See Also:
        `TakesValue.getValue()`

    - #### setValue

          public void setValue(C value,
                               boolean fireEvents)

      Sets this object's value. Fires `ValueChangeEvent` when fireEvents is true and the new value does not equal the existing value.

      It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values.

      This method will redraw the widget if the new value does not equal the existing value.

      Specified by:
        `setValue` in interface `HasValue<C>`
      Parameters:
        `value` - the object's new value
        `fireEvents` - fire events if true and value is new

    - #### setValue

          public void setValue(C value,
                               boolean fireEvents,
                               boolean redraw)

      Sets this object's value and optionally redraw the widget. Fires `ValueChangeEvent` when fireEvents is true and the new value does not equal the existing value. Redraws the widget when redraw is true and the new value does not equal the existing value.
      Parameters:
        `value` - the object's new value
        `fireEvents` - fire events if true and value is new
        `redraw` - redraw the widget if true and value is new