T
- the value typepublic class ValueListBox<T> extends Composite implements HasConstrainedValue<T>, IsEditor<TakesValueEditor<T>>
HasConstrainedValue
based on a
SelectElement
.
A Renderer
is used to get user-presentable strings to
display in the select element.
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
eventsToSink
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
Constructor and Description |
---|
ValueListBox(Renderer<T> renderer) |
ValueListBox(Renderer<T> renderer,
ProvidesKey<T> keyProvider) |
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<T> handler)
Adds a
ValueChangeEvent handler. |
TakesValueEditor<T> |
asEditor()
Returns a
TakesValueEditor backed by the ValueListBox. |
T |
getValue()
Gets this object's value.
|
void |
setAcceptableValues(java.util.Collection<T> newValues)
Set the acceptable values.
|
void |
setValue(T value)
Set the value and display it in the select element.
|
void |
setValue(T value,
boolean fireEvents)
Sets this object's value.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
public ValueListBox(Renderer<T> renderer, ProvidesKey<T> keyProvider)
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
HasValueChangeHandlers
ValueChangeEvent
handler.addValueChangeHandler
in interface HasValueChangeHandlers<T>
handler
- the handlerpublic TakesValueEditor<T> asEditor()
TakesValueEditor
backed by the ValueListBox.asEditor
in interface IsEditor<TakesValueEditor<T>>
Editor
of type Epublic T getValue()
HasValue
getValue
in interface TakesValue<T>
getValue
in interface HasValue<T>
TakesValue.setValue(V)
public void setAcceptableValues(java.util.Collection<T> newValues)
HasConstrainedValue
setAcceptableValues
in interface HasConstrainedValue<T>
newValues
- the acceptible valuespublic void setValue(T value)
setValue
in interface TakesValue<T>
setValue
in interface HasValue<T>
value
- the object's new valueTakesValue.getValue()
public void setValue(T value, boolean fireEvents)
HasValue
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.