public class ComboBoxCell<T> extends TriggerFieldCell<T>
Modifier and Type | Class and Description |
---|---|
static class |
ComboBoxCell.QueryMode |
static class |
ComboBoxCell.TriggerAction
TriggerAction enum.
|
TriggerFieldCell.TriggerFieldAppearance
ValueBaseInputCell.ValueBaseFieldAppearance
FieldCell.FieldAppearance, FieldCell.FieldAppearanceOptions, FieldCell.FieldViewData
Modifier and Type | Field and Description |
---|---|
protected String |
lastQuery |
protected Loader<?,?> |
loader |
protected int |
navKeyDelay
The delay is milliseconds the select on over is disabled on up / down arrow keys (defaults to 200).
|
protected DelayedTask |
navKeyTask |
protected int |
pageSize |
protected PagingToolBar |
pagingToolBar |
protected ListStore<T> |
store |
finishEditOnEnter, focusedCell, mimicking
allowBlank, finishEditOnBlur, impl, name, propertyEditor
bypassClearContext, focusContext, height, lastContext, lastParent, lastValue, lastValueUpdater, width
Constructor and Description |
---|
ComboBoxCell(ListStore<T> store,
LabelProvider<? super T> labelProvider)
Creates a combo box cell that renders all items with the given label provider.
|
ComboBoxCell(ListStore<T> store,
LabelProvider<? super T> labelProvider,
<any> renderer)
Creates a combo box cell that renders the input value with the label provider and the drop down values with the
renderer.
|
ComboBoxCell(ListStore<T> store,
LabelProvider<? super T> labelProvider,
<any> renderer,
TriggerFieldCell.TriggerFieldAppearance appearance)
Creates a combo box cell that renders the input value with the label provider and the drop down values with the
renderer.
|
ComboBoxCell(ListStore<T> store,
LabelProvider<? super T> labelProvider,
ListView<T,?> view)
Creates a combo box cell that renders the input value with the label provider.
|
ComboBoxCell(ListStore<T> store,
LabelProvider<? super T> labelProvider,
ListView<T,?> view,
TriggerFieldCell.TriggerFieldAppearance appearance)
Creates a combo box cell that renders the input value with the label provider.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addBeforeSelectionHandler(<any> handler)
Adds a
BeforeSelectionEvent handler. |
HandlerRegistration |
addSelectionHandler(<any> handler)
Adds a
SelectionEvent handler. |
protected void |
bindStore(ListStore<T> store) |
void |
collapse(Context context,
XElement parent) |
protected void |
collapseIf(NativeEvent event) |
protected void |
collapseIf(NativePreviewEvent pe) |
protected PagingToolBar |
createPagingToolBar(int pageSize) |
protected void |
doForce(Context context,
XElement parent,
T value,
<any> valueUpdater) |
void |
doQuery(Context context,
XElement parent,
<any> updater,
T value,
String query,
boolean force) |
void |
expand(Context context,
XElement parent,
<any> updater,
T value) |
void |
finishEditing(Element parent,
T value,
Object key,
<any> valueUpdater) |
String |
getAllQuery()
Returns the all query.
|
protected T |
getByValue(String value) |
LabelProvider<? super T> |
getLabelProvider()
Returns the label provider.
|
ListView<T,?> |
getListView()
Returns the list view.
|
Loader<?,?> |
getLoader() |
int |
getMaxHeight()
Returns the dropdown list's max height.
|
int |
getMinChars()
Returns the min characters used for autocompete and typeahead.
|
int |
getMinListWidth()
Returns the dropdown list's min width.
|
ComboBoxCell.QueryMode |
getMode() |
int |
getPageSize()
Returns the page size.
|
PagingToolBar |
getPagingToolBar()
Returns the combo's paging tool bar.
|
protected ListLoadConfig |
getParams(String query) |
int |
getQueryDelay()
Returns the length of time in milliseconds to delay between the start of typing and sending the query to filter the
dropdown list.
|
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.
|
protected void |
handleFocusManagerExecute(Context context,
XElement parent,
T value,
<any> updater)
Called by the focusManager's onExecute method.
|
protected void |
init(ListStore<T> store) |
protected void |
initView(ListView<T,?> listView) |
boolean |
isExpanded()
Returns
true if the dropdown is expanded. |
protected boolean |
isFocusedWithTarget(Element parent,
Element target)
Checks if an element can be focused within the current parent.
|
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.
|
boolean |
isUseQueryCache()
Returns the state if the query cache is used or not.
|
protected boolean |
itemMatchesQuery(T item,
String query) |
protected void |
onBlur(Context context,
XElement parent,
T value,
NativeEvent event,
<any> valueUpdater) |
void |
onBrowserEvent(Cell.Context context,
Element parent,
T value,
NativeEvent event,
<any> valueUpdater) |
protected void |
onEmptyResults(Context context,
XElement parent) |
protected void |
onEnterKeyDown(Context context,
Element parent,
T value,
NativeEvent event,
<any> valueUpdater) |
protected void |
onKeyUp(Context context,
Element parent,
T value,
NativeEvent event,
<any> valueUpdater) |
protected void |
onNavigationKey(Context context,
Element parent,
T value,
NativeEvent event,
<any> valueUpdater) |
protected void |
onResultsLoad(Context context,
XElement parent,
<any> updater,
T value) |
protected void |
onSelect(T item) |
protected void |
onStoreUpdate(StoreUpdateEvent<T> event) |
protected void |
onTriggerClick(Context context,
XElement parent,
NativeEvent event,
T value,
<any> updater) |
protected void |
onTypeAhead(XElement parent) |
protected void |
onViewClick(XElement parent,
NativeEvent event,
boolean focus,
boolean takeSelected) |
void |
render(Context context,
T value,
SafeHtmlBuilder sb) |
protected void |
restrict(XElement parent) |
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.
|
protected T |
selectByValue(String value) |
protected void |
selectNext() |
protected void |
selectPrev() |
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 |
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 loader for use with remote queries.
|
void |
setLoadingIndicator(SafeHtml html)
Sets the loading indicator html to be displayed during a load request.
|
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).
|
protected void |
setMode(ComboBoxCell.QueryMode mode)
Sets the query mode.
|
void |
setPageSize(int pageSize)
Sets the page size.
|
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 |
setStore(ListStore<T> store)
Sets the combo's store.
|
void |
setTriggerAction(ComboBoxCell.TriggerAction triggerAction) |
void |
setTypeAhead(boolean typeAhead) |
void |
setTypeAheadDelay(int typeAheadDelay) |
void |
setUseQueryCache(boolean useQueryCache)
Set this to false to disable the last query cache (defaults to true).
|
protected void |
triggerBlur(Context context,
XElement parent,
T value,
<any> valueUpdater) |
clearContext, getAppearance, isEditable, isFinishEditOnEnter, isHideTrigger, isMonitorTab, onClick, onFocus, onKeyDown, onMouseDown, onMouseOut, onMouseOver, onTap, saveContext, setEditable, setFinishEditOnEnter, setHideTrigger, setMonitorTab, setSize, validateBlur
addParseErrorHandler, applyEmptyText, disable, enable, getCursorPos, getEmptyText, getFocusElement, getInputElement, getName, getPropertyEditor, getText, isAllowBlank, isClearValueOnParseError, isSelectOnFocus, onClick, onEmpty, removeEmptyText, resetFocus, select, selectAll, setAllowBlank, setClearValueOnParseError, setCursorPos, setEmptyText, setName, setPropertyEditor, setSelectOnFocus, setText
checkViewData, ensureViewData, getHeight, getWidth, handlesSelection, hasFocus, isDisabled, isReadOnly, onKeyPress, onMouseUp, onValid, redrawOnResize, setHeight, setReadOnly, setSize, setWidth
addCellGestureAdapter, addHandler, createHandlerManager, fireCancellableEvent, fireCancellableEvent, fireEvent, fireEvent, getCellGestureAdapter, getCellGestureAdapterCount, getConsumedEvents, isDisableEvents, onTouch, removeCellGestureAdapter, setDisableEvents
protected String lastQuery
protected Loader<?,?> loader
protected int pageSize
protected PagingToolBar pagingToolBar
protected DelayedTask navKeyTask
protected int navKeyDelay
public ComboBoxCell(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 boxpublic ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, ListView<T,?> view)
store
- the store containing the data that can be selectedlabelProvider
- converts the current model type into a string value to display in the text boxview
- the list viewpublic ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, ListView<T,?> view, 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 boxview
- the list viewappearance
- the appearancepublic ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, <any> 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 downpublic ComboBoxCell(ListStore<T> store, LabelProvider<? super T> labelProvider, <any> 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 appearancepublic HandlerRegistration addBeforeSelectionHandler(<any> handler)
BeforeSelectionEvent
handler. The handler will be passed an instance of
CellBeforeSelectionEvent
which can be cast to.handler
- the handlerpublic HandlerRegistration addSelectionHandler(<any> handler)
SelectionEvent
handler. The handler will be passed an instance of CellSelectionEvent
which
can be cast to.handler
- the handlerpublic void collapse(Context context, XElement parent)
public void doQuery(Context context, XElement parent, <any> updater, T value, String query, boolean force)
public void finishEditing(Element parent, T value, Object key, <any> valueUpdater)
finishEditing
in class TriggerFieldCell<T>
public String getAllQuery()
public LabelProvider<? super T> getLabelProvider()
public Loader<?,?> getLoader()
public int getMaxHeight()
public int getMinChars()
public int getMinListWidth()
public ComboBoxCell.QueryMode getMode()
public int getPageSize()
public PagingToolBar getPagingToolBar()
public int getQueryDelay()
public ComboBoxCell.TriggerAction getTriggerAction()
public int getTypeAheadDelay()
public boolean isUseQueryCache()
public boolean isExpanded()
true
if the dropdown is expanded.public boolean isForceSelection()
public boolean isTypeAhead()
public void onBrowserEvent(Cell.Context context, Element parent, T value, NativeEvent event, <any> valueUpdater)
onBrowserEvent
in class TriggerFieldCell<T>
public void render(Context context, T value, SafeHtmlBuilder sb)
render
in class TriggerFieldCell<T>
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 setForceSelection(boolean forceSelection)
forceSelection
- true to force selectionpublic void setLoader(Loader<?,?> loader)
Sets the loader for use with remote queries.
ListView.onBeforeLoad()
.
setLoadingIndicator(SafeHtml)
or #setLoadingIndicator(String)
are used the list will display the
loading HTML or text while loading in the list.
loader
- the loaderpublic void setLoadingIndicator(SafeHtml html)
Sets the loading indicator html to be displayed during a load request.
setLoader(Loader)
has to be set for this use.
html
- the loading htmlpublic void setMaxHeight(int maxHeight)
maxHeight
- the max hieghtpublic void setMinChars(int minChars)
minChars
- minimum number of characters before activating autocomplete and typeaheadpublic void setMinListWidth(int minListWidth)
minListWidth
- the min widthpublic void setPageSize(int pageSize)
pageSize
- the page sizepublic void setQueryDelay(int queryDelay)
queryDelay
- the query delaypublic void setStore(ListStore<T> store)
store
- the storepublic void setTriggerAction(ComboBoxCell.TriggerAction triggerAction)
public void setTypeAhead(boolean typeAhead)
public void setTypeAheadDelay(int typeAheadDelay)
public void setUseQueryCache(boolean useQueryCache)
Set this to false to disable the last query cache (defaults to true).
When set to false the store gets queried on each expand for the data that should get displayed in the list. If you use a loader, than each time the ComboBox gets expanded, the server gets asked for the data.
You want to do this for example, if you filter the content of this ComboBox against some selection in another field.
useQueryCache
- the useQueryCache to setprotected void collapseIf(NativePreviewEvent pe)
protected void collapseIf(NativeEvent event)
protected PagingToolBar createPagingToolBar(int pageSize)
protected ListLoadConfig getParams(String query)
protected void handleFocusManagerExecute(Context context, XElement parent, T value, <any> updater)
TriggerFieldCell
handleFocusManagerExecute
in class TriggerFieldCell<T>
protected boolean isFocusedWithTarget(Element parent, Element target)
TriggerFieldCell
isFocusedWithTarget
in class TriggerFieldCell<T>
parent
- the parent element of the active celltarget
- the element which may have or receive focusprotected void onBlur(Context context, XElement parent, T value, NativeEvent event, <any> valueUpdater)
onBlur
in class TriggerFieldCell<T>
protected void onEmptyResults(Context context, XElement parent)
protected void onEnterKeyDown(Context context, Element parent, T value, NativeEvent event, <any> valueUpdater)
onEnterKeyDown
in class TriggerFieldCell<T>
protected void onKeyUp(Context context, Element parent, T value, NativeEvent event, <any> valueUpdater)
onKeyUp
in class ValueBaseInputCell<T>
protected void onNavigationKey(Context context, Element parent, T value, NativeEvent event, <any> valueUpdater)
onNavigationKey
in class FieldCell<T>
protected void onResultsLoad(Context context, XElement parent, <any> updater, T value)
protected void onSelect(T item)
protected void onStoreUpdate(StoreUpdateEvent<T> event)
protected void onTriggerClick(Context context, XElement parent, NativeEvent event, T value, <any> updater)
onTriggerClick
in class TriggerFieldCell<T>
protected void onTypeAhead(XElement parent)
protected void onViewClick(XElement parent, NativeEvent event, boolean focus, boolean takeSelected)
protected void restrict(XElement parent)
protected void selectNext()
protected void selectPrev()
protected void setMode(ComboBoxCell.QueryMode mode)
mode
- the query modeprotected void triggerBlur(Context context, XElement parent, T value, <any> valueUpdater)
triggerBlur
in class TriggerFieldCell<T>
Copyright © 2018. All rights reserved.