|
|||||||||
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<D>
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<State>() { public State prepareData(State model) { model.set("test", model.getAbbr() + " " + model.getName()); return model; } });
BaseEvent.setCancelled(boolean)
.BaseEvent.setCancelled(boolean)
.
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.FieldImages, 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 | |
---|---|
protected boolean |
autoComplete
|
protected boolean |
delayedCheck
|
protected java.lang.String |
lastQuery
|
protected int |
pageSize
|
protected PagingToolBar |
pageTb
|
protected ListStore<D> |
store
|
Fields inherited from class com.extjs.gxt.ui.client.widget.form.TriggerField |
---|
focusEventPreview, mimicing, trigger, triggerStyle |
Fields inherited from class com.extjs.gxt.ui.client.widget.form.TextField |
---|
emptyStyle, impl, input, validator |
Fields inherited from class com.extjs.gxt.ui.client.widget.form.Field |
---|
autoValidate, emptyText, errorIcon, fieldStyle, focusStyle, focusValue, forceInvalidText, hasFocus, images, invalidStyle, messages, name, originalValue, preventMark, propertyEditor, readOnly, readOnlyFieldStyle, validationDelay, validationTask, value |
Fields inherited from class com.extjs.gxt.ui.client.widget.BoxComponent |
---|
adjustSize, cacheSizes, ensureVisibilityOnSizing, height, lastSize, layer, shim, width |
Fields inherited from class com.extjs.gxt.ui.client.widget.Component |
---|
afterRender, attachables, baseStyle, disabled, disabledStyle, disableTextSelection, dummy, focusable, hidden, mask, maskMessage, maskMessageStyleName, monitorWindowResize, rendered, resizeHandler, setElementRender, stateId, swallowEvents, toolTip, windowResizeDelay, windowResizeTask |
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<D> listener)
Add a selection changed listener. |
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. |
protected void |
collapseIf(PreviewEvent pe)
|
protected PagingToolBar |
createPagingToolBar(int pageSize)
|
protected void |
doForce()
|
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. |
protected D |
findModel(java.lang.String property,
java.lang.String value)
|
protected void |
fireKey(FieldEvent fe)
|
protected com.google.gwt.user.client.Element |
getAlignElement()
|
java.lang.String |
getAllQuery()
Returns the all query. |
java.lang.String |
getDisplayField()
Returns the display field. |
protected El |
getFocusEl()
|
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. |
int |
getPageSize()
Returns the page size. |
PagingToolBar |
getPagingToolBar()
Returns the combo's paging tool bar. |
protected PagingLoadConfig |
getParams(java.lang.String query)
|
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. |
protected boolean |
hasFocus()
|
protected void |
initComponent()
|
protected void |
initList()
|
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. |
boolean |
isUseQueryCache()
Returns the state if the query cache is used or not. |
protected void |
onBeforeLoad(StoreEvent<D> se)
|
protected void |
onDetach()
|
protected void |
onEmptyResults()
|
protected void |
onKeyDown(FieldEvent fe)
|
protected void |
onKeyUp(FieldEvent fe)
|
protected void |
onLoad(StoreEvent<D> se)
|
protected void |
onRender(com.google.gwt.user.client.Element parent,
int index)
Subclasses must override and ensure setElement is called for lazy rendered components. |
protected void |
onSelect(D model,
int index)
|
protected void |
onTriggerClick(ComponentEvent ce)
|
protected void |
onTypeAhead()
|
protected void |
onUpdate(StoreEvent<D> se)
|
protected void |
onViewClick(DomEvent de,
boolean focus)
|
protected void |
onWindowResize(int width,
int height)
|
void |
removeSelectionListener(SelectionChangedListener<D> listener)
Removes a selection changed listener. |
void |
reset()
Resets the current field value to the originally loaded value and clears any validation messages. |
protected void |
restrict()
|
void |
select(D sel)
|
void |
select(int index)
Select an item in the dropdown list by its numeric index in the list. |
protected boolean |
selectByValue(java.lang.String value)
|
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 |
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 true, 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 |
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 |
setUseQueryCache(boolean useQueryCache)
Set this to false to disable the last query cache (defaults to true). |
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<D> view)
Sets the combo's view. |
protected void |
triggerBlur(ComponentEvent ce)
|
protected void |
unsetDelayCheck()
|
protected boolean |
validateBlur(DomEvent e,
com.google.gwt.user.client.Element target)
|
protected boolean |
validateValue(java.lang.String value)
Subclasses should provide the validation implementation by overriding this. |
Methods inherited from class com.extjs.gxt.ui.client.widget.form.TriggerField |
---|
adjustInputSize, afterRender, beforeBlur, getTriggerStyle, isEditable, isHideTrigger, isMonitorTab, mimicBlur, onBlur, onClick, onDisable, onEnable, onFocus, onResize, setEditable, setHideTrigger, setMonitorTab, setReadOnly, setTriggerStyle |
Methods inherited from class com.extjs.gxt.ui.client.widget.form.TextField |
---|
applyEmptyText, getAllowBlank, getCursorPos, getInputEl, getMaxLength, getMinLength, getRegex, getSelectedText, getSelectionLength, getSelectOnFocus, getStyleEl, getValidator, isPassword, onComponentEvent, removeEmptyText, select, selectAll, setAllowBlank, setAriaState, setCursorPos, setEmptyText, setMaxLength, setMinLength, setPassword, setRegex, setSelectionRange, setSelectOnFocus, setValidator |
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent |
---|
adjustPosition, adjustSize, getBounds, getHeight, getHeight, getPosition, getPositionEl, getResizeEl, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, hideShadow, hideShim, hideUnders, isAutoHeight, isAutoWidth, isDeferHeight, isShim, onPosition, onUnload, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShadowOffset, setShadowPosition, setShim, setSize, setSize, setWidth, setWidth, sync, syncSize |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, setLayoutData |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, removeStyleDependentName, setElement, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean autoComplete
protected boolean delayedCheck
protected java.lang.String lastQuery
protected int pageSize
protected PagingToolBar pageTb
protected ListStore<D extends ModelData> store
Constructor Detail |
---|
public ComboBox()
Method Detail |
---|
public void addSelectionChangedListener(SelectionChangedListener<D> listener)
SelectionProvider
addSelectionChangedListener
in interface SelectionProvider<D extends ModelData>
listener
- a selection changed listenerpublic void clear()
Field
clear
in class Field<D extends ModelData>
public 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 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 boolean isUseQueryCache()
public void removeSelectionListener(SelectionChangedListener<D> 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(D sel)
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 setExpanded(boolean expand)
expand
- true true to expand
public 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 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)
Field
Field.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)
<code> combo.setSimpleTemplate("{abbr} {name}"); </code>
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 setUseQueryCache(boolean useQueryCache)
useQueryCache
- the useQueryCache to setpublic void setValue(D value)
Field
Field.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<D> view)
view
- the viewprotected void collapseIf(PreviewEvent pe)
protected PagingToolBar createPagingToolBar(int pageSize)
protected void doForce()
protected D findModel(java.lang.String property, java.lang.String value)
protected void fireKey(FieldEvent fe)
fireKey
in class Field<D extends ModelData>
protected com.google.gwt.user.client.Element getAlignElement()
protected El getFocusEl()
getFocusEl
in class TextField<D extends ModelData>
protected PagingLoadConfig getParams(java.lang.String query)
protected boolean hasFocus()
protected void initComponent()
protected void initList()
protected void onBeforeLoad(StoreEvent<D> se)
protected void onDetach()
onDetach
in class Field<D extends ModelData>
protected void onEmptyResults()
protected void onKeyDown(FieldEvent fe)
onKeyDown
in class TriggerField<D extends ModelData>
protected void onKeyUp(FieldEvent fe)
onKeyUp
in class Field<D extends ModelData>
protected void onLoad(StoreEvent<D> se)
protected void onRender(com.google.gwt.user.client.Element parent, int index)
Component
onRender
in class TriggerField<D extends ModelData>
parent
- the target elementindex
- the insert locationprotected void onSelect(D model, int index)
protected void onTriggerClick(ComponentEvent ce)
onTriggerClick
in class TriggerField<D extends ModelData>
protected void onTypeAhead()
protected void onUpdate(StoreEvent<D> se)
protected void onViewClick(DomEvent de, boolean focus)
protected void onWindowResize(int width, int height)
onWindowResize
in class Component
protected void restrict()
protected boolean selectByValue(java.lang.String value)
protected void triggerBlur(ComponentEvent ce)
triggerBlur
in class TriggerField<D extends ModelData>
protected void unsetDelayCheck()
protected boolean validateBlur(DomEvent e, com.google.gwt.user.client.Element target)
validateBlur
in class TriggerField<D extends ModelData>
protected boolean validateValue(java.lang.String value)
Field
validateValue
in class TextField<D extends ModelData>
value
- the value to validate
true
for valid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |