T - the data typepublic class ComboBox<T> extends TriggerField<T> implements ExpandEvent.HasExpandHandlers, CollapseEvent.HasCollapseHandlers
setForceSelection(boolean) to true.
When not forcing a selection (setForceSelection(boolean))
CellComponent.getValue() can return null event if the user has typed text into the
field if that text cannot be tied to a model from from the combo's store. In
this case, you can use ValueBaseField.getText() to get the fields string value.
The selection list's options are populated from any ListStore.UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledHasDirection.DirectionEditor.Ignore, Editor.PathDEBUG_ID_PREFIX| Constructor and Description |
|---|
ComboBox(ComboBoxCell<T> cell)
Creates a new combo box with the given cell.
|
ComboBox(ListStore<T> store,
LabelProvider<T> labelProvider) |
ComboBox(ListStore<T> store,
LabelProvider<T> labelProvider,
LabelProvider<T> viewLabelProvider) |
ComboBox(ListStore<T> store,
LabelProvider<T> labelProvider,
ListView<T,?> listView) |
| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addCollapseHandler(CollapseEvent.CollapseHandler handler)
Adds a
CollapseEvent.CollapseHandler handler for CollapseEvent
events. |
HandlerRegistration |
addExpandHandler(ExpandEvent.ExpandHandler handler)
Adds a
ExpandEvent.ExpandHandler handler for ExpandEvent events. |
void |
clear()
Clears the value from the field.
|
void |
clearSelections()
Clears any text/value currently set in the field.
|
void |
collapse()
Hides the dropdown list if it is currently expanded.
|
void |
doQuery(String query,
boolean force)
Execute a query to filter the dropdown list.
|
void |
expand()
Expands the dropdown list if it is currently hidden.
|
String |
getAllQuery()
Returns the all query.
|
ComboBoxCell<T> |
getCell()
Get the
Cell wrapped by this widget. |
LabelProvider<T> |
getLabelProvider()
Returns the combo's label provider.
|
ListView<T,?> |
getListView()
Returns the combo's list view.
|
Loader<?,?> |
getLoader()
Returns the combo's loader.
|
int |
getMinChars()
Returns the minimum characters used for autocomplete and typeahead.
|
int |
getMinListWidth()
Returns the dropdown list's minimum width.
|
int |
getPageSize()
Returns the page size.
|
ListStore<T> |
getStore()
Returns the combo's list store.
|
ComboBoxCell.TriggerAction |
getTriggerAction()
Returns the trigger action.
|
int |
getTypeAheadDelay()
Returns the type ahead delay in milliseconds.
|
boolean |
isExpanded()
Returns true if the dropdown is expanded.
|
boolean |
isForceSelection()
Returns true if the field's value is forced to one of the value in the
list.
|
boolean |
isTypeAhead()
Returns true if type ahead is enabled.
|
void |
select(int index)
Select an item in the dropdown list by its numeric index in the list.
|
void |
select(T item)
Select an item in the dropdown list.
|
void |
setAllQuery(String allQuery)
The text query to send to the server to return all records for the list
with no filtering (defaults to '').
|
void |
setExpanded(boolean expand)
Sets the panel's expand state.
|
void |
setForceSelection(boolean forceSelection)
Sets whether the combo's value is restricted to one of the values in the
list, false to allow the user to set arbitrary text into the field
(defaults to false).
|
void |
setLoader(Loader<?,?> loader)
Sets the comobo's loader.
|
void |
setMinChars(int minChars)
Sets the minimum number of characters the user must type before
autocomplete and typeahead active (defaults to 4 if remote, or 0 if local).
|
void |
setMinListWidth(int minListWidth)
Sets the minimum width of the dropdown list in pixels (defaults to 70, will
be ignored if listWidth has a higher value).
|
void |
setPageSize(int pageSize)
Sets the page size.
|
void |
setStore(ListStore<T> store)
Sets the combo's store.
|
void |
setTriggerAction(ComboBoxCell.TriggerAction triggerAction)
The action to execute when the trigger field is activated.
|
void |
setTypeAhead(boolean typeAhead)
True to populate and autoselect the remainder of the text being typed after
a configurable delay (
setTypeAheadDelay(int)) if it matches a known
value (defaults to false) |
void |
setTypeAheadDelay(int typeAheadDelay)
The length of time in milliseconds to wait until the typeahead text is
displayed if typeAhead = true (defaults to 250).
|
addTriggerClickHandler, isEditable, isMonitorTab, setEditable, setHideTrigger, setMonitorTabaddChangeHandler, addKeyPressHandler, addKeyUpHandler, addParseErrorHandler, getCurrentValue, getCursorPos, getDirection, getDirectionEstimator, getEmptyText, getPropertyEditor, getSelectedText, getSelectionLength, getText, getValueOrThrow, isAllowBlank, isCurrentValid, isCurrentValid, isSelectOnFocus, redraw, select, selectAll, setAllowBlank, setCursorPos, setDirection, setDirectionEstimator, setDirectionEstimator, setEmptyText, setId, setPropertyEditor, setReadOnly, setSelectionRange, setSelectOnFocus, setText, setValueaddInvalidHandler, addValidator, addValidHandler, addValueChangeHandler, clearInvalid, finishEditing, forceInvalid, getErrorSupport, getName, getValidateOnBlur, getValidationDelay, getValidators, isAutoValidate, isEditing, isReadOnly, isValid, isValid, markInvalid, onBrowserEvent, removeValidator, reset, setAutoValidate, setDelegate, setErrorSupport, setName, setOriginalValue, setValidateOnBlur, setValidationDelay, setValue, showErrors, validate, validategetKeyProvider, getValue, setValueaddBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disable, disableEvents, enable, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeHandler, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmaskaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEventsequals, getClass, hashCode, notify, notifyAll, wait, wait, waitfireEventgetValuepublic ComboBox(ComboBoxCell<T> cell)
cell - the cell@UiConstructor public ComboBox(ListStore<T> store, LabelProvider<T> labelProvider)
public ComboBox(ListStore<T> store, LabelProvider<T> labelProvider, LabelProvider<T> viewLabelProvider)
public HandlerRegistration addCollapseHandler(CollapseEvent.CollapseHandler handler)
CollapseEvent.HasCollapseHandlersCollapseEvent.CollapseHandler handler for CollapseEvent
events.addCollapseHandler in interface CollapseEvent.HasCollapseHandlershandler - the handlerpublic HandlerRegistration addExpandHandler(ExpandEvent.ExpandHandler handler)
ExpandEvent.HasExpandHandlersExpandEvent.ExpandHandler handler for ExpandEvent events.addExpandHandler in interface ExpandEvent.HasExpandHandlershandler - the handlerpublic void clear()
Fieldpublic void clearSelections()
public void collapse()
public void doQuery(String query, boolean force)
query - the queryforce - true to force the query to execute even if there are currently
fewer characters in the field than the minimum specified by the
minChars config option. It also clears any filter previously saved
in the current storepublic void expand()
public String getAllQuery()
public ComboBoxCell<T> getCell()
CellComponentCell wrapped by this widget.getCell in class TriggerField<T>Cell being wrappedpublic LabelProvider<T> getLabelProvider()
public Loader<?,?> getLoader()
public int getMinChars()
public int getMinListWidth()
public int getPageSize()
public ComboBoxCell.TriggerAction getTriggerAction()
public int getTypeAheadDelay()
public boolean isExpanded()
public boolean isForceSelection()
public boolean isTypeAhead()
public void select(int index)
index - the index of the item to selectpublic void select(T item)
item - the item to selectpublic void setAllQuery(String allQuery)
allQuery - the all querypublic void setExpanded(boolean expand)
expand - true true to expandpublic void setForceSelection(boolean forceSelection)
forceSelection - true to force selectionpublic void setLoader(Loader<?,?> loader)
loader - the loaderpublic void setMinChars(int minChars)
minChars - minimum number of characters before autocomplete and
typeahead are activepublic void setMinListWidth(int minListWidth)
minListWidth - the min widthpublic void setPageSize(int pageSize)
pageSize - the page sizepublic void setStore(ListStore<T> store)
store - the storepublic void setTriggerAction(ComboBoxCell.TriggerAction triggerAction)
ComboBoxCell.TriggerAction.ALL to run the query specified by the allQuery which
can be set using setAllQuery(String) (defaults to
ComboBoxCell.TriggerAction.QUERY).triggerAction - the trigger actionpublic void setTypeAhead(boolean typeAhead)
setTypeAheadDelay(int)) if it matches a known
value (defaults to false)typeAhead - true to enable type aheadpublic void setTypeAheadDelay(int typeAheadDelay)
typeAheadDelay - the type ahead delayCopyright © 2012. All Rights Reserved.