Package com.google.gwt.user.client.ui

## Interface HasValue<T>

- Type Parameters:
    `T` - the type of value
  All Superinterfaces:
    `HasHandlers`, `HasValueChangeHandlers<T>`, `TakesValue<T>`
  All Known Subinterfaces:
    `HasConstrainedValue<T>`
  All Known Implementing Classes:
    `CellWidget`, `CheckBox`, `DateBox`, `DatePicker`, `DoubleBox`, `IntegerBox`, `LongBox`, `PasswordTextBox`, `RadioButton`, `SimpleCheckBox`, `SimpleRadioButton`, `SuggestBox`, `TextArea`, `TextBox`, `TextBoxBase`, `ToggleButton`, `ValueBox`, `ValueBoxBase`, `ValueListBox`, `ValuePicker`

      public interface HasValue<T>
      extends TakesValue<T>, HasValueChangeHandlers<T>

  Extends `TakesValue` to allow the value to be pulled back out, and to throw `ValueChangeEvent` events.

  An object that implements this interface should be a user input widget, where the user and programmer can both set and get the object's value. It is intended to provide a unified interface to widgets with "atomic" values, like Strings and Dates.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `T` | `getValue()` | Gets this object's value.
    `void` | `setValue​(T value)` | Sets this object's value without firing any events.
    `void` | `setValue​(T value, boolean fireEvents)` | Sets this object's value.

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

      `fireEvent`

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

      `addValueChangeHandler`

- - ### Method Detail

    - #### getValue

          T getValue()

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

    - #### setValue

          void setValue​(T 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.

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

    - #### setValue

          void setValue​(T 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.

      Parameters:
        `value` - the object's new value
        `fireEvents` - fire events if true and value is new