Class ValuePicker<T>

Type Parameters:
T - the type of value
All Implemented Interfaces:
IsEditor<LeafValueEditor<T>>, HasAttachHandlers, HasValueChangeHandlers<T>, HasHandlers, EventListener, TakesValue<T>, HasConstrainedValue<T>, HasValue<T>, HasVisibility, IsRenderable, IsWidget

public class ValuePicker<T> extends Composite implements HasConstrainedValue<T>, IsEditor<LeafValueEditor<T>>
Allows the user to pick a single value from a list.
  • Constructor Details

    • ValuePicker

      public ValuePicker(CellList<T> cellList)
    • ValuePicker

      public ValuePicker(Renderer<? super T> renderer)
    • ValuePicker

      public ValuePicker()
  • Method Details

    • addValueChangeHandler

      public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
      Description copied from interface: HasValueChangeHandlers
      Adds a ValueChangeEvent handler.
      Specified by:
      addValueChangeHandler in interface HasValueChangeHandlers<T>
      Parameters:
      handler - the handler
      Returns:
      the registration for the event
    • asEditor

      public LeafValueEditor<T> asEditor()
      Returns a TakesValueEditor backed by the ValuePicker.
      Specified by:
      asEditor in interface IsEditor<T>
      Returns:
      an Editor of type E
    • asWidget

      public ValuePicker<T> asWidget()
      Returns this view.
      Specified by:
      asWidget in interface IsWidget
      Overrides:
      asWidget in class Widget
    • getPageSize

      public int getPageSize()
    • getValue

      public T getValue()
      Description copied from interface: HasValue
      Gets this object's value.
      Specified by:
      getValue in interface HasValue<T>
      Specified by:
      getValue in interface TakesValue<T>
      Returns:
      the object's value
      See Also:
    • setAcceptableValues

      public void setAcceptableValues(Collection<T> values)
      Description copied from interface: HasConstrainedValue
      Set the acceptable values.
      Specified by:
      setAcceptableValues in interface HasConstrainedValue<T>
      Parameters:
      values - the acceptible values
    • setPageSize

      public void setPageSize(int size)
    • setValue

      public void setValue(T value)
      Description copied from interface: HasValue
      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 HasValue<T>
      Specified by:
      setValue in interface TakesValue<T>
      Parameters:
      value - the object's new value
      See Also:
    • setValue

      public void setValue(T value, boolean fireEvents)
      Description copied from interface: HasValue
      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.

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