public class EntityComboBoxImpl<V> extends EntityPickerImpl<V> implements EntityComboBox<V>, SecuredActionsHolder
ValuePickerImpl.WebValuePickerActionHandler
ComboBox.OptionsCaptionFilteringContext
HasFilterMode.FilterMode
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<HasEnterPressHandler.EnterPressEvent> |
enterPressHandler |
protected HasFilterMode.FilterMode |
filterMode |
protected IconResolver |
iconResolver |
protected boolean |
nullOptionVisible |
protected java.util.function.Function<? super V,java.lang.String> |
optionCaptionProvider |
protected java.util.function.Function<? super V,java.lang.String> |
optionIconProvider |
protected java.util.function.Function<? super V,Resource> |
optionImageProvider |
protected OptionsBinding<V> |
optionsBinding |
protected java.util.function.Predicate<ComboBox.OptionsCaptionFilteringContext> |
optionsCaptionFilter |
protected java.util.function.Function<? super V,java.lang.String> |
optionStyleProvider |
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
TYPE_STRING
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
EntityComboBoxImpl() |
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 |
afterPropertiesSet() |
protected void |
checkValueType(V value) |
protected void |
componentValueChanged(V prevComponentValue,
V newComponentValue,
boolean isUserOriginated) |
protected JmixPickerField<V> |
createComponent() |
protected boolean |
filterItemTest(java.lang.String itemCaption,
java.lang.String filterText) |
protected java.lang.String |
generateDefaultItemCaption(V item) |
protected java.lang.String |
generateItemCaption(V item) |
protected java.lang.String |
generateItemStylename(V item) |
protected com.vaadin.server.Resource |
generateOptionIcon(V item) |
protected com.vaadin.server.Resource |
generateOptionImage(V item) |
JmixComboBoxPickerField<V> |
getComponent() |
java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> |
getEnterPressHandler() |
java.util.function.Function<? super V,java.lang.String> |
getFieldIconProvider() |
HasFilterMode.FilterMode |
getFilterMode() |
Formatter<V> |
getFormatter() |
java.lang.String |
getInputPrompt() |
java.lang.String |
getNullSelectionCaption() |
java.util.function.Function<? super V,java.lang.String> |
getOptionCaptionProvider() |
java.util.function.Function<? super V,java.lang.String> |
getOptionIconProvider() |
java.util.function.Function<? super V,Resource> |
getOptionImageProvider() |
Options<V> |
getOptions() |
java.util.function.Predicate<ComboBox.OptionsCaptionFilteringContext> |
getOptionsCaptionFilter() |
java.util.function.Function<? super V,java.lang.String> |
getOptionStyleProvider() |
int |
getPageLength() |
java.lang.String |
getPopupWidth()
Returns the suggestion popup's width as a string.
|
protected void |
handleClearShortcut(java.lang.Object sender,
java.lang.Object target) |
protected void |
initComponent(JmixPickerField<V> component) |
boolean |
isAutomaticPopupOnFocus() |
boolean |
isFieldEditable() |
boolean |
isNullOptionVisible() |
boolean |
isTextInputAllowed() |
protected void |
onEnterPressed(java.lang.String text) |
void |
setAutomaticPopupOnFocus(boolean automaticPopupOnFocus)
When enabled popup automatically opens on focus.
|
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 |
setFieldIconProvider(java.util.function.Function<? super V,java.lang.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(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 |
setItemsToPresentation(java.util.stream.Stream<V> options) |
void |
setNullOptionVisible(boolean nullOptionVisible)
Sets visibility for first null element in suggestion popup.
|
void |
setNullSelectionCaption(java.lang.String nullOption)
Sets the null selection caption.
|
void |
setOptionCaptionProvider(java.util.function.Function<? super V,java.lang.String> optionCaptionProvider)
Sets function that provides caption for option items.
|
void |
setOptionIconProvider(java.util.function.Function<? super V,java.lang.String> optionIconProvider)
Sets a function that provides an icon for options.
|
void |
setOptionImageProvider(java.util.function.Function<? super V,Resource> optionImageProvider)
Sets a function that provides option images.
|
void |
setOptions(Options<V> options)
Sets options for UI component.
|
void |
setOptionsCaptionFilter(java.util.function.Predicate<ComboBox.OptionsCaptionFilteringContext> filter)
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 passed
CollectionContainer . |
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 |
setPageLength(int pageLength)
Sets the page length for the suggestion popup.
|
void |
setPopupWidth(java.lang.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.
|
getLookupSelectedItems, getMetaClass, setLookupSelectHandler, setMetaClass, setMetadata, setValue, setValueFromUser
actionPropertyChanged, addAction, addAction, applyDefaultValueFormat, commit, discard, focus, formatValue, getAction, getActions, getActionsPermissions, getTabIndex, isBuffered, isModified, onFieldValueChange, refreshActionsState, removeAction, removeAction, removeAllActions, setBuffered, setButtonIcon, setDebugId, setEditableToComponent, setFrame, setMetadataTools, setTabIndex, setUiComponentProperties, setupButtonAction
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validate
addValueChangeListener, convertToModel, convertToPresentation, fieldValueEquals, getValue, getValueSource, setUiTestId, setUiTestIdsSupport, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnected
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
of
setOptionsEnum, setOptionsList, setOptionsMap
getMetaClass, setMetaClass
getValueSource, setValueSource
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValue
isEditable, isEditableWithParent, setEditable
getFrame, setFrame
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
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
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActions
commit, discard, isBuffered, isModified, setBuffered
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
setValueFromUser
getLookupSelectedItems, setLookupSelectHandler
getActionsPermissions
protected boolean nullOptionVisible
protected HasFilterMode.FilterMode filterMode
protected java.util.function.Predicate<ComboBox.OptionsCaptionFilteringContext> optionsCaptionFilter
protected java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> enterPressHandler
protected java.util.function.Function<? super V,java.lang.String> optionCaptionProvider
protected java.util.function.Function<? super V,java.lang.String> optionIconProvider
protected java.util.function.Function<? super V,java.lang.String> optionStyleProvider
protected OptionsBinding<V> optionsBinding
protected IconResolver iconResolver
protected JmixPickerField<V> createComponent()
createComponent
in class EntityPickerImpl<V>
public JmixComboBoxPickerField<V> getComponent()
getComponent
in interface Component.Wrapper
getComponent
in class AbstractComponent<JmixPickerField<V>>
@Autowired public void setIconResolver(IconResolver iconResolver)
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class ValuePickerImpl<V>
protected void initComponent(JmixPickerField<V> component)
initComponent
in class ValuePickerImpl<V>
protected void handleClearShortcut(java.lang.Object sender, java.lang.Object target)
protected java.lang.String generateDefaultItemCaption(V item)
protected java.lang.String generateItemCaption(@Nullable V item)
@Nullable protected java.lang.String generateItemStylename(V item)
public java.lang.String getNullSelectionCaption()
getNullSelectionCaption
in interface ComboBox<V>
null
public void setNullSelectionCaption(java.lang.String nullOption)
ComboBox
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.
setNullSelectionCaption
in interface ComboBox<V>
nullOption
- the caption to set, not null
public HasFilterMode.FilterMode getFilterMode()
getFilterMode
in interface HasFilterMode
public void setFilterMode(HasFilterMode.FilterMode filterMode)
HasFilterMode
setFilterMode
in interface HasFilterMode
filterMode
- filter mode to setpublic 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)
@Nullable public Formatter<V> getFormatter()
getFormatter
in interface HasFormatter<V>
getFormatter
in class ValuePickerImpl<V>
public void setFormatter(@Nullable Formatter<? super V> formatter)
setFormatter
in interface HasFormatter<V>
setFormatter
in class ValuePickerImpl<V>
public boolean isTextInputAllowed()
isTextInputAllowed
in interface ComboBox<V>
public void setTextInputAllowed(boolean textInputAllowed)
ComboBox
setTextInputAllowed
in interface ComboBox<V>
public void setAutomaticPopupOnFocus(boolean automaticPopupOnFocus)
ComboBox
setAutomaticPopupOnFocus
in interface ComboBox<V>
public boolean isAutomaticPopupOnFocus()
isAutomaticPopupOnFocus
in interface ComboBox<V>
@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 setprotected void onEnterPressed(java.lang.String text)
public int getPageLength()
getPageLength
in interface ComboBox<V>
public void setPageLength(int pageLength)
ComboBox
setPageLength
in interface ComboBox<V>
pageLength
- the pageLength to setpublic boolean isNullOptionVisible()
isNullOptionVisible
in interface ComboBox<V>
public void setNullOptionVisible(boolean nullOptionVisible)
ComboBox
setNullOptionVisible
in interface ComboBox<V>
public void setOptionIconProvider(@Nullable java.util.function.Function<? super V,java.lang.String> optionIconProvider)
HasOptionIconProvider
setOptionIconProvider
in interface HasOptionIconProvider<V>
optionIconProvider
- icon provider for options to set@Nullable public java.util.function.Function<? super V,java.lang.String> getOptionIconProvider()
getOptionIconProvider
in interface HasOptionIconProvider<V>
null
if not definedprotected com.vaadin.server.Resource generateOptionIcon(@Nullable V item)
generateOptionIcon
in class ValuePickerImpl<V>
@Nullable public java.util.function.Function<? super V,java.lang.String> getFieldIconProvider()
getFieldIconProvider
in interface ValuePicker<V>
getFieldIconProvider
in class ValuePickerImpl<V>
public void setFieldIconProvider(@Nullable java.util.function.Function<? super V,java.lang.String> iconProvider)
ValuePicker
setFieldIconProvider
in interface ValuePicker<V>
setFieldIconProvider
in class ValuePickerImpl<V>
iconProvider
- icon provider to setpublic void setOptionImageProvider(@Nullable java.util.function.Function<? super V,Resource> optionImageProvider)
HasOptionImageProvider
setOptionImageProvider
in interface HasOptionImageProvider<V>
optionImageProvider
- options image providerResource
@Nullable public java.util.function.Function<? super V,Resource> getOptionImageProvider()
getOptionImageProvider
in interface HasOptionImageProvider<V>
@Nullable protected com.vaadin.server.Resource generateOptionImage(V item)
@Nullable public java.util.function.Predicate<ComboBox.OptionsCaptionFilteringContext> getOptionsCaptionFilter()
getOptionsCaptionFilter
in interface ComboBox<V>
public void setOptionsCaptionFilter(@Nullable java.util.function.Predicate<ComboBox.OptionsCaptionFilteringContext> filter)
ComboBox
setOptionsCaptionFilter
in interface ComboBox<V>
filter
- a predicate to set@Nullable public java.lang.String getPopupWidth()
ComboBox
null
.getPopupWidth
in interface ComboBox<V>
public void setPopupWidth(@Nullable java.lang.String width)
ComboBox
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.
setPopupWidth
in interface ComboBox<V>
width
- the width@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 prompt@Nullable public Options<V> getOptions()
getOptions
in interface OptionsField<V,V>
public void setOptions(@Nullable Options<V> options)
OptionsField
setOptions
in interface OptionsField<V,V>
options
- optionsListOptions
public void setOptionsContainer(CollectionContainer<V> container)
SupportsOptionsContainer
CollectionContainer
.setOptionsContainer
in interface SupportsOptionsContainer<V>
container
- a CollectionContainer
to be used as options sourceContainerOptions
protected void setItemsToPresentation(java.util.stream.Stream<V> options)
protected boolean filterItemTest(java.lang.String itemCaption, java.lang.String filterText)
@Nullable public java.util.function.Function<? super V,java.lang.String> getOptionCaptionProvider()
getOptionCaptionProvider
in interface HasOptionCaptionProvider<V>
public void setOptionCaptionProvider(@Nullable java.util.function.Function<? super V,java.lang.String> optionCaptionProvider)
HasOptionCaptionProvider
setOptionCaptionProvider
in interface HasOptionCaptionProvider<V>
optionCaptionProvider
- caption provider for optionspublic 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>
protected void checkValueType(@Nullable V value)
checkValueType
in class EntityPickerImpl<V>
protected void componentValueChanged(V prevComponentValue, V newComponentValue, boolean isUserOriginated)
componentValueChanged
in class AbstractValueComponent<JmixPickerField<V>,V,V>