public class EntitySuggestionFieldImpl<V> extends EntityPickerImpl<V> implements EntitySuggestionField<V>, SecuredActionsHolder
ValuePickerImpl.WebValuePickerActionHandler
SuggestionFieldComponent.ArrowDownEvent, SuggestionFieldComponent.ParametrizedSearchExecutor<E>, SuggestionFieldComponent.SearchExecutor<E>
HasEnterPressHandler.EnterPressEvent
EntityPicker.EntityPickerAction
ValuePicker.FieldValueChangeEvent<V>, ValuePicker.ValuePickerAction
HasValue.ValueChangeEvent<V>
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
HasContextHelp.ContextHelpIconClickEvent
LookupComponent.LookupSelectionChangeEvent<T>, LookupComponent.LookupSelectionChangeNotifier<T>
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 BackgroundTaskHandler<java.util.List<V>> |
handler |
protected java.util.Locale |
locale |
protected java.util.function.Function<? super V,java.lang.String> |
optionStyleProvider |
protected SuggestionFieldComponent.SearchExecutor<V> |
searchExecutor |
metaClass, metadata
actionButtons, actionHandler, actionPropertyChangeListener, actions, actionsPermissions, fieldIconProvider, fieldListenerRegistration, formatter, metadataTools
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITY
internalValue, uiTestIdsSupport, valueBinding
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
NAME
POPUP_AUTO_WIDTH, POPUP_PARENT_WIDTH
TYPE_STRING
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
EntitySuggestionFieldImpl() |
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addFieldValueChangeListener(java.util.function.Consumer<ValuePicker.FieldValueChangeEvent<V>> listener)
Adds a listener that will be fired in case field is editable.
|
void |
addStyleName(java.lang.String styleName)
Adds one or more style names to this component.
|
protected java.util.List<V> |
asyncSearch(SuggestionFieldComponent.SearchExecutor<V> searchExecutor,
java.lang.String searchString,
java.util.Map<java.lang.String,java.lang.Object> params) |
protected void |
cancelSearch() |
protected void |
checkValueType(V value) |
protected JmixPickerField<V> |
createComponent() |
protected java.lang.String |
generateItemStylename(java.lang.Object item) |
java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> |
getArrowDownHandler() |
int |
getAsyncSearchDelayMs() |
JmixSuggestionPickerField<V> |
getComponent() |
java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> |
getEnterPressHandler() |
java.lang.String |
getInputPrompt() |
int |
getMinSearchStringLength() |
java.util.function.Function<? super V,java.lang.String> |
getOptionStyleProvider() |
java.lang.String |
getPopupWidth() |
SuggestionFieldComponent.SearchExecutor<V> |
getSearchExecutor() |
protected BackgroundTask<java.lang.Long,java.util.List<V>> |
getSearchSuggestionsTask(java.lang.String query) |
int |
getSuggestionsLimit() |
protected void |
handleSearchResult(java.util.List<V> results) |
protected void |
initComponent(JmixPickerField<V> component) |
boolean |
isFieldEditable() |
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.
|
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 |
setFieldEditable(boolean editable)
Sets whether a user can input the value manually.
|
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.
|
void |
setMinSearchStringLength(int minSearchStringLength)
Sets min string length which is required to perform suggestions search.
|
void |
setOptionStyleProvider(java.util.function.Function<? super V,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<V> 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 |
showSuggestions(java.util.List<V> suggestions)
Show passed suggestions in popup.
|
protected void |
showSuggestions(java.util.List<V> suggestions,
boolean userOriginated) |
getLookupSelectedItems, getMetaClass, setLookupSelectHandler, setMetaClass, setMetadata, setValue, setValueFromUser
actionPropertyChanged, addAction, addAction, afterPropertiesSet, applyDefaultValueFormat, commit, discard, focus, formatValue, generateOptionIcon, getAction, getActions, getActionsPermissions, getFieldIconProvider, getFormatter, getTabIndex, isBuffered, isModified, onFieldValueChange, refreshActionsState, removeAction, removeAction, removeAllActions, setBuffered, setButtonIcon, setDebugId, setEditableToComponent, setFieldIconProvider, setFormatter, setFrame, setMetadataTools, setTabIndex, setUiComponentProperties, setupButtonAction
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validate
addValueChangeListener, componentValueChanged, convertToModel, convertToPresentation, fieldValueEquals, getValue, getValueSource, setUiTestId, setUiTestIdsSupport, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnected
addAttachListener, addDetachListener, assignDebugId, attached, detached, getAlignment, getCaption, 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, setDescription, setDescriptionAsHtml, setEnabled, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
of
getMetaClass, setMetaClass
getFieldIconProvider, setFieldIconProvider
getValueSource, setValueSource
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValue
isEditable, isEditableWithParent, setEditable
getFrame, setFrame
getAlignment, 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, withUnwrappedComposition
isValid, isValidateOnCommit, validate
getIcon, setIcon, setIconFromSet
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
isCaptionAsHtml, setCaptionAsHtml
isDescriptionAsHtml, setDescriptionAsHtml
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
addValidator, addValidators, getValidators, removeValidator
getRequiredMessage, isRequired, setRequired, setRequiredMessage
getFormatter, setFormatter
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActions
commit, discard, isBuffered, isModified, setBuffered
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
setValueFromUser
getLookupSelectedItems, setLookupSelectHandler
getActionsPermissions
protected BackgroundWorker backgroundWorker
protected BackgroundTaskHandler<java.util.List<V>> handler
protected SuggestionFieldComponent.SearchExecutor<V> searchExecutor
protected java.util.function.Function<? super V,java.lang.String> optionStyleProvider
protected java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> enterPressHandler
protected java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> arrowDownHandler
protected java.util.Locale locale
protected JmixPickerField<V> createComponent()
createComponent
in class EntityPickerImpl<V>
public JmixSuggestionPickerField<V> getComponent()
getComponent
in interface Component.Wrapper
getComponent
in class AbstractComponent<JmixPickerField<V>>
@Autowired public void setBackgroundWorker(BackgroundWorker backgroundWorker)
protected void initComponent(JmixPickerField<V> component)
initComponent
in class ValuePickerImpl<V>
@Autowired public void setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication)
protected void cancelSearch()
protected void searchSuggestions(java.lang.String query)
@Nullable protected BackgroundTask<java.lang.Long,java.util.List<V>> getSearchSuggestionsTask(java.lang.String query)
protected java.util.List<V> asyncSearch(SuggestionFieldComponent.SearchExecutor<V> searchExecutor, java.lang.String searchString, java.util.Map<java.lang.String,java.lang.Object> params) throws java.lang.Exception
java.lang.Exception
protected void handleSearchResult(java.util.List<V> results)
@Nullable protected java.lang.String generateItemStylename(java.lang.Object item)
public io.jmix.core.common.event.Subscription addFieldValueChangeListener(java.util.function.Consumer<ValuePicker.FieldValueChangeEvent<V>> listener)
ValuePicker
addFieldValueChangeListener
in interface ValuePicker<V>
addFieldValueChangeListener
in class ValuePickerImpl<V>
listener
- a listener to addSubscription
objectValuePicker.setFieldEditable(boolean)
public boolean isFieldEditable()
isFieldEditable
in interface ValuePicker<V>
isFieldEditable
in class ValuePickerImpl<V>
public void setFieldEditable(boolean editable)
ValuePicker
false
by default.
Doesn't set entered value to the model. To handle user input,
the ValuePicker.FieldValueChangeEvent
listener must be used.setFieldEditable
in interface ValuePicker<V>
setFieldEditable
in class ValuePickerImpl<V>
editable
- true
to enable manual input, false
otherwiseValuePicker.addFieldValueChangeListener(Consumer)
public int getAsyncSearchDelayMs()
getAsyncSearchDelayMs
in interface SuggestionFieldComponent<V,V>
public void setAsyncSearchDelayMs(int asyncSearchDelayMs)
SuggestionFieldComponent
setAsyncSearchDelayMs
in interface SuggestionFieldComponent<V,V>
asyncSearchDelayMs
- delay in ms@Nullable public SuggestionFieldComponent.SearchExecutor<V> getSearchExecutor()
getSearchExecutor
in interface SuggestionFieldComponent<V,V>
SuggestionFieldComponent.SearchExecutor
which performs searchpublic void setSearchExecutor(@Nullable SuggestionFieldComponent.SearchExecutor<V> searchExecutor)
SuggestionFieldComponent
SuggestionFieldComponent.SearchExecutor
which performs search.setSearchExecutor
in interface EntitySuggestionField<V>
setSearchExecutor
in interface SuggestionFieldComponent<V,V>
searchExecutor
- SearchExecutor instance@Nullable public java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> getEnterPressHandler()
getEnterPressHandler
in interface HasEnterPressHandler
public void setEnterPressHandler(@Nullable java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> handler)
HasEnterPressHandler
setEnterPressHandler
in interface HasEnterPressHandler
handler
- an ENTER press handler to set@Nullable public java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> getArrowDownHandler()
getArrowDownHandler
in interface SuggestionFieldComponent<V,V>
public void setArrowDownHandler(@Nullable java.util.function.Consumer<SuggestionFieldComponent.ArrowDownEvent> handler)
SuggestionFieldComponent
setArrowDownHandler
in interface SuggestionFieldComponent<V,V>
handler
- an ARROW_DOWN press handler to setpublic int getMinSearchStringLength()
getMinSearchStringLength
in interface SuggestionFieldComponent<V,V>
public void setMinSearchStringLength(int minSearchStringLength)
SuggestionFieldComponent
setMinSearchStringLength
in interface SuggestionFieldComponent<V,V>
minSearchStringLength
- required string length to perform searchpublic int getSuggestionsLimit()
getSuggestionsLimit
in interface SuggestionFieldComponent<V,V>
public void setSuggestionsLimit(int suggestionsLimit)
SuggestionFieldComponent
setSuggestionsLimit
in interface SuggestionFieldComponent<V,V>
suggestionsLimit
- integer limit valuepublic void showSuggestions(java.util.List<V> suggestions)
SuggestionFieldComponent
showSuggestions
in interface SuggestionFieldComponent<V,V>
suggestions
- suggestions to showprotected void showSuggestions(java.util.List<V> suggestions, boolean userOriginated)
public void setPopupWidth(java.lang.String popupWidth)
SuggestionFieldComponent
width
to the component popup. There are two predefined settings available:
SuggestionFieldComponent.POPUP_AUTO_WIDTH
and SuggestionFieldComponent.POPUP_PARENT_WIDTH
.setPopupWidth
in interface SuggestionFieldComponent<V,V>
popupWidth
- width of the component popuppublic java.lang.String getPopupWidth()
getPopupWidth
in interface SuggestionFieldComponent<V,V>
@Nullable public java.lang.String getInputPrompt()
getInputPrompt
in interface HasInputPrompt
public void setInputPrompt(@Nullable java.lang.String inputPrompt)
HasInputPrompt
setInputPrompt
in interface HasInputPrompt
inputPrompt
- input promptpublic void setOptionStyleProvider(@Nullable java.util.function.Function<? super V,java.lang.String> optionStyleProvider)
HasOptionStyleProvider
setOptionStyleProvider
in interface HasOptionStyleProvider<V>
optionStyleProvider
- style provider@Nullable public java.util.function.Function<? super V,java.lang.String> getOptionStyleProvider()
getOptionStyleProvider
in interface HasOptionStyleProvider<V>
public void setStyleName(@Nullable java.lang.String name)
Component
setStyleName
in interface Component
setStyleName
in class AbstractComponent<JmixPickerField<V>>
name
- one or more style names separated by space.public void addStyleName(java.lang.String styleName)
Component
addStyleName
in interface Component
addStyleName
in class AbstractComponent<JmixPickerField<V>>
styleName
- one or more style names separated by space.public void removeStyleName(java.lang.String styleName)
Component
removeStyleName
in interface Component
removeStyleName
in class AbstractComponent<JmixPickerField<V>>
styleName
- one or more style names separated by space.protected void checkValueType(@Nullable V value)
checkValueType
in class EntityPickerImpl<V>
protected void onEnterPressHandler(java.lang.String currentSearchString)
protected void onArrowDownHandler(java.lang.String currentSearchString)