|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.sencha.gxt.widget.core.client.Component
com.sencha.gxt.widget.core.client.cell.CellComponent<T>
com.sencha.gxt.widget.core.client.form.Field<T>
com.sencha.gxt.widget.core.client.form.ValueBaseField<T>
com.sencha.gxt.widget.core.client.form.TriggerField<T>
com.sencha.gxt.widget.core.client.form.ComboBox<T>
T - the data typepublic class ComboBox<T>
A combobox control with support for autocomplete, remote loading, and many other features.
A ComboBox is like a combination of a traditional HTML text <input> field and a <select> field; the user is able to type freely into the field, and/or pick values from a dropdown selection list. The user can input any value by default, even if it does not appear in the selection list; to prevent free-form values and restrict them to items in the list, setsetForceSelection(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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.sencha.gxt.widget.core.client.form.Field |
|---|
Field.FieldStyles |
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
| Nested classes/interfaces inherited from interface com.google.gwt.i18n.client.HasDirection |
|---|
HasDirection.Direction |
| Field Summary |
|---|
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX |
| Constructor Summary | |
|---|---|
ComboBox(ComboBoxCell<T> cell)
Creates a new combo box with the given cell. |
|
ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider)
Creates a combo box that renders all items with the given label provider. |
|
ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
ListView<T,?> listView)
Creates a combo box that renders the input value with the label provider. |
|
ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
ListView<T,?> listView,
TriggerFieldCell.TriggerFieldAppearance appearance)
Creates a combo box that renders the input value with the label provider. |
|
ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
SafeHtmlRenderer<T> renderer)
Creates a combo box that renders the input value with the label provider and the drop down values with the renderer. |
|
ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
SafeHtmlRenderer<T> renderer,
TriggerFieldCell.TriggerFieldAppearance appearance)
Creates a combo box that renders the input value with the label provider and the drop down values with the renderer. |
|
ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
TriggerFieldCell.TriggerFieldAppearance appearance)
Creates a combo box that renders all items with the given label provider. |
|
| Method Summary | |
|---|---|
HandlerRegistration |
addBeforeQueryHandler(BeforeQueryEvent.BeforeQueryHandler<T> handler)
Adds a BeforeQueryEvent.BeforeQueryHandler handler for BeforeQueryEvent
events. |
HandlerRegistration |
addBeforeSelectionHandler(BeforeSelectionHandler<T> handler)
|
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. |
HandlerRegistration |
addSelectionHandler(SelectionHandler<T> handler)
|
void |
clear()
Clears the value from 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<? super 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). |
| Methods inherited from class com.sencha.gxt.widget.core.client.form.TriggerField |
|---|
addTriggerClickHandler, isEditable, isMonitorTab, setEditable, setHideTrigger, setMonitorTab |
| Methods inherited from class com.sencha.gxt.widget.core.client.form.ValueBaseField |
|---|
addChangeHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addParseErrorHandler, getCurrentValue, getCursorPos, getDirection, getDirectionEstimator, getEmptyText, getPropertyEditor, getSelectedText, getSelectionLength, getText, getValueOrThrow, isAllowBlank, isCurrentValid, isCurrentValid, isSelectOnFocus, select, selectAll, setAllowBlank, setCursorPos, setDirection, setDirectionEstimator, setDirectionEstimator, setEmptyText, setId, setPropertyEditor, setReadOnly, setSelectionRange, setSelectOnFocus, setText, setValue, validateCurrent |
| Methods inherited from class com.sencha.gxt.widget.core.client.form.Field |
|---|
addInvalidHandler, addValidator, addValidHandler, addValueChangeHandler, clearInvalid, finishEditing, flush, forceInvalid, getErrorSupport, getName, getValidateOnBlur, getValidationDelay, getValidators, isAutoValidate, isEditing, isReadOnly, isValid, isValid, markInvalid, onBrowserEvent, onPropertyChange, removeValidator, reset, setAutoValidate, setDelegate, setErrorSupport, setName, setOriginalValue, setValidateOnBlur, setValidationDelay, setValue, showErrors, validate, validate |
| Methods inherited from class com.sencha.gxt.widget.core.client.cell.CellComponent |
|---|
getElement, getKeyProvider, getValue, redraw, setValue |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Methods inherited from interface com.google.gwt.user.client.ui.IsWidget |
|---|
asWidget |
| Methods inherited from interface com.google.gwt.user.client.TakesValue |
|---|
getValue |
| Methods inherited from interface com.google.gwt.user.client.ui.HasValue |
|---|
getValue, setValue |
| Constructor Detail |
|---|
public ComboBox(ComboBoxCell<T> cell)
cell - the cell
@UiConstructor
public ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider)
store - the store containing the data that can be selectedlabelProvider - converts the current model type into a string value to
display in the text box
public ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
TriggerFieldCell.TriggerFieldAppearance appearance)
store - the store containing the data that can be selectedlabelProvider - converts the current model type into a string value to
display in the text boxappearance - the appearance
public ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
ListView<T,?> listView)
store - the store containing the data that can be selectedlabelProvider - converts the current model type into a string value to
display in the text boxlistView - the list view
public ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
ListView<T,?> listView,
TriggerFieldCell.TriggerFieldAppearance appearance)
store - the store containing the data that can be selectedlabelProvider - converts the current model type into a string value to
display in the text boxlistView - the list viewappearance - the appearance
public ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
SafeHtmlRenderer<T> renderer)
store - the store containing the data that can be selectedlabelProvider - converts the current model type into a string value to
display in the text boxrenderer - draws the current model as html in the drop down
public ComboBox(ListStore<T> store,
LabelProvider<? super T> labelProvider,
SafeHtmlRenderer<T> renderer,
TriggerFieldCell.TriggerFieldAppearance appearance)
store - the store containing the data that can be selectedlabelProvider - converts the current model type into a string value to
display in the text boxrenderer - draws the current model as html in the drop downappearance - the appearance| Method Detail |
|---|
public HandlerRegistration addBeforeQueryHandler(BeforeQueryEvent.BeforeQueryHandler<T> handler)
BeforeQueryEvent.HasBeforeQueryHandlersBeforeQueryEvent.BeforeQueryHandler handler for BeforeQueryEvent
events.
addBeforeQueryHandler in interface BeforeQueryEvent.HasBeforeQueryHandlers<T>handler - the handler
public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<T> handler)
addBeforeSelectionHandler in interface HasBeforeSelectionHandlers<T>public HandlerRegistration addCollapseHandler(CollapseEvent.CollapseHandler handler)
CollapseEvent.HasCollapseHandlersCollapseEvent.CollapseHandler handler for CollapseEvent
events.
addCollapseHandler in interface CollapseEvent.HasCollapseHandlershandler - the handler
public HandlerRegistration addExpandHandler(ExpandEvent.ExpandHandler handler)
ExpandEvent.HasExpandHandlersExpandEvent.ExpandHandler handler for ExpandEvent events.
addExpandHandler in interface ExpandEvent.HasExpandHandlershandler - the handler
public HandlerRegistration addSelectionHandler(SelectionHandler<T> handler)
addSelectionHandler in interface HasSelectionHandlers<T>public void clear()
Field
clear in interface IsField<T>clear in class Field<T>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<? super T> getLabelProvider()
public ListView<T,?> getListView()
public Loader<?,?> getLoader()
public int getMinChars()
public int getMinListWidth()
public int getPageSize()
public ListStore<T> getStore()
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 delay
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||