Package io.jmix.ui.component.impl
Class EntityComboBoxImpl<V>
java.lang.Object
io.jmix.ui.component.impl.AbstractComponent<T>
io.jmix.ui.component.impl.AbstractValueComponent<T,P,V>
io.jmix.ui.component.impl.AbstractField<JmixPickerField<V>,V,V>
io.jmix.ui.component.impl.ValuePickerImpl<V>
io.jmix.ui.component.impl.EntityPickerImpl<V>
io.jmix.ui.component.impl.EntityComboBoxImpl<V>
- All Implemented Interfaces:
ActionsHolder,AttachNotifier,Buffered,ComboBox<V>,Component,Component.BelongToFrame,Component.Editable,Component.Focusable,Component.HasCaption,Component.HasDescription,Component.HasIcon,Component.HasXmlDescriptor,Component.Wrapper,HasValueSource<V>,EntityComboBox<V>,EntityPicker<V>,Field<V>,HasContextHelp,HasDebugId,HasEnterPressHandler,HasFilterMode,HasFormatter<V>,HasHtmlCaption,HasHtmlDescription,HasHtmlSanitizer,HasInputPrompt,HasOptionCaptionProvider<V>,HasOptionIconProvider<V>,HasOptionImageProvider<V>,HasOptionStyleProvider<V>,HasSubParts,HasValidator<V>,HasValue<V>,LookupComponent<V>,OptionsField<V,,V> Requirable,SecuredActionsHolder,SupportsOptionsContainer<V>,SupportsUserAction<V>,Validatable,ValuePicker<V>,org.springframework.beans.factory.InitializingBean
public class EntityComboBoxImpl<V>
extends EntityPickerImpl<V>
implements EntityComboBox<V>, SecuredActionsHolder
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.ui.component.impl.ValuePickerImpl
ValuePickerImpl.WebValuePickerActionHandlerNested classes/interfaces inherited from interface io.jmix.ui.component.ComboBox
ComboBox.OptionsCaptionFilteringContextNested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.EntityPicker
EntityPicker.EntityPickerActionNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested classes/interfaces inherited from interface io.jmix.ui.component.HasEnterPressHandler
HasEnterPressHandler.EnterPressEventNested classes/interfaces inherited from interface io.jmix.ui.component.HasFilterMode
HasFilterMode.FilterModeNested classes/interfaces inherited from interface io.jmix.ui.component.HasValue
HasValue.ValueChangeEvent<V>Nested classes/interfaces inherited from interface io.jmix.ui.component.LookupComponent
LookupComponent.LookupSelectionChangeEvent<T>, LookupComponent.LookupSelectionChangeNotifier<T>Nested classes/interfaces inherited from interface io.jmix.ui.component.ValuePicker
ValuePicker.FieldValueChangeEvent<V>, ValuePicker.ValuePickerAction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Consumer<HasEnterPressHandler.EnterPressEvent>protected HasFilterMode.FilterModeprotected IconResolverprotected booleanprotected OptionsBinding<V>protected Predicate<ComboBox.OptionsCaptionFilteringContext>Fields inherited from class io.jmix.ui.component.impl.EntityPickerImpl
metaClass, metadataFields inherited from class io.jmix.ui.component.impl.ValuePickerImpl
actionButtons, actionHandler, actionPropertyChangeListener, actions, actionsPermissions, fieldIconProvider, fieldListenerRegistration, formatter, metadataToolsFields inherited from class io.jmix.ui.component.impl.AbstractField
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITYFields inherited from class io.jmix.ui.component.impl.AbstractValueComponent
internalValue, uiTestIdsSupport, valueBindingFields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentFields inherited from interface io.jmix.ui.component.ComboBox
TYPE_STRINGFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZEFields inherited from interface io.jmix.ui.component.EntityComboBox
NAMEFields inherited from interface io.jmix.ui.component.EntityPicker
NAMEFields inherited from interface io.jmix.ui.component.ValuePicker
NAME, TYPE_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a listener that will be fired in case field is editable.voidprotected voidcheckValueType(V value) protected voidcomponentValueChanged(V prevComponentValue, V newComponentValue, boolean isUserOriginated) protected JmixPickerField<V>protected booleanfilterItemTest(String itemCaption, String filterText) protected StringgenerateDefaultItemCaption(V item) protected StringgenerateItemCaption(V item) protected StringgenerateItemStylename(V item) protected com.vaadin.server.ResourcegenerateOptionIcon(V item) protected com.vaadin.server.ResourcegenerateOptionImage(V item) intReturns the suggestion popup's width as a string.protected voidhandleClearShortcut(Object sender, Object target) protected voidinitComponent(JmixPickerField<V> component) booleanbooleanbooleanbooleanprotected voidonEnterPressed(String text) voidsetAutomaticPopupOnFocus(boolean automaticPopupOnFocus) When enabled popup automatically opens on focus.voidSets an ENTER press handler.voidsetFieldEditable(boolean editable) Sets whether a user can input the value manually.voidsetFieldIconProvider(Function<? super V, String> iconProvider) Sets a function that provides an icon for the field.voidsetFilterMode(HasFilterMode.FilterMode filterMode) Sets filter mode for the dropdown list in the field.voidsetFormatter(Formatter<? super V> formatter) voidsetIconResolver(IconResolver iconResolver) voidsetInputPrompt(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 voidsetItemsToPresentation(Stream<V> options) voidsetNullOptionVisible(boolean nullOptionVisible) Sets visibility for first null element in suggestion popup.voidsetNullSelectionCaption(String nullOption) Sets the null selection caption.voidsetOptionCaptionProvider(Function<? super V, String> optionCaptionProvider) Sets function that provides caption for option items.voidsetOptionIconProvider(Function<? super V, String> optionIconProvider) Sets a function that provides an icon for options.voidsetOptionImageProvider(Function<? super V, Resource> optionImageProvider) Sets a function that provides option images.voidsetOptions(Options<V> options) Sets options for UI component.voidSets a predicate that tests whether an item with the given caption matches to the given search string.voidsetOptionsContainer(CollectionContainer<V> container) Sets options from the passedCollectionContainer.voidsetOptionStyleProvider(Function<? super V, String> optionStyleProvider) Sets the style provider that is used to produce custom class names for option items.voidsetPageLength(int pageLength) Sets the page length for the suggestion popup.voidsetPopupWidth(String width) Sets the suggestion popup's width as a string.voidsetTextInputAllowed(boolean textInputAllowed) Sets whether it is possible to input text into the field or whether the field area of the component is just used to show what is selected.Methods inherited from class io.jmix.ui.component.impl.EntityPickerImpl
getLookupSelectedItems, getMetaClass, setLookupSelectHandler, setMetaClass, setMetadata, setValue, setValueFromUserMethods inherited from class io.jmix.ui.component.impl.ValuePickerImpl
actionPropertyChanged, addAction, addAction, applyDefaultValueFormat, commit, discard, focus, formatValue, getAction, getActions, getActionsPermissions, getInputPrompt, getTabIndex, isBuffered, isModified, onFieldValueChange, refreshActionsState, removeAction, removeAction, removeAllActions, setBuffered, setButtonIcon, setDebugId, setEditableToComponent, setFrame, setMetadataTools, setTabIndex, setUiComponentProperties, setupButtonActionMethods inherited from class io.jmix.ui.component.impl.AbstractField
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getDefaultRequiredMessage, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validateMethods inherited from class io.jmix.ui.component.impl.AbstractValueComponent
addValueChangeListener, convertToModel, convertToPresentation, fieldValueEquals, getValue, getValueSource, setUiTestId, setUiTestIdsSupport, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnectedMethods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, addStyleName, 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, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDescription, setDescriptionAsHtml, setEnabled, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.ui.component.ActionsHolder
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActionsMethods inherited from interface io.jmix.ui.component.Buffered
commit, discard, isBuffered, isModified, setBufferedMethods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.Editable
isEditable, isEditableWithParent, setEditableMethods inherited from interface io.jmix.ui.component.Component.Focusable
focus, getTabIndex, isFocusable, setFocusable, setTabIndexMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.EntityPicker
getMetaClass, setMetaClassMethods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledMethods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabledMethods inherited from interface io.jmix.ui.component.HasInputPrompt
getInputPromptMethods inherited from interface io.jmix.ui.component.HasValidator
addValidator, addValidators, getValidators, removeValidatorMethods inherited from interface io.jmix.ui.component.HasValue
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValueMethods inherited from interface io.jmix.ui.component.data.HasValueSource
getValueSource, setValueSourceMethods inherited from interface io.jmix.ui.component.LookupComponent
getLookupSelectedItems, setLookupSelectHandlerMethods inherited from interface io.jmix.ui.component.OptionsField
setOptionsEnum, setOptionsList, setOptionsMapMethods inherited from interface io.jmix.ui.component.Requirable
getRequiredMessage, isRequired, setRequired, setRequiredMessageMethods inherited from interface io.jmix.ui.component.SecuredActionsHolder
getActionsPermissionsMethods inherited from interface io.jmix.ui.component.SupportsUserAction
setValueFromUserMethods inherited from interface io.jmix.ui.component.Validatable
isValid, isValidateOnCommit, validate
-
Field Details
-
nullOptionVisible
protected boolean nullOptionVisible -
filterMode
-
optionsCaptionFilter
-
enterPressHandler
-
optionCaptionProvider
-
optionIconProvider
-
optionImageProvider
-
optionStyleProvider
-
optionsBinding
-
iconResolver
-
-
Constructor Details
-
EntityComboBoxImpl
public EntityComboBoxImpl()
-
-
Method Details
-
createComponent
- Overrides:
createComponentin classEntityPickerImpl<V>
-
getComponent
- Specified by:
getComponentin interfaceComponent.Wrapper- Overrides:
getComponentin classAbstractComponent<JmixPickerField<V>>
-
setIconResolver
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classValuePickerImpl<V>
-
initComponent
- Overrides:
initComponentin classValuePickerImpl<V>
-
handleClearShortcut
-
generateDefaultItemCaption
-
generateItemCaption
-
generateItemStylename
-
getNullSelectionCaption
- Specified by:
getNullSelectionCaptionin interfaceComboBox<V>- Returns:
- the null selection caption, not
null
-
setNullSelectionCaption
Description copied from interface:ComboBoxSets the null selection caption.The empty string
""is the default null selection caption.If null selection is allowed then the null item will be shown with the given caption.
- Specified by:
setNullSelectionCaptionin interfaceComboBox<V>- Parameters:
nullOption- the caption to set, notnull
-
getFilterMode
- Specified by:
getFilterModein interfaceHasFilterMode- Returns:
- filter mode for the dropdown list in the field
-
setFilterMode
Description copied from interface:HasFilterModeSets filter mode for the dropdown list in the field.- Specified by:
setFilterModein interfaceHasFilterMode- Parameters:
filterMode- filter mode to set
-
addFieldValueChangeListener
public Subscription addFieldValueChangeListener(Consumer<ValuePicker.FieldValueChangeEvent<V>> listener) Description copied from interface:ValuePickerAdds a listener that will be fired in case field is editable.- Specified by:
addFieldValueChangeListenerin interfaceValuePicker<V>- Overrides:
addFieldValueChangeListenerin classValuePickerImpl<V>- Parameters:
listener- a listener to add- Returns:
- a
Subscriptionobject - See Also:
-
isFieldEditable
public boolean isFieldEditable()- Specified by:
isFieldEditablein interfaceValuePicker<V>- Overrides:
isFieldEditablein classValuePickerImpl<V>- Returns:
- whether a user can input the value manually
-
setFieldEditable
public void setFieldEditable(boolean editable) Description copied from interface:ValuePickerSets whether a user can input the value manually.falseby default. Doesn't set entered value to the model. To handle user input, theValuePicker.FieldValueChangeEventlistener must be used.- Specified by:
setFieldEditablein interfaceValuePicker<V>- Overrides:
setFieldEditablein classValuePickerImpl<V>- Parameters:
editable-trueto enable manual input,falseotherwise- See Also:
-
getFormatter
- Specified by:
getFormatterin interfaceHasFormatter<V>- Overrides:
getFormatterin classValuePickerImpl<V>
-
setFormatter
- Specified by:
setFormatterin interfaceHasFormatter<V>- Overrides:
setFormatterin classValuePickerImpl<V>
-
isTextInputAllowed
public boolean isTextInputAllowed()- Specified by:
isTextInputAllowedin interfaceComboBox<V>- Returns:
- true if text input allowed
-
setTextInputAllowed
public void setTextInputAllowed(boolean textInputAllowed) Description copied from interface:ComboBoxSets whether it is possible to input text into the field or whether the field area of the component is just used to show what is selected.- Specified by:
setTextInputAllowedin interfaceComboBox<V>
-
setAutomaticPopupOnFocus
public void setAutomaticPopupOnFocus(boolean automaticPopupOnFocus) Description copied from interface:ComboBoxWhen enabled popup automatically opens on focus.- Specified by:
setAutomaticPopupOnFocusin interfaceComboBox<V>
-
isAutomaticPopupOnFocus
public boolean isAutomaticPopupOnFocus()- Specified by:
isAutomaticPopupOnFocusin interfaceComboBox<V>- Returns:
- whether popup is automatically shows on focus.
-
getEnterPressHandler
- Specified by:
getEnterPressHandlerin interfaceHasEnterPressHandler- Returns:
- an ENTER press handler
-
setEnterPressHandler
Description copied from interface:HasEnterPressHandlerSets an ENTER press handler.- Specified by:
setEnterPressHandlerin interfaceHasEnterPressHandler- Parameters:
handler- an ENTER press handler to set
-
onEnterPressed
-
getPageLength
public int getPageLength()- Specified by:
getPageLengthin interfaceComboBox<V>- Returns:
- the page length of the suggestion popup.
-
setPageLength
public void setPageLength(int pageLength) Description copied from interface:ComboBoxSets the page length for the suggestion popup. Setting the page length to 0 will disable suggestion popup paging (all items visible).- Specified by:
setPageLengthin interfaceComboBox<V>- Parameters:
pageLength- the pageLength to set
-
isNullOptionVisible
public boolean isNullOptionVisible()- Specified by:
isNullOptionVisiblein interfaceComboBox<V>- Returns:
- true if first null element is visible.
-
setNullOptionVisible
public void setNullOptionVisible(boolean nullOptionVisible) Description copied from interface:ComboBoxSets visibility for first null element in suggestion popup.- Specified by:
setNullOptionVisiblein interfaceComboBox<V>
-
setOptionIconProvider
Description copied from interface:HasOptionIconProviderSets a function that provides an icon for options.- Specified by:
setOptionIconProviderin interfaceHasOptionIconProvider<V>- Parameters:
optionIconProvider- icon provider for options to set
-
getOptionIconProvider
- Specified by:
getOptionIconProviderin interfaceHasOptionIconProvider<V>- Returns:
- options icon provider or
nullif not defined
-
generateOptionIcon
- Overrides:
generateOptionIconin classValuePickerImpl<V>
-
getFieldIconProvider
- Specified by:
getFieldIconProviderin interfaceValuePicker<V>- Overrides:
getFieldIconProviderin classValuePickerImpl<V>- Returns:
- an icon provider or {code null} if not set
-
setFieldIconProvider
Description copied from interface:ValuePickerSets a function that provides an icon for the field.- Specified by:
setFieldIconProviderin interfaceValuePicker<V>- Overrides:
setFieldIconProviderin classValuePickerImpl<V>- Parameters:
iconProvider- icon provider to set
-
setOptionImageProvider
Description copied from interface:HasOptionImageProviderSets a function that provides option images.- Specified by:
setOptionImageProviderin interfaceHasOptionImageProvider<V>- Parameters:
optionImageProvider- options image provider- See Also:
-
getOptionImageProvider
- Specified by:
getOptionImageProviderin interfaceHasOptionImageProvider<V>- Returns:
- options image provider.
-
generateOptionImage
-
getOptionsCaptionFilter
- Specified by:
getOptionsCaptionFilterin interfaceComboBox<V>- Returns:
- a predicate that tests whether an item with the given caption matches to the given search string.
-
setOptionsCaptionFilter
public void setOptionsCaptionFilter(@Nullable Predicate<ComboBox.OptionsCaptionFilteringContext> filter) Description copied from interface:ComboBoxSets a predicate that tests whether an item with the given caption matches to the given search string.- Specified by:
setOptionsCaptionFilterin interfaceComboBox<V>- Parameters:
filter- a predicate to set
-
getPopupWidth
Description copied from interface:ComboBoxReturns the suggestion popup's width as a string. By default this width is set tonull.- Specified by:
getPopupWidthin interfaceComboBox<V>- Returns:
- explicitly set popup width as size string or null if not set
-
setPopupWidth
Description copied from interface:ComboBoxSets the suggestion popup's width as a string. By using relative units (e.g. "50%") it's possible to set the popup's width relative to the LookupField itself.By default this width is set to
nullso that the popup's width can be greater than a component width to fit the content of all displayed items. By setting width to "100%" the popup's width will be equal to the width of the LookupField.- Specified by:
setPopupWidthin interfaceComboBox<V>- Parameters:
width- the width
-
setInputPrompt
Description copied from interface:HasInputPromptSets the input prompt - a textual prompt that is displayed when the field would otherwise be empty, to prompt the user for input.- Specified by:
setInputPromptin interfaceHasInputPrompt- Overrides:
setInputPromptin classValuePickerImpl<V>- Parameters:
inputPrompt- input prompt
-
getOptions
- Specified by:
getOptionsin interfaceOptionsField<V,V> - Returns:
- options object
-
setOptions
Description copied from interface:OptionsFieldSets options for UI component.- Specified by:
setOptionsin interfaceOptionsField<V,V> - Parameters:
options- options- See Also:
-
setOptionsContainer
Description copied from interface:SupportsOptionsContainerSets options from the passedCollectionContainer.- Specified by:
setOptionsContainerin interfaceSupportsOptionsContainer<V>- Parameters:
container- aCollectionContainerto be used as options source- See Also:
-
setItemsToPresentation
-
filterItemTest
-
getOptionCaptionProvider
- Specified by:
getOptionCaptionProviderin interfaceHasOptionCaptionProvider<V>- Returns:
- caption provider for options
-
setOptionCaptionProvider
Description copied from interface:HasOptionCaptionProviderSets function that provides caption for option items.- Specified by:
setOptionCaptionProviderin interfaceHasOptionCaptionProvider<V>- Parameters:
optionCaptionProvider- caption provider for options
-
setOptionStyleProvider
Description copied from interface:HasOptionStyleProviderSets the style provider that is used to produce custom class names for option items.- Specified by:
setOptionStyleProviderin interfaceHasOptionStyleProvider<V>- Parameters:
optionStyleProvider- style provider
-
getOptionStyleProvider
- Specified by:
getOptionStyleProviderin interfaceHasOptionStyleProvider<V>- Returns:
- the currently used item style provider
-
checkValueType
- Overrides:
checkValueTypein classEntityPickerImpl<V>
-
componentValueChanged
protected void componentValueChanged(V prevComponentValue, V newComponentValue, boolean isUserOriginated) - Overrides:
componentValueChangedin classAbstractValueComponent<JmixPickerField<V>,V, V>
-