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.
  • Field Details

  • Method Details

    • getTagCaptionProvider

      @Nullable Function<? super V,String> getTagCaptionProvider()
      Returns:
      tag caption provider or null if not set
    • setTagCaptionProvider

      void setTagCaptionProvider(@Nullable Function<? super V,String> tagCaptionProvider)
      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

      Subscription addTagClickListener(Consumer<TagPicker.TagClickEvent<V>> listener)
      Sets tag click listener. It subscribes to TagPicker.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

      @Nullable Function<? super V,String> getTagStyleProvider()
      Returns:
      tag style provider or null if not set
    • setTagStyleProvider

      void setTagStyleProvider(@Nullable Function<? super V,String> tagStyleProvider)
      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

      @StudioProperty(name="inlineTags", defaultValue="false") 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. 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.
      The default value is false.
      Parameters:
      inline - whether tags should be placed inline
    • 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. The default value is TagPicker.TagPosition.BOTTOM.
      Parameters:
      position - position to set
    • getTagComparator

      @Nullable Comparator<? super V> getTagComparator()
      Returns:
      tag comparator
    • setTagComparator

      void setTagComparator(@Nullable Comparator<? super V> tagComparator)
      Sets comparator for sorting tags in the UI.
      Parameters:
      tagComparator - comparator to set
    • getMetaClass

      @Nullable MetaClass 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 use TagLookupAction.
      Parameters:
      metaClass - entity meta class
    • getPageLength

      int getPageLength()
      Returns:
      the page length of the suggestion popup.
    • setPageLength

      @StudioProperty(defaultValue="10") @PositiveOrZero void setPageLength(int pageLength)
      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 is true.
      Parameters:
      hide - true if selected options should be hidden, false otherwise