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.WebValuePickerActionHandler
Nested classes/interfaces inherited from interface io.jmix.ui.component.ComboBox
ComboBox.OptionsCaptionFilteringContext
Nested 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.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.EntityPicker
EntityPicker.EntityPickerAction
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasEnterPressHandler
HasEnterPressHandler.EnterPressEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasFilterMode
HasFilterMode.FilterMode
Nested 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
Modifier and TypeFieldDescriptionprotected Consumer<HasEnterPressHandler.EnterPressEvent>
protected HasFilterMode.FilterMode
protected IconResolver
protected boolean
protected OptionsBinding<V>
protected Predicate<ComboBox.OptionsCaptionFilteringContext>
Fields inherited from class io.jmix.ui.component.impl.EntityPickerImpl
metaClass, metadata
Fields inherited from class io.jmix.ui.component.impl.ValuePickerImpl
actionButtons, actionHandler, actionPropertyChangeListener, actions, actionsPermissions, fieldIconProvider, fieldListenerRegistration, formatter, metadataTools
Fields inherited from class io.jmix.ui.component.impl.AbstractField
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITY
Fields inherited from class io.jmix.ui.component.impl.AbstractValueComponent
internalValue, uiTestIdsSupport, valueBinding
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.ComboBox
TYPE_STRING
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Fields inherited from interface io.jmix.ui.component.EntityComboBox
NAME
Fields inherited from interface io.jmix.ui.component.EntityPicker
NAME
Fields inherited from interface io.jmix.ui.component.ValuePicker
NAME, TYPE_STRING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a listener that will be fired in case field is editable.void
protected void
checkValueType
(V value) protected void
componentValueChanged
(V prevComponentValue, V newComponentValue, boolean isUserOriginated) protected JmixPickerField<V>
protected boolean
filterItemTest
(String itemCaption, String filterText) protected String
generateDefaultItemCaption
(V item) protected String
generateItemCaption
(V item) protected String
generateItemStylename
(V item) protected com.vaadin.server.Resource
generateOptionIcon
(V item) protected com.vaadin.server.Resource
generateOptionImage
(V item) int
Returns the suggestion popup's width as a string.protected void
handleClearShortcut
(Object sender, Object target) protected void
initComponent
(JmixPickerField<V> component) boolean
boolean
boolean
protected void
onEnterPressed
(String text) void
Sets an ENTER press handler.void
setFieldEditable
(boolean editable) Sets whether a user can input the value manually.void
setFieldIconProvider
(Function<? super V, String> iconProvider) Sets a function that provides an icon for the field.void
setFilterMode
(HasFilterMode.FilterMode filterMode) Sets filter mode for the dropdown list in the field.void
setFormatter
(Formatter<? super V> formatter) void
setIconResolver
(IconResolver iconResolver) void
setInputPrompt
(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
setItemsToPresentation
(Stream<V> options) void
setNullOptionVisible
(boolean nullOptionVisible) Sets visibility for first null element in suggestion popup.void
setNullSelectionCaption
(String nullOption) Sets the null selection caption.void
setOptionCaptionProvider
(Function<? super V, String> optionCaptionProvider) Sets function that provides caption for option items.void
setOptionIconProvider
(Function<? super V, String> optionIconProvider) Sets a function that provides an icon for options.void
setOptionImageProvider
(Function<? super V, Resource> optionImageProvider) Sets a function that provides option images.void
setOptions
(Options<V> options) Sets options for UI component.void
Sets a predicate that tests whether an item with the given caption matches to the given search string.void
setOptionsContainer
(CollectionContainer<V> container) Sets options from the passedCollectionContainer
.void
setOptionStyleProvider
(Function<? super V, String> optionStyleProvider) Sets the style provider that is used to produce custom class names for option items.void
setPageLength
(int pageLength) Sets the page length for the suggestion popup.void
setPopupWidth
(String width) Sets the suggestion popup's width as a string.void
setTextInputAllowed
(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, setValueFromUser
Methods 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, setupButtonAction
Methods 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, validate
Methods inherited from class io.jmix.ui.component.impl.AbstractValueComponent
addValueChangeListener, convertToModel, convertToPresentation, fieldValueEquals, getValue, getValueSource, setUiTestId, setUiTestIdsSupport, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnected
Methods 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, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.ActionsHolder
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActions
Methods inherited from interface io.jmix.ui.component.Buffered
commit, discard, isBuffered, isModified, setBuffered
Methods 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, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.Editable
isEditable, isEditableWithParent, setEditable
Methods inherited from interface io.jmix.ui.component.Component.Focusable
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSet
Methods inherited from interface io.jmix.ui.component.EntityPicker
getMetaClass, setMetaClass
Methods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
Methods inherited from interface io.jmix.ui.component.HasInputPrompt
getInputPrompt
Methods inherited from interface io.jmix.ui.component.HasValidator
addValidator, addValidators, getValidators, removeValidator
Methods inherited from interface io.jmix.ui.component.HasValue
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValue
Methods inherited from interface io.jmix.ui.component.data.HasValueSource
getValueSource, setValueSource
Methods inherited from interface io.jmix.ui.component.LookupComponent
getLookupSelectedItems, setLookupSelectHandler
Methods inherited from interface io.jmix.ui.component.OptionsField
setOptionsEnum, setOptionsList, setOptionsMap
Methods inherited from interface io.jmix.ui.component.Requirable
getRequiredMessage, isRequired, setRequired, setRequiredMessage
Methods inherited from interface io.jmix.ui.component.SecuredActionsHolder
getActionsPermissions
Methods inherited from interface io.jmix.ui.component.SupportsUserAction
setValueFromUser
Methods 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:
createComponent
in classEntityPickerImpl<V>
-
getComponent
- Specified by:
getComponent
in interfaceComponent.Wrapper
- Overrides:
getComponent
in classAbstractComponent<JmixPickerField<V>>
-
setIconResolver
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in classValuePickerImpl<V>
-
initComponent
- Overrides:
initComponent
in classValuePickerImpl<V>
-
handleClearShortcut
-
generateDefaultItemCaption
-
generateItemCaption
-
generateItemStylename
-
getNullSelectionCaption
- Specified by:
getNullSelectionCaption
in interfaceComboBox<V>
- Returns:
- the null selection caption, not
null
-
setNullSelectionCaption
Description copied from interface:ComboBox
Sets 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:
setNullSelectionCaption
in interfaceComboBox<V>
- Parameters:
nullOption
- the caption to set, notnull
-
getFilterMode
- Specified by:
getFilterMode
in interfaceHasFilterMode
- Returns:
- filter mode for the dropdown list in the field
-
setFilterMode
Description copied from interface:HasFilterMode
Sets filter mode for the dropdown list in the field.- Specified by:
setFilterMode
in interfaceHasFilterMode
- Parameters:
filterMode
- filter mode to set
-
addFieldValueChangeListener
public Subscription addFieldValueChangeListener(Consumer<ValuePicker.FieldValueChangeEvent<V>> listener) Description copied from interface:ValuePicker
Adds a listener that will be fired in case field is editable.- Specified by:
addFieldValueChangeListener
in interfaceValuePicker<V>
- Overrides:
addFieldValueChangeListener
in classValuePickerImpl<V>
- Parameters:
listener
- a listener to add- Returns:
- a
Subscription
object - See Also:
-
isFieldEditable
public boolean isFieldEditable()- Specified by:
isFieldEditable
in interfaceValuePicker<V>
- Overrides:
isFieldEditable
in classValuePickerImpl<V>
- Returns:
- whether a user can input the value manually
-
setFieldEditable
public void setFieldEditable(boolean editable) Description copied from interface:ValuePicker
Sets whether a user can input the value manually.false
by default. Doesn't set entered value to the model. To handle user input, theValuePicker.FieldValueChangeEvent
listener must be used.- Specified by:
setFieldEditable
in interfaceValuePicker<V>
- Overrides:
setFieldEditable
in classValuePickerImpl<V>
- Parameters:
editable
-true
to enable manual input,false
otherwise- See Also:
-
getFormatter
- Specified by:
getFormatter
in interfaceHasFormatter<V>
- Overrides:
getFormatter
in classValuePickerImpl<V>
-
setFormatter
- Specified by:
setFormatter
in interfaceHasFormatter<V>
- Overrides:
setFormatter
in classValuePickerImpl<V>
-
isTextInputAllowed
public boolean isTextInputAllowed()- Specified by:
isTextInputAllowed
in interfaceComboBox<V>
- Returns:
- true if text input allowed
-
setTextInputAllowed
public void setTextInputAllowed(boolean textInputAllowed) Description copied from interface:ComboBox
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.- Specified by:
setTextInputAllowed
in interfaceComboBox<V>
-
getEnterPressHandler
- Specified by:
getEnterPressHandler
in interfaceHasEnterPressHandler
- Returns:
- an ENTER press handler
-
setEnterPressHandler
Description copied from interface:HasEnterPressHandler
Sets an ENTER press handler.- Specified by:
setEnterPressHandler
in interfaceHasEnterPressHandler
- Parameters:
handler
- an ENTER press handler to set
-
onEnterPressed
-
getPageLength
public int getPageLength()- Specified by:
getPageLength
in interfaceComboBox<V>
- Returns:
- the page length of the suggestion popup.
-
setPageLength
public void setPageLength(int pageLength) Description copied from interface:ComboBox
Sets the page length for the suggestion popup. Setting the page length to 0 will disable suggestion popup paging (all items visible).- Specified by:
setPageLength
in interfaceComboBox<V>
- Parameters:
pageLength
- the pageLength to set
-
isNullOptionVisible
public boolean isNullOptionVisible()- Specified by:
isNullOptionVisible
in interfaceComboBox<V>
- Returns:
- true if first null element is visible.
-
setNullOptionVisible
public void setNullOptionVisible(boolean nullOptionVisible) Description copied from interface:ComboBox
Sets visibility for first null element in suggestion popup.- Specified by:
setNullOptionVisible
in interfaceComboBox<V>
-
setOptionIconProvider
Description copied from interface:HasOptionIconProvider
Sets a function that provides an icon for options.- Specified by:
setOptionIconProvider
in interfaceHasOptionIconProvider<V>
- Parameters:
optionIconProvider
- icon provider for options to set
-
getOptionIconProvider
- Specified by:
getOptionIconProvider
in interfaceHasOptionIconProvider<V>
- Returns:
- options icon provider or
null
if not defined
-
generateOptionIcon
- Overrides:
generateOptionIcon
in classValuePickerImpl<V>
-
getFieldIconProvider
- Specified by:
getFieldIconProvider
in interfaceValuePicker<V>
- Overrides:
getFieldIconProvider
in classValuePickerImpl<V>
- Returns:
- an icon provider or {code null} if not set
-
setFieldIconProvider
Description copied from interface:ValuePicker
Sets a function that provides an icon for the field.- Specified by:
setFieldIconProvider
in interfaceValuePicker<V>
- Overrides:
setFieldIconProvider
in classValuePickerImpl<V>
- Parameters:
iconProvider
- icon provider to set
-
setOptionImageProvider
Description copied from interface:HasOptionImageProvider
Sets a function that provides option images.- Specified by:
setOptionImageProvider
in interfaceHasOptionImageProvider<V>
- Parameters:
optionImageProvider
- options image provider- See Also:
-
getOptionImageProvider
- Specified by:
getOptionImageProvider
in interfaceHasOptionImageProvider<V>
- Returns:
- options image provider.
-
generateOptionImage
-
getOptionsCaptionFilter
- Specified by:
getOptionsCaptionFilter
in 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:ComboBox
Sets a predicate that tests whether an item with the given caption matches to the given search string.- Specified by:
setOptionsCaptionFilter
in interfaceComboBox<V>
- Parameters:
filter
- a predicate to set
-
getPopupWidth
Description copied from interface:ComboBox
Returns the suggestion popup's width as a string. By default this width is set tonull
.- Specified by:
getPopupWidth
in interfaceComboBox<V>
- Returns:
- explicitly set popup width as size string or null if not set
-
setPopupWidth
Description copied from interface:ComboBox
Sets 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
null
so 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:
setPopupWidth
in interfaceComboBox<V>
- Parameters:
width
- the width
-
setInputPrompt
Description copied from interface:HasInputPrompt
Sets the input prompt - a textual prompt that is displayed when the field would otherwise be empty, to prompt the user for input.- Specified by:
setInputPrompt
in interfaceHasInputPrompt
- Overrides:
setInputPrompt
in classValuePickerImpl<V>
- Parameters:
inputPrompt
- input prompt
-
getOptions
- Specified by:
getOptions
in interfaceOptionsField<V,
V> - Returns:
- options object
-
setOptions
Description copied from interface:OptionsField
Sets options for UI component.- Specified by:
setOptions
in interfaceOptionsField<V,
V> - Parameters:
options
- options- See Also:
-
setOptionsContainer
Description copied from interface:SupportsOptionsContainer
Sets options from the passedCollectionContainer
.- Specified by:
setOptionsContainer
in interfaceSupportsOptionsContainer<V>
- Parameters:
container
- aCollectionContainer
to be used as options source- See Also:
-
setItemsToPresentation
-
filterItemTest
-
getOptionCaptionProvider
- Specified by:
getOptionCaptionProvider
in interfaceHasOptionCaptionProvider<V>
- Returns:
- caption provider for options
-
setOptionCaptionProvider
Description copied from interface:HasOptionCaptionProvider
Sets function that provides caption for option items.- Specified by:
setOptionCaptionProvider
in interfaceHasOptionCaptionProvider<V>
- Parameters:
optionCaptionProvider
- caption provider for options
-
setOptionStyleProvider
Description copied from interface:HasOptionStyleProvider
Sets the style provider that is used to produce custom class names for option items.- Specified by:
setOptionStyleProvider
in interfaceHasOptionStyleProvider<V>
- Parameters:
optionStyleProvider
- style provider
-
getOptionStyleProvider
- Specified by:
getOptionStyleProvider
in interfaceHasOptionStyleProvider<V>
- Returns:
- the currently used item style provider
-
checkValueType
- Overrides:
checkValueType
in classEntityPickerImpl<V>
-
componentValueChanged
protected void componentValueChanged(V prevComponentValue, V newComponentValue, boolean isUserOriginated) - Overrides:
componentValueChanged
in classAbstractValueComponent<JmixPickerField<V>,
V, V>
-