|
|||||||||
| 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.extjs.gxt.ui.client.widget.Component
com.extjs.gxt.ui.client.widget.BoxComponent
com.extjs.gxt.ui.client.widget.form.Field<D>
com.extjs.gxt.ui.client.widget.form.TextField<Data>
com.extjs.gxt.ui.client.widget.form.TriggerField<D>
com.extjs.gxt.ui.client.widget.form.ComboBox<D>
D - the model data typepublic class ComboBox<D extends ModelData>
A combobox component.
When not forcing a selection (setForceSelection(boolean))
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 Field.getRawValue() to get the fields string value.
Combo uses a XTemplate to render it's drop down list. A custom
template can be specified to customize the display of the drop down list. See
setTemplate(XTemplate).
A custom PropertyEditor can be used to "format" the value that
is displayed in the combo's text field. For example:
combo.setPropertyEditor(new ListModelPropertyEditor<State>(){
public String getStringValue(State value) {
return value.getAbbr() + " " + value.getName();
}
});
A ModelProcessor can be used to "format" the values in the drop
down list:
combo.getView().setModelProcessor(new ModelProcessor() {
public State prepareData(State model) {
model.set("test", model.getAbbr() + " " + model.getName());
return model;
}
});
doit field to false to cancel the action.doit field to false to cancel the action.
| Nested Class Summary | |
|---|---|
class |
ComboBox.ComboBoxMessages
ComboBox error messages. |
static class |
ComboBox.TriggerAction
TriggerAction enum. |
| Nested classes/interfaces inherited from class com.extjs.gxt.ui.client.widget.form.TextField |
|---|
TextField.TextFieldMessages |
| Nested classes/interfaces inherited from class com.extjs.gxt.ui.client.widget.form.Field |
|---|
Field.FieldMessages |
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled |
| Field Summary |
|---|
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX |
| Constructor Summary | |
|---|---|
ComboBox()
Creates a combo box. |
|
| Method Summary | |
|---|---|
void |
addSelectionChangedListener(SelectionChangedListener listener)
Add a selection changed listener. |
void |
clearSelections()
Clears any text/value currently set in the field. |
void |
collapse()
Hides the dropdown list if it is currently expanded. |
void |
doQuery(java.lang.String q,
boolean forceAll)
Execute a query to filter the dropdown list. |
void |
expand()
Expands the dropdown list if it is currently hidden. |
java.lang.String |
getAllQuery()
Returns the all query. |
java.lang.String |
getDisplayField()
Returns the display field. |
boolean |
getForceSelection()
Returns true if the field's value is forced to one of the value in the list. |
java.lang.String |
getItemSelector()
Returns the item selector. |
java.lang.String |
getListAlign()
Returns the list's list align value. |
java.lang.String |
getListStyle()
Returns the list style. |
ListView<D> |
getListView()
Returns the combo's list view. |
java.lang.String |
getLoadingText()
Returns the loading text. |
int |
getMaxHeight()
Returns the dropdown list's max height. |
ComboBox.ComboBoxMessages |
getMessages()
Returns the field's messages. |
int |
getMinChars()
Returns the min characters used for autocompete and typeahead. |
int |
getMinListWidth()
Returns the dropdown list's min width. |
ModelStringProvider<D> |
getModelStringProvider()
Deprecated. see setModelStringProvider(ModelStringProvider) |
int |
getPageSize()
Returns the page size. |
PagingToolBar |
getPagingToolBar()
Returns the combo's paging tool bar. |
ListModelPropertyEditor<D> |
getPropertyEditor()
Returns the field's property editor. |
int |
getQueryDelay()
Returns the query delay. |
java.lang.String |
getSelectedStyle()
Returns the selected style. |
java.util.List<D> |
getSelection()
Returns the current selection. |
ListStore<D> |
getStore()
Returns the combo's store. |
XTemplate |
getTemplate()
Returns the custom template. |
ComboBox.TriggerAction |
getTriggerAction()
Returns the trigger action. |
int |
getTypeAheadDelay()
Returns the type ahead delay in milliseconds. |
D |
getValue()
Returns the typed value of the field. |
java.lang.String |
getValueField()
Returns the value field name. |
ListView<D> |
getView()
Returns the combo's list view. |
boolean |
isExpanded()
Returns true if the panel is expanded. |
boolean |
isLazyRender()
Returns true if lazy rendering is enabled. |
boolean |
isTypeAhead()
Returns true if type ahead is enabled. |
void |
onComponentEvent(ComponentEvent ce)
Any events a component receives will be forwarded to this method. |
void |
removeSelectionListener(SelectionChangedListener listener)
Removes a selection changed listener. |
void |
reset()
Resets the current field value to the originally loaded value and clears any validation messages. |
void |
select(int index)
Select an item in the dropdown list by its numeric index in the list. |
void |
setAllQuery(java.lang.String allQuery)
The text query to send to the server to return all records for the list with no filtering (defaults to ''). |
void |
setDisplayField(java.lang.String displayField)
The underlying data field name to bind to this ComboBox (defaults to 'text'). |
void |
setEditable(boolean value)
Allow or prevent the user from directly editing the field text. |
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 |
setItemSelector(java.lang.String itemSelector)
This setting is required if a custom XTemplate has been specified. |
void |
setLazyRender(boolean lazyRender)
True to lazily render the combo's drop down list (default to false, pre-render). |
void |
setListAlign(java.lang.String listAlign)
Sets a valid anchor position value. |
void |
setListStyle(java.lang.String listStyle)
Sets the style for the drop down list (defaults to 'x-combo-list'); |
void |
setLoadingText(java.lang.String loadingText)
Sets the loading text. |
void |
setMaxHeight(int maxHeight)
Sets the maximum height in pixels of the dropdown list before scrollbars are shown (defaults to 300). |
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 |
setModelStringProvider(ModelStringProvider<D> modelStringProvider)
Deprecated. the preferred way to provide "formatted" values is to use a ModelProcessor with the comobo's view. |
void |
setPageSize(int pageSize)
Sets the page size. |
void |
setPropertyEditor(PropertyEditor<D> propertyEditor)
Sets the field's property editor which is used to translate typed values to string, and string values back to typed values. |
void |
setQueryDelay(int queryDelay)
The length of time in milliseconds to delay between the start of typing and sending the query to filter the dropdown list. |
void |
setRawValue(java.lang.String text)
Sets the underlying DOM field's value directly, bypassing validation. |
void |
setSelectedStyle(java.lang.String selectedStyle)
Sets the CSS style name to apply to the selected item in the dropdown list (defaults to 'x-combo-selected'). |
void |
setSelection(java.util.List<D> selection)
Sets the current selection for this selection provider. |
void |
setSimpleTemplate(java.lang.String html)
Sets the template fragment to be used for the text of each combo list item. |
void |
setStore(ListStore<D> store)
Sets the combo's store. |
void |
setTemplate(java.lang.String html)
Sets the custom template used to render the combo's drop down list.Use this to create custom UI layouts for items in the list. |
void |
setTemplate(XTemplate template)
Sets the custom template used to render the combo's drop down list. |
void |
setTriggerAction(ComboBox.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 ( typeAheadDelay) 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). |
void |
setValue(D value)
Sets a data value into the field and validates it. |
void |
setValueField(java.lang.String valueField)
Sets the model field used to retrieve the "value" from the model. |
void |
setView(ListView view)
Sets the combo's view. |
| Methods inherited from class com.extjs.gxt.ui.client.widget.form.TriggerField |
|---|
getElement, getTriggerStyle, isHideTrigger, setHideTrigger, setTriggerStyle |
| Methods inherited from class com.extjs.gxt.ui.client.widget.form.TextField |
|---|
getAllowBlank, getCursorPos, getMaxLength, getMinLength, getRegex, getSelectedText, getSelectionLength, getSelectOnFocus, getValidator, isPassword, select, selectAll, setAllowBlank, setCursorPos, setEmptyText, setMaxLength, setMinLength, setPassword, setRegex, setSelectionRange, setSelectOnFocus, setValidator |
| Methods inherited from class com.extjs.gxt.ui.client.widget.form.Field |
|---|
addInputStyleName, addKeyListener, clearInvalid, focus, forceInvalid, getAutoValidate, getEmptyText, getFieldLabel, getLabelSeparator, getLabelStyle, getMessageTarget, getName, getOriginalValue, getRawValue, getValidateOnBlur, getValidationDelay, isDirty, isHideLabel, isReadOnly, isValid, markInvalid, removeInputStyleName, removeKeyListener, setAutoValidate, setFieldLabel, setHideLabel, setLabelSeparator, setLabelStyle, setMessages, setMessageTarget, setName, setOriginalValue, setReadOnly, setTabIndex, setValidateOnBlur, setValidationDelay, updateOriginalValue, validate |
| Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent |
|---|
getBounds, getHeight, getHeight, getPosition, getShadow, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShim, setSize, setSize, setWidth, setWidth |
| Methods inherited from class com.extjs.gxt.ui.client.widget.Component |
|---|
addListener, addPlugin, addStyleName, addWidgetListener, disable, disableEvents, disableTextSelection, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, getBaseStyle, getBorders, getData, getData, getId, getItemId, getModel, getState, getToolTip, hide, hideToolTip, isDisabledEvents, isEnabled, isRendered, isVisible, onBrowserEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeWidgetListener, render, render, saveState, setBorders, setData, setData, setElement, setEnabled, setEnableState, setId, setIntStyleAttribute, setItemId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, show, sinkEvents, toString |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
getParent, isAttached |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, unsinkEvents |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ComboBox()
| Method Detail |
|---|
public void addSelectionChangedListener(SelectionChangedListener listener)
SelectionProvider
addSelectionChangedListener in interface SelectionProvider<D extends ModelData>listener - a selection changed listenerpublic void clearSelections()
public void collapse()
public void doQuery(java.lang.String q,
boolean forceAll)
q - the queryforceAll - 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 java.lang.String getAllQuery()
public java.lang.String getDisplayField()
public boolean getForceSelection()
public java.lang.String getItemSelector()
public java.lang.String getListAlign()
public java.lang.String getListStyle()
public ListView<D> getListView()
public java.lang.String getLoadingText()
public int getMaxHeight()
public ComboBox.ComboBoxMessages getMessages()
Field
getMessages in class TextField<D extends ModelData>public int getMinChars()
public int getMinListWidth()
public ModelStringProvider<D> getModelStringProvider()
setModelStringProvider(ModelStringProvider)
public int getPageSize()
public PagingToolBar getPagingToolBar()
public ListModelPropertyEditor<D> getPropertyEditor()
Field
getPropertyEditor in class Field<D extends ModelData>public int getQueryDelay()
public java.lang.String getSelectedStyle()
public java.util.List<D> getSelection()
SelectionProvider
getSelection in interface SelectionProvider<D extends ModelData>public ListStore<D> getStore()
public XTemplate getTemplate()
public ComboBox.TriggerAction getTriggerAction()
public int getTypeAheadDelay()
public D getValue()
Field
getValue in class Field<D extends ModelData>public java.lang.String getValueField()
public ListView<D> getView()
public boolean isExpanded()
true if the panel is expanded.
public boolean isLazyRender()
public boolean isTypeAhead()
public void removeSelectionListener(SelectionChangedListener listener)
SelectionProvider
removeSelectionListener in interface SelectionProvider<D extends ModelData>listener - a selection changed listenerpublic void reset()
Field
reset in class Field<D extends ModelData>public void select(int index)
index - the index of the item to selectpublic void setAllQuery(java.lang.String allQuery)
allQuery - the all querypublic void setDisplayField(java.lang.String displayField)
displayField - the display fieldpublic void setEditable(boolean value)
value - true to allow the user to directly edit the field textpublic void setExpanded(boolean expand)
expand - true true to expandpublic void setForceSelection(boolean forceSelection)
forceSelection - true to force selectionpublic void setItemSelector(java.lang.String itemSelector)
itemSelector - the item selectorpublic void setLazyRender(boolean lazyRender)
lazyRender - true to lazy render the drop down listpublic void setListAlign(java.lang.String listAlign)
El.alignTo(com.google.gwt.user.client.Element, java.lang.String, int[]) for details on
supported anchor positions (defaults to 'tl-bl?').
listAlign - the new list align valuepublic void setListStyle(java.lang.String listStyle)
listStyle - the list stylepublic void setLoadingText(java.lang.String loadingText)
loadingText - the loading textpublic void setMaxHeight(int maxHeight)
maxHeight - the max hieghtpublic void setMinChars(int minChars)
minChars - public void setMinListWidth(int minListWidth)
minListWidth - the min widthpublic void setModelStringProvider(ModelStringProvider<D> modelStringProvider)
ModelProcessor with the comobo's view.
BaseModelStringProvider
.
modelStringProvider - the string providerpublic void setPageSize(int pageSize)
pageSize - the page sizepublic void setPropertyEditor(PropertyEditor<D> propertyEditor)
Field
setPropertyEditor in class Field<D extends ModelData>propertyEditor - the property editorpublic void setQueryDelay(int queryDelay)
queryDelay - the query delaypublic void setRawValue(java.lang.String text)
FieldField.setValue(D).
setRawValue in class Field<D extends ModelData>text - the raw valuepublic void setSelectedStyle(java.lang.String selectedStyle)
selectedStyle - the selected stylepublic void setSelection(java.util.List<D> selection)
SelectionProvider
setSelection in interface SelectionProvider<D extends ModelData>selection - the new selectionpublic void setSimpleTemplate(java.lang.String html)
combo.setSimpleTemplate("{abbr} {name}");
html - the html used only for the text of each item in the listpublic void setStore(ListStore<D> store)
store - the storepublic void setTemplate(java.lang.String html)
If you wish to preserve the default visual look of list items, add the CSS class name 'x-combo-list-item' to the template's container element.
html - the htmlpublic void setTemplate(XTemplate template)
template - the templatepublic void setTriggerAction(ComboBox.TriggerAction triggerAction)
ComboBox.TriggerAction.ALL to run the query specified by the allQuery config
option (defaults to ComboBox.TriggerAction.QUERY).
triggerAction - the trigger actionpublic void setTypeAhead(boolean typeAhead)
typeAheadDelay) if it matches a known value
(defaults to false)
typeAhead - public void setTypeAheadDelay(int typeAheadDelay)
typeAheadDelay - the type ahead delaypublic void setValue(D value)
FieldField.setRawValue(java.lang.String).
setValue in class TextField<D extends ModelData>value - the value to setpublic void setValueField(java.lang.String valueField)
valueField - the value field namepublic void setView(ListView view)
view - the viewpublic void onComponentEvent(ComponentEvent ce)
ComponentComponent.onBrowserEvent(com.google.gwt.user.client.Event) method
should not be overridden or modified.
onComponentEvent in class Field<D extends ModelData>ce - the base event
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||