Package com.google.gwt.user.client.ui
Class ValueListBox<T>
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Composite
-
- com.google.gwt.user.client.ui.ValueListBox<T>
-
- Type Parameters:
T- the value type
- All Implemented Interfaces:
IsEditor<TakesValueEditor<T>>,HasAttachHandlers,HasValueChangeHandlers<T>,HasHandlers,EventListener,TakesValue<T>,Focusable,HasConstrainedValue<T>,HasEnabled,HasValue<T>,HasVisibility,IsRenderable,IsWidget
public class ValueListBox<T> extends Composite implements Focusable, HasConstrainedValue<T>, HasEnabled, IsEditor<TakesValueEditor<T>>
Implementation ofHasConstrainedValuebased on aSelectElement.A
Rendereris used to get user-presentable strings to display in the select element.
-
-
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.Widget
eventsToSink
-
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
-
Constructor Summary
Constructors Constructor Description ValueListBox()ValueListBox(Renderer<? super T> renderer)ValueListBox(Renderer<? super T> renderer, ProvidesKey<T> keyProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HandlerRegistrationaddValueChangeHandler(ValueChangeHandler<T> handler)Adds aValueChangeEventhandler.TakesValueEditor<T>asEditor()Returns aTakesValueEditorbacked by the ValueListBox.intgetTabIndex()Gets the widget's position in the tab index.TgetValue()Gets this object's value.booleanisEnabled()Returns true if the widget is enabled, false if not.voidsetAcceptableValues(java.util.Collection<T> newValues)Set the acceptable values.voidsetAccessKey(char key)Sets the widget's 'access key'.voidsetEnabled(boolean enabled)Sets whether this widget is enabled.voidsetFocus(boolean focused)Explicitly focus/unfocus this widget.voidsetTabIndex(int index)Sets the widget's position in the tab index.voidsetValue(T value)Set the value and display it in the select element.voidsetValue(T value, boolean fireEvents)Sets this object's value.-
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, 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, 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
-
-
-
-
Method Detail
-
addValueChangeHandler
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
Description copied from interface:HasValueChangeHandlersAdds aValueChangeEventhandler.- Specified by:
addValueChangeHandlerin interfaceHasValueChangeHandlers<T>- Parameters:
handler- the handler- Returns:
- the registration for the event
-
asEditor
public TakesValueEditor<T> asEditor()
Returns aTakesValueEditorbacked by the ValueListBox.
-
getTabIndex
public int getTabIndex()
Description copied from interface:FocusableGets the widget's position in the tab index.- Specified by:
getTabIndexin interfaceFocusable- Returns:
- the widget's tab index
-
getValue
public T getValue()
Description copied from interface:HasValueGets this object's value.- Specified by:
getValuein interfaceHasValue<T>- Specified by:
getValuein interfaceTakesValue<T>- Returns:
- the object's value
- See Also:
TakesValue.setValue(V)
-
isEnabled
public boolean isEnabled()
Description copied from interface:HasEnabledReturns true if the widget is enabled, false if not.- Specified by:
isEnabledin interfaceHasEnabled
-
setAcceptableValues
public void setAcceptableValues(java.util.Collection<T> newValues)
Description copied from interface:HasConstrainedValueSet the acceptable values.- Specified by:
setAcceptableValuesin interfaceHasConstrainedValue<T>- Parameters:
newValues- the acceptible values
-
setAccessKey
public void setAccessKey(char key)
Description copied from interface:FocusableSets the widget's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.- Specified by:
setAccessKeyin interfaceFocusable- Parameters:
key- the widget's access key
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:HasEnabledSets whether this widget is enabled.- Specified by:
setEnabledin interfaceHasEnabled- Parameters:
enabled-trueto enable the widget,falseto disable it
-
setFocus
public void setFocus(boolean focused)
Description copied from interface:FocusableExplicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events. NOTE: Most browsers fire FocusEvents asynchronously. Especially within GWT tests, you'll need to make your test asynchronous to properly do verifications. SeeGWTTestCase#delayTestFinishfor more information on how to do this.
-
setTabIndex
public void setTabIndex(int index)
Description copied from interface:FocusableSets the widget's position in the tab index. If more than one widget has the same tab index, each such widget will receive focus in an arbitrary order. Setting the tab index to-1will cause this widget to be removed from the tab order.- Specified by:
setTabIndexin interfaceFocusable- Parameters:
index- the widget's tab index
-
setValue
public void setValue(T value)
Set the value and display it in the select element. Add the value to the acceptable set if it is not already there.- Specified by:
setValuein interfaceHasValue<T>- Specified by:
setValuein interfaceTakesValue<T>- Parameters:
value- the object's new value- See Also:
TakesValue.getValue()
-
setValue
public void setValue(T value, boolean fireEvents)
Description copied from interface:HasValueSets this object's value. FiresValueChangeEventwhen 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.
-
-