Package io.jmix.ui.component.impl
Class TagFieldImpl<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<T,V,V>
io.jmix.ui.component.impl.AbstractSuggestionField<Collection<V>,V,JmixTagField<V>>
io.jmix.ui.component.impl.TagFieldImpl<V>
- All Implemented Interfaces:
AttachNotifier
,Component
,Component.BelongToFrame
,Component.Editable
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Component.HasXmlDescriptor
,Component.Wrapper
,HasValueSource<Collection<V>>
,Field<Collection<V>>
,HasContextHelp
,HasDebugId
,HasEnterPressHandler
,HasFormatter<V>
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,HasInputPrompt
,HasOptionStyleProvider<V>
,HasValidator<Collection<V>>
,HasValue<Collection<V>>
,Requirable
,SuggestionFieldComponent<Collection<V>,
,V> SupportsUserAction<Collection<V>>
,TagField<V>
,Validatable
,org.springframework.beans.factory.InitializingBean
public class TagFieldImpl<V>
extends AbstractSuggestionField<Collection<V>,V,JmixTagField<V>>
implements TagField<V>
-
Nested Class Summary
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.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.HasValue
HasValue.ValueChangeEvent<V>
Nested classes/interfaces inherited from interface io.jmix.ui.component.SuggestionFieldComponent
SuggestionFieldComponent.ArrowDownEvent, SuggestionFieldComponent.ParametrizedSearchExecutor<E>, SuggestionFieldComponent.SearchExecutor<E>
Nested classes/interfaces inherited from interface io.jmix.ui.component.TagField
TagField.NewTagProvider<V>, TagField.TagClickEvent<V>
-
Field Summary
Fields inherited from class io.jmix.ui.component.impl.AbstractSuggestionField
arrowDownHandler, backgroundWorker, enterPressHandler, formatter, handler, locale, metadataTools, optionStyleProvider, searchExecutor
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.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Fields inherited from interface io.jmix.ui.component.SuggestionFieldComponent
POPUP_AUTO_WIDTH, POPUP_PARENT_WIDTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddTagClickListener
(Consumer<TagField.TagClickEvent<V>> listener) Sets tag click listener.protected Collection<V>
convertToModel
(Collection<V> componentRawValue) protected JmixTagField<V>
protected boolean
equalCollections
(Collection<V> a, Collection<V> b) protected boolean
fieldValueEquals
(Collection<V> value, Collection<V> oldValue) Comparator<? super V>
boolean
boolean
isEmpty()
protected void
onTagClick
(V item) protected Subscription
removeTagClickListener
(Consumer<TagField.TagClickEvent<V>> listener) void
setClearAllVisible
(boolean visible) Display the button that clears all tags from the field.void
setTagCaptionProvider
(Function<? super V, String> tagCaptionProvider) Sets tag caption provider.void
setTagComparator
(Comparator<? super V> tagComparator) Sets comparator for sorting tags in the UI.void
setTagStyleProvider
(Function<? super V, String> tagStyleProvider) Sets tag style provider.void
setValueFromUser
(Collection<V> value) Sets the value of this component as if the user had set it.Methods inherited from class io.jmix.ui.component.impl.AbstractSuggestionField
addStyleName, afterPropertiesSet, applyDefaultValueFormat, asyncSearch, cancelSearch, convertToTextView, focus, generateItemStylename, getArrowDownHandler, getAsyncSearchDelayMs, getEnterPressHandler, getFormatter, getInputPrompt, getMinSearchStringLength, getOptionStyleProvider, getPopupWidth, getSearchExecutor, getSearchSuggestionsTask, getSuggestionsLimit, getTabIndex, handleSearchResult, initComponent, onArrowDownHandler, onEnterPressHandler, removeStyleName, searchSuggestions, setArrowDownHandler, setAsyncSearchDelayMs, setBackgroundWorker, setCurrentAuthentication, setEnterPressHandler, setFormatter, setInputPrompt, setMetadataTools, setMinSearchStringLength, setOptionStyleProvider, setPopupWidth, setSearchExecutor, setStyleName, setSuggestionsLimit, setTabIndex, showSuggestions, showSuggestions
Methods inherited from class io.jmix.ui.component.impl.AbstractField
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getDefaultRequiredMessage, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setEditableToComponent, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validate
Methods inherited from class io.jmix.ui.component.impl.AbstractValueComponent
addValueChangeListener, commit, componentValueChanged, convertToPresentation, discard, getValue, getValueSource, isBuffered, isModified, setBuffered, setUiTestId, setUiTestIdsSupport, setValue, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnected
Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, 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, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, 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.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.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.HasEnterPressHandler
getEnterPressHandler, setEnterPressHandler
Methods inherited from interface io.jmix.ui.component.HasFormatter
getFormatter, setFormatter
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, setInputPrompt
Methods inherited from interface io.jmix.ui.component.HasOptionStyleProvider
getOptionStyleProvider, setOptionStyleProvider
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, setValue
Methods inherited from interface io.jmix.ui.component.data.HasValueSource
getValueSource, setValueSource
Methods inherited from interface io.jmix.ui.component.Requirable
getRequiredMessage, isRequired, setRequired, setRequiredMessage
Methods inherited from interface io.jmix.ui.component.SuggestionFieldComponent
getArrowDownHandler, getAsyncSearchDelayMs, getMinSearchStringLength, getPopupWidth, getSearchExecutor, getSuggestionsLimit, setArrowDownHandler, setAsyncSearchDelayMs, setMinSearchStringLength, setPopupWidth, setSuggestionsLimit, showSuggestions
Methods inherited from interface io.jmix.ui.component.TagField
setSearchExecutor
Methods inherited from interface io.jmix.ui.component.Validatable
isValid, isValidateOnCommit, validate
-
Constructor Details
-
TagFieldImpl
public TagFieldImpl()
-
-
Method Details
-
createComponent
-
isClearAllVisible
public boolean isClearAllVisible()- Specified by:
isClearAllVisible
in interfaceTagField<V>
- Returns:
- {code true} if clear button is visible
-
setClearAllVisible
public void setClearAllVisible(boolean visible) Description copied from interface:TagField
Display the button that clears all tags from the field. The default value isfalse
.- Specified by:
setClearAllVisible
in interfaceTagField<V>
- Parameters:
visible
- whether to display clear button
-
getTagStyleProvider
- Specified by:
getTagStyleProvider
in interfaceTagField<V>
- Returns:
- tag style provider or
null
if not set
-
setTagStyleProvider
Description copied from interface:TagField
Sets tag style provider. It is used for generating style name for tag.For instance:
@Install(to = "tagField", subject = "tagStyleProvider") private String tagFieldTagStyleProvider(User user) { switch (user.getAccountType()) { case PREMIUM: return "user-premium"; case COMMON: return "user-common"; default: return null; } }
- Specified by:
setTagStyleProvider
in interfaceTagField<V>
- Parameters:
tagStyleProvider
- tag style provider to set
-
getTagCaptionProvider
- Specified by:
getTagCaptionProvider
in interfaceTagField<V>
- Returns:
- tag caption provider or
null
if not set
-
setTagCaptionProvider
Description copied from interface:TagField
Sets tag caption provider. It is used for generating tag caption.For instance:
@Install(to = "tagField", subject = "tagCaptionProvider") private String tagFieldCaptionProvider(User user) { return "User: " + user.getUsername(); }
- Specified by:
setTagCaptionProvider
in interfaceTagField<V>
- Parameters:
tagCaptionProvider
- caption provider to set
-
getTagComparator
- Specified by:
getTagComparator
in interfaceTagField<V>
- Returns:
- tag comparator
-
setTagComparator
Description copied from interface:TagField
Sets comparator for sorting tags in the UI.- Specified by:
setTagComparator
in interfaceTagField<V>
- Parameters:
tagComparator
- comparator to set
-
addTagClickListener
Description copied from interface:TagField
Sets tag click listener. It subscribes toTagField.TagClickEvent
that is invoked when user clicks on tag content.- Specified by:
addTagClickListener
in interfaceTagField<V>
- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
removeTagClickListener
-
fieldValueEquals
- Overrides:
fieldValueEquals
in classAbstractValueComponent<JmixTagField<V>,
Collection<V>, Collection<V>>
-
equalCollections
-
onTagClick
-
setValueFromUser
Description copied from interface:SupportsUserAction
Sets the value of this component as if the user had set it. The user originated attribute is only used for theHasValue.ValueChangeEvent
.- Specified by:
setValueFromUser
in interfaceSupportsUserAction<V>
- Parameters:
value
- the new value
-
isEmpty
public boolean isEmpty() -
convertToModel
protected Collection<V> convertToModel(@Nullable Collection<V> componentRawValue) throws ConversionException - Overrides:
convertToModel
in classAbstractValueComponent<JmixTagField<V>,
Collection<V>, Collection<V>> - Throws:
ConversionException
-