Package io.jmix.ui.component
Interface TagPicker<V>
- Type Parameters:
V
- type of value
- All Superinterfaces:
ActionsHolder
,Buffered
,Component
,Component.BelongToFrame
,Component.Editable
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Field<Collection<V>>
,HasContextHelp
,HasFilterMode
,HasFormatter<Collection<V>>
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,HasInputPrompt
,HasOptionCaptionProvider<V>
,HasSubParts
,HasValidator<Collection<V>>
,HasValue<Collection<V>>
,HasValueSource<Collection<V>>
,OptionsField<Collection<V>,
,V> Requirable
,SupportsUserAction<Collection<V>>
,Validatable
,ValuePicker<Collection<V>>
,ValuesPicker<V>
- All Known Implementing Classes:
TagPickerImpl
@StudioComponent(caption="TagPicker",
category="Components",
xmlElement="tagPicker",
icon="io/jmix/ui/icon/component/tagPicker.svg",
canvasBehaviour=COMBO_BOX,
documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/vcl/components/tag-picker.html",
unsupportedProperties={"fieldEditable","optionsEnum"})
public interface TagPicker<V>
extends ValuesPicker<V>, OptionsField<Collection<V>,V>, HasInputPrompt, HasFilterMode
The field that shows selected values as separated closable tags which are placed near to the field.
The field also contains a set of buttons defined by actions.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Describes tag click event.static interface
The interface that marks implementation asTagPicker
's action.static enum
Defines position of tags relative to the field.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.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.ValuePicker
ValuePicker.FieldValueChangeEvent<V>, ValuePicker.ValuePickerAction
-
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.ValuesPicker
TYPE_STRING
-
Method Summary
Modifier and TypeMethodDescriptionaddTagClickListener
(Consumer<TagPicker.TagClickEvent<V>> listener) Sets tag click listener.int
Comparator<? super V>
boolean
boolean
void
setHideSelectedOptions
(boolean hide) Sets whether the field should hide options from the dropdown list if they have already selected.void
setInlineTags
(boolean inline) Defines how tags should be oriented in the field: inline = true - tags will be shown one after another in one line if it will be enough available space.void
setMetaClass
(MetaClass metaClass) Sets entity meta class to the field.void
setPageLength
(int pageLength) Sets the page length for the suggestion popup.void
setTagCaptionProvider
(Function<? super V, String> tagCaptionProvider) Sets caption provider.void
setTagComparator
(Comparator<? super V> tagComparator) Sets comparator for sorting tags in the UI.void
setTagPosition
(TagPicker.TagPosition position) Sets position where tags should be placed relative to the field.void
setTagStyleProvider
(Function<? super V, String> tagStyleProvider) Sets tag style provider.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.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.HasFilterMode
getFilterMode, setFilterMode
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.HasOptionCaptionProvider
getOptionCaptionProvider, setOptionCaptionProvider
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.OptionsField
getOptions, setOptions, setOptionsEnum, setOptionsList, setOptionsMap
Methods inherited from interface io.jmix.ui.component.Requirable
getRequiredMessage, isRequired, setRequired, setRequiredMessage
Methods inherited from interface io.jmix.ui.component.SupportsUserAction
setValueFromUser
Methods inherited from interface io.jmix.ui.component.Validatable
isValid, isValidateOnCommit, validate
Methods inherited from interface io.jmix.ui.component.ValuePicker
addFieldValueChangeListener, getFieldIconProvider, isFieldEditable, setFieldEditable, setFieldIconProvider
-
Field Details
-
NAME
- See Also:
-
-
Method Details
-
getTagCaptionProvider
- Returns:
- tag caption provider or
null
if not set
-
setTagCaptionProvider
Sets caption provider. It is used for generating tag caption.For instance:
@Install(to = "tagPicker", subject = "tagCaptionProvider") private String tagPickerCaptionProvider(User user) { return "User: " + user.getUsername(); }
- Parameters:
tagCaptionProvider
- caption provider to set
-
addTagClickListener
Sets tag click listener. It subscribes toTagPicker.TagClickEvent
that is invoked when user clicks on tag content.- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
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 = "tagPicker", subject = "tagStyleProvider") private String tagPickerTagStyleProvider(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
-
isInlineTags
boolean isInlineTags()- Returns:
true
if tags should be placed inline
-
setInlineTags
Defines how tags should be oriented in the field:- inline = true - tags will be shown one after another in one line if it will be enough available space.
Otherwise, the next tags will be moved to another line. The width of the tag is
AUTO
. - inline = false - tags will be shown under each other. Tag occupies all available space on the line.
false
.- Parameters:
inline
- whether tags should be placed inline
- inline = true - tags will be shown one after another in one line if it will be enough available space.
Otherwise, the next tags will be moved to another line. The width of the tag is
-
getTagPosition
TagPicker.TagPosition getTagPosition()- Returns:
- position of tags relative to the field
-
setTagPosition
@StudioProperty(name="tagPosition", type=ENUMERATION, defaultValue="BOTTOM", options={"TOP","RIGHT","BOTTOM","LEFT"}) void setTagPosition(TagPicker.TagPosition position) Sets position where tags should be placed relative to the field.TagPicker.TagPosition.TOP
- tags are placed above the field.TagPicker.TagPosition.RIGHT
- tags are placed to the right of the field.TagPicker.TagPosition.BOTTOM
- tags are placed under the field.TagPicker.TagPosition.LEFT
- tags are placed to the left of the field.
TagPicker.TagPosition.BOTTOM
.- Parameters:
position
- position to set
-
getTagComparator
- Returns:
- tag comparator
-
setTagComparator
Sets comparator for sorting tags in the UI.- Parameters:
tagComparator
- comparator to set
-
getMetaClass
- Returns:
- entity meta class or
null
-
setMetaClass
@StudioProperty(name="metaClass", type=ENTITY_NAME, typeParameter="V") void setMetaClass(MetaClass metaClass) Sets entity meta class to the field. It enables to use field with entity type without data container and useTagLookupAction
.- Parameters:
metaClass
- entity meta class
-
getPageLength
int getPageLength()- Returns:
- the page length of the suggestion popup.
-
setPageLength
Sets the page length for the suggestion popup. Setting the page length to 0 will disable suggestion popup paging (all items visible).- Parameters:
pageLength
- the pageLength to set
-
isHideSelectedOptions
boolean isHideSelectedOptions()- Returns:
- is selected options is hidden from the dropdown list
-
setHideSelectedOptions
@StudioProperty(name="hideSelectedOptions", defaultValue="false") void setHideSelectedOptions(boolean hide) Sets whether the field should hide options from the dropdown list if they have already selected. The default value istrue
.- Parameters:
hide
-true
if selected options should be hidden,false
otherwise
-