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.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested classes/interfaces inherited from interface io.jmix.ui.component.HasEnterPressHandler
HasEnterPressHandler.EnterPressEventNested 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, searchExecutorFields inherited from class io.jmix.ui.component.impl.AbstractField
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITYFields inherited from class io.jmix.ui.component.impl.AbstractValueComponent
internalValue, uiTestIdsSupport, valueBindingFields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZEFields inherited from interface io.jmix.ui.component.SuggestionFieldComponent
POPUP_AUTO_WIDTH, POPUP_PARENT_WIDTH -
Constructor Summary
Constructors -
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 booleanequalCollections(Collection<V> a, Collection<V> b) protected booleanfieldValueEquals(Collection<V> value, Collection<V> oldValue) Comparator<? super V>booleanbooleanisEmpty()protected voidonTagClick(V item) protected SubscriptionremoveTagClickListener(Consumer<TagField.TagClickEvent<V>> listener) voidsetClearAllVisible(boolean visible) Display the button that clears all tags from the field.voidsetTagCaptionProvider(Function<? super V, String> tagCaptionProvider) Sets tag caption provider.voidsetTagComparator(Comparator<? super V> tagComparator) Sets comparator for sorting tags in the UI.voidsetTagStyleProvider(Function<? super V, String> tagStyleProvider) Sets tag style provider.voidsetValueFromUser(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, showSuggestionsMethods 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, validateMethods 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, valueBindingConnectedMethods 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, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.Editable
isEditable, isEditableWithParent, setEditableMethods inherited from interface io.jmix.ui.component.Component.Focusable
focus, getTabIndex, isFocusable, setFocusable, setTabIndexMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledMethods inherited from interface io.jmix.ui.component.HasEnterPressHandler
getEnterPressHandler, setEnterPressHandlerMethods inherited from interface io.jmix.ui.component.HasFormatter
getFormatter, setFormatterMethods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabledMethods inherited from interface io.jmix.ui.component.HasInputPrompt
getInputPrompt, setInputPromptMethods inherited from interface io.jmix.ui.component.HasOptionStyleProvider
getOptionStyleProvider, setOptionStyleProviderMethods inherited from interface io.jmix.ui.component.HasValidator
addValidator, addValidators, getValidators, removeValidatorMethods inherited from interface io.jmix.ui.component.HasValue
addValueChangeListener, clear, getEmptyValue, getValue, setValueMethods inherited from interface io.jmix.ui.component.data.HasValueSource
getValueSource, setValueSourceMethods inherited from interface io.jmix.ui.component.Requirable
getRequiredMessage, isRequired, setRequired, setRequiredMessageMethods inherited from interface io.jmix.ui.component.SuggestionFieldComponent
getArrowDownHandler, getAsyncSearchDelayMs, getMinSearchStringLength, getPopupWidth, getSearchExecutor, getSuggestionsLimit, setArrowDownHandler, setAsyncSearchDelayMs, setMinSearchStringLength, setPopupWidth, setSuggestionsLimit, showSuggestionsMethods inherited from interface io.jmix.ui.component.TagField
setSearchExecutorMethods 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:
isClearAllVisiblein interfaceTagField<V>- Returns:
- {code true} if clear button is visible
-
setClearAllVisible
public void setClearAllVisible(boolean visible) Description copied from interface:TagFieldDisplay the button that clears all tags from the field. The default value isfalse.- Specified by:
setClearAllVisiblein interfaceTagField<V>- Parameters:
visible- whether to display clear button
-
getTagStyleProvider
- Specified by:
getTagStyleProviderin interfaceTagField<V>- Returns:
- tag style provider or
nullif not set
-
setTagStyleProvider
Description copied from interface:TagFieldSets 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:
setTagStyleProviderin interfaceTagField<V>- Parameters:
tagStyleProvider- tag style provider to set
-
getTagCaptionProvider
- Specified by:
getTagCaptionProviderin interfaceTagField<V>- Returns:
- tag caption provider or
nullif not set
-
setTagCaptionProvider
Description copied from interface:TagFieldSets 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:
setTagCaptionProviderin interfaceTagField<V>- Parameters:
tagCaptionProvider- caption provider to set
-
getTagComparator
- Specified by:
getTagComparatorin interfaceTagField<V>- Returns:
- tag comparator
-
setTagComparator
Description copied from interface:TagFieldSets comparator for sorting tags in the UI.- Specified by:
setTagComparatorin interfaceTagField<V>- Parameters:
tagComparator- comparator to set
-
addTagClickListener
Description copied from interface:TagFieldSets tag click listener. It subscribes toTagField.TagClickEventthat is invoked when user clicks on tag content.- Specified by:
addTagClickListenerin interfaceTagField<V>- Parameters:
listener- listener to add- Returns:
- a registration object for removing an event listener
-
removeTagClickListener
-
fieldValueEquals
- Overrides:
fieldValueEqualsin classAbstractValueComponent<JmixTagField<V>,Collection<V>, Collection<V>>
-
equalCollections
-
onTagClick
-
setValueFromUser
Description copied from interface:SupportsUserActionSets the value of this component as if the user had set it. The user originated attribute is only used for theHasValue.ValueChangeEvent.- Specified by:
setValueFromUserin interfaceSupportsUserAction<V>- Parameters:
value- the new value
-
isEmpty
public boolean isEmpty() -
convertToModel
protected Collection<V> convertToModel(@Nullable Collection<V> componentRawValue) throws ConversionException - Overrides:
convertToModelin classAbstractValueComponent<JmixTagField<V>,Collection<V>, Collection<V>> - Throws:
ConversionException
-