Package io.jmix.ui.component
Interface TagField<V>
- Type Parameters:
V
- type of value
- All Superinterfaces:
Component
,Component.BelongToFrame
,Component.Editable
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Field<Collection<V>>
,HasContextHelp
,HasEnterPressHandler
,HasFormatter<V>
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,HasInputPrompt
,HasOptionStyleProvider<V>
,HasValidator<Collection<V>>
,HasValue<Collection<V>>
,HasValueSource<Collection<V>>
,Requirable
,SuggestionFieldComponent<Collection<V>,
,V> SupportsUserAction<Collection<V>>
,Validatable
- All Known Implementing Classes:
TagFieldImpl
@StudioComponent(caption="TagField",
category="Components",
xmlElement="tagField",
canvasBehaviour=INPUT_FIELD,
documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/vcl/components/tag-field.html",
icon="io/jmix/ui/icon/component/tagField.svg")
public interface TagField<V>
extends SuggestionFieldComponent<Collection<V>,V>, SupportsUserAction<Collection<V>>
The field that search and shows selected values as separated tags right in the field.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Enables to handle a user's entered text and add it to a TagField value.static class
Describes tag click event.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>
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionaddTagClickListener
(Consumer<TagField.TagClickEvent<V>> listener) Sets tag click listener.Comparator<? super V>
boolean
static <T> org.springframework.core.ParameterizedTypeReference<TagField<T>>
void
setClearAllVisible
(boolean visible) Display the button that clears all tags from the field.void
setSearchExecutor
(SuggestionFieldComponent.SearchExecutor<V> searchExecutor) SetsSuggestionFieldComponent.SearchExecutor
which performs search.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.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, isEmpty, 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.SupportsUserAction
setValueFromUser
Methods inherited from interface io.jmix.ui.component.Validatable
isValid, isValidateOnCommit, validate
-
Field Details
-
NAME
- See Also:
-
-
Method Details
-
of
-
setSearchExecutor
Description copied from interface:SuggestionFieldComponent
SetsSuggestionFieldComponent.SearchExecutor
which performs search.- Specified by:
setSearchExecutor
in interfaceSuggestionFieldComponent<Collection<V>,
V> - Parameters:
searchExecutor
- SearchExecutor instance
-
isClearAllVisible
boolean isClearAllVisible()- Returns:
- {code true} if clear button is visible
-
setClearAllVisible
@StudioProperty(name="clearAllVisible", defaultValue="false") void setClearAllVisible(boolean visible) Display the button that clears all tags from the field. The default value isfalse
.- Parameters:
visible
- whether to display clear button
-
getTagStyleProvider
- Returns:
- tag style provider or
null
if not set
-
setTagStyleProvider
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; } }
- Parameters:
tagStyleProvider
- tag style provider to set
-
getTagCaptionProvider
- Returns:
- tag caption provider or
null
if not set
-
setTagCaptionProvider
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(); }
- Parameters:
tagCaptionProvider
- caption provider to set
-
getTagComparator
- Returns:
- tag comparator
-
setTagComparator
Sets comparator for sorting tags in the UI.- Parameters:
tagComparator
- comparator to set
-
addTagClickListener
Sets tag click listener. It subscribes toTagField.TagClickEvent
that is invoked when user clicks on tag content.- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-