T
- the value typepublic class ValueListBox<T> extends Composite implements Focusable, HasConstrainedValue<T>, HasEnabled, 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
DEBUG_ID_PREFIX
Constructor and Description |
---|
ValueListBox() |
ValueListBox(Renderer<? super T> renderer) |
ValueListBox(Renderer<? super 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. |
int |
getTabIndex()
Gets the widget's position in the tab index.
|
T |
getValue()
Gets this object's value.
|
boolean |
isEnabled()
Returns true if the widget is enabled, false if not.
|
void |
setAcceptableValues(Collection<T> newValues)
Set the acceptable values.
|
void |
setAccessKey(char key)
Sets the widget's 'access key'.
|
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.
|
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, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
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
fireEvent
public ValueListBox()
public ValueListBox(Renderer<? super 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 int getTabIndex()
Focusable
getTabIndex
in interface Focusable
public T getValue()
HasValue
getValue
in interface TakesValue<T>
getValue
in interface HasValue<T>
TakesValue.setValue(V)
public boolean isEnabled()
HasEnabled
isEnabled
in interface HasEnabled
public void setAcceptableValues(Collection<T> newValues)
HasConstrainedValue
setAcceptableValues
in interface HasConstrainedValue<T>
newValues
- the acceptible valuespublic void setAccessKey(char key)
Focusable
setAccessKey
in interface Focusable
key
- the widget's access keypublic void setEnabled(boolean enabled)
HasEnabled
setEnabled
in interface HasEnabled
enabled
- true
to enable the widget, false
to disable itpublic void setFocus(boolean focused)
Focusable
GWTTestCase#delayTestFinish
for more information on how to do this.public void setTabIndex(int index)
Focusable
-1
will cause this widget to
be removed from the tab order.setTabIndex
in interface Focusable
index
- the widget's tab indexpublic 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.
Copyright © 2018. All rights reserved.