V - value type - collection or notI - item typeT - component typepublic abstract class AbstractSuggestionField<V,I,T extends JmixAbstractSuggestionField<V,I>> extends AbstractField<T,V,V> implements SuggestionFieldComponent<V,I>, org.springframework.beans.factory.InitializingBean
SuggestionFieldComponent.ArrowDownEvent, SuggestionFieldComponent.ParametrizedSearchExecutor<E>, SuggestionFieldComponent.SearchExecutor<E>HasValue.ValueChangeEvent<V>Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.WrapperHasContextHelp.ContextHelpIconClickEventHasEnterPressHandler.EnterPressEvent| Modifier and Type | Field and Description |
|---|---|
protected java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> |
arrowDownHandler |
protected BackgroundWorker |
backgroundWorker |
protected java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> |
enterPressHandler |
protected Formatter<? super I> |
formatter |
protected BackgroundTaskHandler<java.util.List<I>> |
handler |
protected java.util.Locale |
locale |
protected io.jmix.core.MetadataTools |
metadataTools |
protected java.util.function.Function<? super I,java.lang.String> |
optionStyleProvider |
protected SuggestionFieldComponent.SearchExecutor<I> |
searchExecutor |
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITYinternalValue, uiTestIdsSupport, valueBindingalignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentPOPUP_AUTO_WIDTH, POPUP_PARENT_WIDTHAUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE| Constructor and Description |
|---|
AbstractSuggestionField() |
| Modifier and Type | Method and Description |
|---|---|
void |
addStyleName(java.lang.String styleName)
Adds one or more style names to this component.
|
void |
afterPropertiesSet() |
protected java.lang.String |
applyDefaultValueFormat(I item) |
protected java.util.List<I> |
asyncSearch(SuggestionFieldComponent.SearchExecutor<I> searchExecutor,
java.lang.String searchString,
java.util.Map<java.lang.String,java.lang.Object> params) |
protected void |
cancelSearch() |
protected java.lang.String |
convertToTextView(I item) |
void |
focus()
Sets focus to this component
|
protected java.lang.String |
generateItemStylename(java.lang.Object item) |
java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> |
getArrowDownHandler() |
int |
getAsyncSearchDelayMs() |
java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> |
getEnterPressHandler() |
Formatter<I> |
getFormatter() |
java.lang.String |
getInputPrompt() |
int |
getMinSearchStringLength() |
java.util.function.Function<? super I,java.lang.String> |
getOptionStyleProvider() |
java.lang.String |
getPopupWidth() |
SuggestionFieldComponent.SearchExecutor<I> |
getSearchExecutor() |
protected BackgroundTask<java.lang.Long,java.util.List<I>> |
getSearchSuggestionsTask(java.lang.String query) |
int |
getSuggestionsLimit() |
int |
getTabIndex()
Gets the tabulator index of the
HasTabIndex component. |
protected void |
handleSearchResult(java.util.List<I> results) |
protected void |
initComponent(T component) |
protected void |
onArrowDownHandler(java.lang.String currentSearchString) |
protected void |
onEnterPressHandler(java.lang.String currentSearchString) |
void |
removeStyleName(java.lang.String styleName)
Removes one or more style names from component.
|
protected void |
searchSuggestions(java.lang.String query) |
void |
setArrowDownHandler(java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> handler)
Sets an ARROW_DOWN press handler.
|
void |
setAsyncSearchDelayMs(int asyncSearchDelayMs)
Sets delay between the last key press action and async search.
|
protected void |
setBackgroundWorker(BackgroundWorker backgroundWorker) |
void |
setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication) |
void |
setEnterPressHandler(java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> handler)
Sets an ENTER press handler.
|
void |
setFormatter(Formatter<? super I> formatter) |
void |
setInputPrompt(java.lang.String inputPrompt)
Sets the input prompt - a textual prompt that is displayed when the field
would otherwise be empty, to prompt the user for input.
|
protected void |
setMetadataTools(io.jmix.core.MetadataTools metadataTools) |
void |
setMinSearchStringLength(int minSearchStringLength)
Sets min string length which is required to perform suggestions search.
|
void |
setOptionStyleProvider(java.util.function.Function<? super I,java.lang.String> optionStyleProvider)
Sets the style provider that is used to produce custom class names for option items.
|
void |
setPopupWidth(java.lang.String popupWidth)
Sets the given
width to the component popup. |
void |
setSearchExecutor(SuggestionFieldComponent.SearchExecutor<I> searchExecutor)
Sets
SuggestionFieldComponent.SearchExecutor which performs search. |
void |
setStyleName(java.lang.String name)
Sets one or more style names of the component, replacing any
previous styles.
|
void |
setSuggestionsLimit(int suggestionsLimit)
Sets limit of suggestions which will be shown.
|
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
void |
showSuggestions(java.util.List<I> suggestions)
Show passed suggestions in popup.
|
protected void |
showSuggestions(java.util.List<I> suggestions,
boolean userOriginated) |
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getDefaultRequiredMessage, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setEditableToComponent, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validateaddValueChangeListener, commit, componentValueChanged, convertToModel, convertToPresentation, discard, fieldValueEquals, getValue, getValueSource, isBuffered, isModified, setBuffered, setUiTestId, setUiTestIdsSupport, setValue, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnectedaddAttachListener, addDetachListener, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetValueSource, setValueSourceaddValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValueisEditable, isEditableWithParent, setEditablegetFrame, setFramegetAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionisValid, isValidateOnCommit, validategetIcon, setIcon, setIconFromSetgetContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledisCaptionAsHtml, setCaptionAsHtmlgetCaption, setCaptiongetDescription, setDescriptionisDescriptionAsHtml, setDescriptionAsHtmlisHtmlSanitizerEnabled, setHtmlSanitizerEnabledaddValidator, addValidators, getValidators, removeValidatorgetRequiredMessage, isRequired, setRequired, setRequiredMessageisFocusable, setFocusableprotected BackgroundTaskHandler<java.util.List<I>> handler
protected SuggestionFieldComponent.SearchExecutor<I> searchExecutor
protected BackgroundWorker backgroundWorker
protected io.jmix.core.MetadataTools metadataTools
protected java.util.Locale locale
protected java.util.function.Function<? super I,java.lang.String> optionStyleProvider
protected java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> enterPressHandler
protected java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> arrowDownHandler
@Autowired protected void setBackgroundWorker(BackgroundWorker backgroundWorker)
@Autowired public void setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication)
@Autowired protected void setMetadataTools(io.jmix.core.MetadataTools metadataTools)
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionprotected void initComponent(T component)
public void setSearchExecutor(@Nullable
SuggestionFieldComponent.SearchExecutor<I> searchExecutor)
SuggestionFieldComponentSuggestionFieldComponent.SearchExecutor which performs search.setSearchExecutor in interface SuggestionFieldComponent<V,I>searchExecutor - SearchExecutor instance@Nullable public SuggestionFieldComponent.SearchExecutor<I> getSearchExecutor()
getSearchExecutor in interface SuggestionFieldComponent<V,I>SuggestionFieldComponent.SearchExecutor which performs searchpublic int getMinSearchStringLength()
getMinSearchStringLength in interface SuggestionFieldComponent<V,I>public void setMinSearchStringLength(int minSearchStringLength)
SuggestionFieldComponentsetMinSearchStringLength in interface SuggestionFieldComponent<V,I>minSearchStringLength - required string length to perform searchpublic int getSuggestionsLimit()
getSuggestionsLimit in interface SuggestionFieldComponent<V,I>public void setSuggestionsLimit(int suggestionsLimit)
SuggestionFieldComponentsetSuggestionsLimit in interface SuggestionFieldComponent<V,I>suggestionsLimit - integer limit valuepublic int getAsyncSearchDelayMs()
getAsyncSearchDelayMs in interface SuggestionFieldComponent<V,I>public void setAsyncSearchDelayMs(int asyncSearchDelayMs)
SuggestionFieldComponentsetAsyncSearchDelayMs in interface SuggestionFieldComponent<V,I>asyncSearchDelayMs - delay in ms@Nullable public java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> getEnterPressHandler()
getEnterPressHandler in interface HasEnterPressHandlerpublic void setEnterPressHandler(@Nullable
java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> handler)
HasEnterPressHandlersetEnterPressHandler in interface HasEnterPressHandlerhandler - an ENTER press handler to set@Nullable public java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> getArrowDownHandler()
getArrowDownHandler in interface SuggestionFieldComponent<V,I>public void setArrowDownHandler(java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> handler)
SuggestionFieldComponentsetArrowDownHandler in interface SuggestionFieldComponent<V,I>handler - an ARROW_DOWN press handler to setpublic void showSuggestions(java.util.List<I> suggestions)
SuggestionFieldComponentshowSuggestions in interface SuggestionFieldComponent<V,I>suggestions - suggestions to showpublic void focus()
Component.Focusablefocus in interface Component.Focusablepublic int getTabIndex()
Component.FocusableHasTabIndex component.getTabIndex in interface Component.FocusableHasTabIndex componentpublic void setTabIndex(int tabIndex)
Component.FocusableFocusable component.
The tab index property is used to specify the order in which the
fields are focused when the user presses the Tab key. Components with
a defined tab index are focused sequentially first, and then the
components with no tab index.setTabIndex in interface Component.FocusabletabIndex - tab index@Nullable public java.lang.String getInputPrompt()
getInputPrompt in interface HasInputPromptpublic void setInputPrompt(@Nullable
java.lang.String inputPrompt)
HasInputPromptsetInputPrompt in interface HasInputPromptinputPrompt - input promptpublic void setStyleName(@Nullable
java.lang.String name)
ComponentsetStyleName in interface ComponentsetStyleName in class AbstractComponent<T extends JmixAbstractSuggestionField<V,I>>name - one or more style names separated by space.public void addStyleName(java.lang.String styleName)
ComponentaddStyleName in interface ComponentaddStyleName in class AbstractComponent<T extends JmixAbstractSuggestionField<V,I>>styleName - one or more style names separated by space.public void removeStyleName(java.lang.String styleName)
ComponentremoveStyleName in interface ComponentremoveStyleName in class AbstractComponent<T extends JmixAbstractSuggestionField<V,I>>styleName - one or more style names separated by space.public void setPopupWidth(java.lang.String popupWidth)
SuggestionFieldComponentwidth to the component popup. There are two predefined settings available:
SuggestionFieldComponent.POPUP_AUTO_WIDTH and SuggestionFieldComponent.POPUP_PARENT_WIDTH.setPopupWidth in interface SuggestionFieldComponent<V,I>popupWidth - width of the component popuppublic java.lang.String getPopupWidth()
getPopupWidth in interface SuggestionFieldComponent<V,I>public void setOptionStyleProvider(@Nullable
java.util.function.Function<? super I,java.lang.String> optionStyleProvider)
HasOptionStyleProvidersetOptionStyleProvider in interface HasOptionStyleProvider<I>optionStyleProvider - style provider@Nullable public java.util.function.Function<? super I,java.lang.String> getOptionStyleProvider()
getOptionStyleProvider in interface HasOptionStyleProvider<I>@Nullable public Formatter<I> getFormatter()
getFormatter in interface HasFormatter<I>public void setFormatter(@Nullable
Formatter<? super I> formatter)
setFormatter in interface HasFormatter<I>@Nullable protected java.lang.String generateItemStylename(java.lang.Object item)
@Nullable protected BackgroundTask<java.lang.Long,java.util.List<I>> getSearchSuggestionsTask(java.lang.String query)
protected java.util.List<I> asyncSearch(SuggestionFieldComponent.SearchExecutor<I> searchExecutor, java.lang.String searchString, java.util.Map<java.lang.String,java.lang.Object> params) throws java.lang.Exception
java.lang.Exceptionprotected void handleSearchResult(java.util.List<I> results)
protected void showSuggestions(java.util.List<I> suggestions, boolean userOriginated)
protected void cancelSearch()
protected void searchSuggestions(java.lang.String query)
protected java.lang.String convertToTextView(@Nullable
I item)
protected java.lang.String applyDefaultValueFormat(I item)
protected void onEnterPressHandler(java.lang.String currentSearchString)
protected void onArrowDownHandler(java.lang.String currentSearchString)