public class ComboBoxImpl<V> extends AbstractField<JmixComboBox<V>,V,V> implements ComboBox<V>, org.springframework.beans.factory.InitializingBean
ComboBox.OptionsCaptionFilteringContextHasValue.ValueChangeEvent<V>Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.WrapperHasContextHelp.ContextHelpIconClickEventHasFilterMode.FilterModeHasEnterPressHandler.EnterPressEvent| Modifier and Type | Field and Description |
|---|---|
protected java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> |
enterPressHandler |
protected HasFilterMode.FilterMode |
filterMode |
protected IconResolver |
iconResolver |
protected io.jmix.core.MetadataTools |
metadataTools |
static com.vaadin.ui.IconGenerator |
NULL_ITEM_ICON_GENERATOR |
static com.vaadin.ui.StyleGenerator |
NULL_STYLE_GENERATOR |
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 |
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITYinternalValue, uiTestIdsSupport, valueBindingalignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentNAME, TYPE_STRINGAUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE| Constructor and Description |
|---|
ComboBoxImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
commit()
Updates all changes since the previous commit to the data source.
|
protected JmixComboBox<V> |
createComponent() |
void |
discard()
Discards all changes since last commit.
|
protected boolean |
filterItemTest(java.lang.String itemCaption,
java.lang.String filterText) |
void |
focus()
Sets focus to this component
|
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) |
java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> |
getEnterPressHandler() |
HasFilterMode.FilterMode |
getFilterMode() |
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.
|
int |
getTabIndex()
Gets the tabulator index of the
HasTabIndex component. |
V |
getValue() |
protected void |
handleClearShortcut(java.lang.Object sender,
java.lang.Object target) |
protected void |
initComponent(JmixComboBox<V> component) |
boolean |
isAutomaticPopupOnFocus() |
boolean |
isBuffered() |
boolean |
isModified()
Tests if the value stored in the object has been modified since it was
last updated from the data source.
|
boolean |
isNullOptionVisible() |
boolean |
isTextInputAllowed() |
protected void |
onEnterPressed(java.lang.String text) |
void |
setAutomaticPopupOnFocus(boolean popup)
When enabled popup automatically opens on focus.
|
void |
setBuffered(boolean buffered)
Sets the buffered mode.
|
void |
setEnterPressHandler(java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> handler)
Sets an ENTER press handler.
|
void |
setFilterMode(HasFilterMode.FilterMode filterMode)
Sets filter mode for the dropdown list in the field.
|
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 |
setMetadataTools(io.jmix.core.MetadataTools metadataTools) |
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 |
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 |
setRequired(boolean required)
Sets whether the component must contain a non-null value.
|
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
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.
|
protected void |
valueBindingConnected(ValueSource<V> valueSource) |
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setEditableToComponent, setParent, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validateaddValueChangeListener, componentValueChanged, convertToModel, convertToPresentation, fieldValueEquals, getValueSource, setUiTestId, setUiTestIdsSupport, setValue, setValueSource, setValueToPresentation, valueBindingActivatedaddAttachListener, addDetachListener, addStyleName, 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, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetOptionsEnum, setOptionsList, setOptionsMapgetValueSource, setValueSourceaddValueChangeListener, clear, getEmptyValue, isEmpty, setValueisEditable, isEditableWithParent, setEditablegetFrame, setFrameaddStyleName, 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, withUnwrappedCompositionisValid, isValidateOnCommit, validategetIcon, setIcon, setIconFromSetgetContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledisCaptionAsHtml, setCaptionAsHtmlgetCaption, setCaptiongetDescription, setDescriptionisDescriptionAsHtml, setDescriptionAsHtmlisHtmlSanitizerEnabled, setHtmlSanitizerEnabledaddValidator, addValidators, getValidators, removeValidatorgetRequiredMessage, isRequired, setRequiredMessageisFocusable, setFocusablepublic static final com.vaadin.ui.StyleGenerator NULL_STYLE_GENERATOR
public static final com.vaadin.ui.IconGenerator NULL_ITEM_ICON_GENERATOR
protected HasFilterMode.FilterMode filterMode
protected boolean nullOptionVisible
protected java.util.function.Consumer<HasEnterPressHandler.EnterPressEvent> enterPressHandler
protected java.util.function.Function<? super V,java.lang.String> optionIconProvider
protected java.util.function.Function<? super V,java.lang.String> optionCaptionProvider
protected java.util.function.Function<? super V,java.lang.String> optionStyleProvider
protected java.util.function.Predicate<ComboBox.OptionsCaptionFilteringContext> optionsCaptionFilter
protected io.jmix.core.MetadataTools metadataTools
protected IconResolver iconResolver
protected OptionsBinding<V> optionsBinding
protected JmixComboBox<V> createComponent()
@Autowired public void setMetadataTools(io.jmix.core.MetadataTools metadataTools)
@Autowired public void setIconResolver(IconResolver iconResolver)
protected void handleClearShortcut(java.lang.Object sender,
java.lang.Object target)
public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanprotected void initComponent(JmixComboBox<V> component)
protected java.lang.String generateDefaultItemCaption(V item)
protected java.lang.String generateItemCaption(@Nullable
V item)
@Nullable protected java.lang.String generateItemStylename(V item)
protected boolean filterItemTest(java.lang.String itemCaption,
java.lang.String filterText)
protected void valueBindingConnected(ValueSource<V> valueSource)
valueBindingConnected in class AbstractValueComponent<JmixComboBox<V>,V,V>@Nullable public V getValue()
getValue in interface HasValue<V>getValue in class AbstractValueComponent<JmixComboBox<V>,V,V>public void setFilterMode(HasFilterMode.FilterMode filterMode)
HasFilterModesetFilterMode in interface HasFilterModefilterMode - filter mode to setpublic HasFilterMode.FilterMode getFilterMode()
getFilterMode in interface HasFilterModepublic void setRequired(boolean required)
RequirablesetRequired in interface RequirablesetRequired in class AbstractField<JmixComboBox<V>,V,V>required - requiredpublic java.lang.String getNullSelectionCaption()
getNullSelectionCaption in interface ComboBox<V>nullpublic 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@Nullable public Options<V> getOptions()
getOptions in interface OptionsField<V,V>public void setOptions(@Nullable
Options<V> options)
OptionsFieldsetOptions in interface OptionsField<V,V>options - optionsListOptionsprotected void setItemsToPresentation(java.util.stream.Stream<V> options)
public void setOptionCaptionProvider(@Nullable
java.util.function.Function<? super V,java.lang.String> optionCaptionProvider)
HasOptionCaptionProvidersetOptionCaptionProvider in interface HasOptionCaptionProvider<V>optionCaptionProvider - caption provider for options@Nullable public java.util.function.Function<? super V,java.lang.String> getOptionCaptionProvider()
getOptionCaptionProvider in interface HasOptionCaptionProvider<V>public boolean isTextInputAllowed()
isTextInputAllowed in interface ComboBox<V>public void setTextInputAllowed(boolean textInputAllowed)
ComboBoxsetTextInputAllowed in interface ComboBox<V>public boolean isAutomaticPopupOnFocus()
isAutomaticPopupOnFocus in interface ComboBox<V>public void setAutomaticPopupOnFocus(boolean popup)
ComboBoxsetAutomaticPopupOnFocus in interface ComboBox<V>@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 setprotected void onEnterPressed(java.lang.String text)
public int getPageLength()
getPageLength in interface ComboBox<V>public void setPageLength(int pageLength)
ComboBoxsetPageLength in interface ComboBox<V>pageLength - the pageLength to setpublic void setNullOptionVisible(boolean nullOptionVisible)
ComboBoxsetNullOptionVisible in interface ComboBox<V>public boolean isNullOptionVisible()
isNullOptionVisible in interface ComboBox<V>public void setOptionIconProvider(@Nullable
java.util.function.Function<? super V,java.lang.String> optionIconProvider)
HasOptionIconProvidersetOptionIconProvider 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 defined@Nullable protected com.vaadin.server.Resource generateOptionIcon(V item)
public void setOptionImageProvider(@Nullable
java.util.function.Function<? super V,Resource> optionImageProvider)
HasOptionImageProvidersetOptionImageProvider 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.lang.String getInputPrompt()
getInputPrompt in interface HasInputPromptpublic void setInputPrompt(@Nullable
java.lang.String inputPrompt)
HasInputPromptsetInputPrompt in interface HasInputPromptinputPrompt - input promptpublic void commit()
Bufferedcommit in interface Bufferedcommit in class AbstractValueComponent<JmixComboBox<V>,V,V>public void discard()
Buffereddiscard in interface Buffereddiscard in class AbstractValueComponent<JmixComboBox<V>,V,V>public boolean isBuffered()
isBuffered in interface BufferedisBuffered in class AbstractValueComponent<JmixComboBox<V>,V,V>true if buffered mode is on, false otherwisepublic void setBuffered(boolean buffered)
Buffered
When in buffered mode, an internal buffer will be used to store changes
until Buffered.commit() is called. Calling Buffered.discard() will revert
the internal buffer to the value of the data source.
When in non-buffered mode both read and write operations will be done
directly on the data source. In this mode the Buffered.commit() and
Buffered.discard() methods serve no purpose.
setBuffered in interface BufferedsetBuffered in class AbstractValueComponent<JmixComboBox<V>,V,V>buffered - true if buffered mode should be turned on, false otherwisepublic boolean isModified()
BufferedisModified in interface BufferedisModified in class AbstractValueComponent<JmixComboBox<V>,V,V>true if the value in the object has been modified
since the last data source update, false if not.public void setOptionStyleProvider(@Nullable
java.util.function.Function<? super V,java.lang.String> optionStyleProvider)
HasOptionStyleProvidersetOptionStyleProvider in interface HasOptionStyleProvider<V>optionStyleProvider - style provider@Nullable public java.util.function.Function<? super V,java.lang.String> getOptionStyleProvider()
getOptionStyleProvider in interface HasOptionStyleProvider<V>@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)
ComboBoxsetOptionsCaptionFilter in interface ComboBox<V>filter - a predicate to set@Nullable public java.lang.String getPopupWidth()
ComboBoxnull.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 widthpublic 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