public class TagPickerImpl<V> extends ValuesPickerImpl<V> implements TagPicker<V>, org.springframework.beans.factory.InitializingBean
ValuePickerImpl.WebValuePickerActionHandler
TagPicker.TagClickEvent<V>, TagPicker.TagPickerAction, TagPicker.TagPosition
ValuePicker.FieldValueChangeEvent<V>, ValuePicker.ValuePickerAction
HasValue.ValueChangeEvent<V>
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
HasContextHelp.ContextHelpIconClickEvent
HasFilterMode.FilterMode
Modifier and Type | Field and Description |
---|---|
protected HasFilterMode.FilterMode |
filterMode |
protected boolean |
hideSelectedOptions |
protected io.jmix.core.metamodel.model.MetaClass |
metaClass |
static java.lang.String |
NOACTION_STYLENAME |
protected java.util.function.Function<? super V,java.lang.String> |
optionCaptionProvider |
protected OptionsBinding<V> |
optionsBinding |
protected java.util.function.Function<? super V,java.lang.String> |
tagCaptionProvider |
actionButtons, actionHandler, actionPropertyChangeListener, actions, actionsPermissions, fieldIconProvider, fieldListenerRegistration, formatter, metadataTools
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITY
internalValue, uiTestIdsSupport, valueBinding
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
TYPE_STRING
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
TagPickerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addAction(Action action,
int index)
Add an action to the component with index.
|
io.jmix.core.common.event.Subscription |
addFieldValueChangeListener(java.util.function.Consumer<ValuePicker.FieldValueChangeEvent<java.util.Collection<V>>> listener)
Adds a listener that will be fired in case field is editable.
|
io.jmix.core.common.event.Subscription |
addTagClickListener(java.util.function.Consumer<TagPicker.TagClickEvent<V>> listener)
Sets tag click listener.
|
protected void |
componentValueChanged(java.util.Collection<V> prevComponentValue,
java.util.Collection<V> newComponentValue,
boolean isUserOriginated) |
protected JmixTagPicker<V> |
createComponent() |
protected boolean |
filterItem(java.lang.String itemCaption,
java.lang.String filterText) |
protected java.lang.String |
generateDefaultItemCaption(V item) |
protected java.lang.String |
generateOptionCaption(V item) |
protected java.lang.String |
generateTagCaption(V item) |
protected JmixComboBox<V> |
getFieldInternal() |
HasFilterMode.FilterMode |
getFilterMode() |
Formatter<java.util.Collection<V>> |
getFormatter() |
java.lang.String |
getInputPrompt() |
protected JmixTagPicker<V> |
getJmixTagPicker() |
io.jmix.core.metamodel.model.MetaClass |
getMetaClass() |
java.util.function.Function<? super V,java.lang.String> |
getOptionCaptionProvider() |
Options<V> |
getOptions() |
java.util.function.Function<? super V,java.lang.String> |
getTagCaptionProvider() |
java.util.Comparator<? super V> |
getTagComparator() |
TagPicker.TagPosition |
getTagPosition() |
java.util.function.Function<? super V,java.lang.String> |
getTagStyleProvider() |
protected void |
hideSelectedOptionsInPresentation(java.util.Collection<V> compValue) |
protected void |
initComponent(JmixPickerField<java.util.Collection<V>> component) |
boolean |
isHideSelectedOptions() |
boolean |
isInlineTags() |
protected void |
onNewItemEntered(java.lang.String itemCaption) |
protected void |
onTagClick(V item) |
void |
removeAction(Action action)
Remove the action from the component
|
protected io.jmix.core.common.event.Subscription |
removeTagLabelClickListener(java.util.function.Consumer<TagPicker.TagClickEvent<V>> listener) |
void |
setFilterMode(HasFilterMode.FilterMode filterMode)
Sets filter mode for the dropdown list in the field.
|
void |
setFormatter(Formatter<? super java.util.Collection<V>> formatter) |
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 |
setInputPrompt(java.lang.String inputPrompt)
Sets the input prompt - a textual prompt that is displayed when the field
would otherwise be empty, to prompt the user for input.
|
protected void |
setItemsToPresentation(java.util.stream.Stream<V> options) |
void |
setMetaClass(io.jmix.core.metamodel.model.MetaClass metaClass)
Sets entity meta class to the field.
|
void |
setOptionCaptionProvider(java.util.function.Function<? super V,java.lang.String> optionCaptionProvider)
Sets function that provides caption for option items.
|
void |
setOptions(Options<V> options)
Sets options for UI component.
|
void |
setTagCaptionProvider(java.util.function.Function<? super V,java.lang.String> tagCaptionProvider)
Sets caption provider.
|
void |
setTagComparator(java.util.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(java.util.function.Function<? super V,java.lang.String> tagStyleProvider)
Sets tag style provider.
|
protected void |
setValueInternal(java.util.Collection<V> value,
boolean userOriginated) |
protected void |
updateNoActionStyle() |
convertToModel, convertToPresentation, equalCollections, fieldValueEquals, fireValueChange, getOldValue, isEmpty, setValue, setValueFromUser
actionPropertyChanged, addAction, afterPropertiesSet, applyDefaultValueFormat, commit, discard, focus, formatValue, generateOptionIcon, getAction, getActions, getActionsPermissions, getFieldIconProvider, getTabIndex, isBuffered, isFieldEditable, isModified, onFieldValueChange, refreshActionsState, removeAction, removeAllActions, setBuffered, setButtonIcon, setDebugId, setEditableToComponent, setFieldEditable, setFieldIconProvider, setFrame, setMetadataTools, setTabIndex, setUiComponentProperties, setupButtonAction
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validate
addValueChangeListener, getValue, getValueSource, setUiTestId, setUiTestIdsSupport, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnected
addAttachListener, addDetachListener, addStyleName, 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, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDescription, setDescriptionAsHtml, setEnabled, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
of
getFieldIconProvider, isFieldEditable, setFieldEditable, setFieldIconProvider
getValueSource, setValueSource
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValue
isEditable, isEditableWithParent, setEditable
getFrame, setFrame
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
isValid, isValidateOnCommit, validate
getIcon, setIcon, setIconFromSet
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
isCaptionAsHtml, setCaptionAsHtml
getCaption, setCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
addValidator, addValidators, getValidators, removeValidator
getRequiredMessage, isRequired, setRequired, setRequiredMessage
addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAllActions
commit, discard, isBuffered, isModified, setBuffered
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
setValueFromUser
setOptionsEnum, setOptionsList, setOptionsMap
public static final java.lang.String NOACTION_STYLENAME
protected OptionsBinding<V> optionsBinding
protected java.util.function.Function<? super V,java.lang.String> optionCaptionProvider
protected java.util.function.Function<? super V,java.lang.String> tagCaptionProvider
protected HasFilterMode.FilterMode filterMode
protected boolean hideSelectedOptions
protected io.jmix.core.metamodel.model.MetaClass metaClass
protected JmixTagPicker<V> createComponent()
createComponent
in class ValuesPickerImpl<V>
protected void initComponent(JmixPickerField<java.util.Collection<V>> component)
initComponent
in class ValuePickerImpl<java.util.Collection<V>>
protected void setValueInternal(@Nullable java.util.Collection<V> value, boolean userOriginated)
setValueInternal
in class ValuesPickerImpl<V>
@Nullable public Options<V> getOptions()
getOptions
in interface OptionsField<java.util.Collection<V>,V>
public void setOptions(@Nullable Options<V> options)
OptionsField
setOptions
in interface OptionsField<java.util.Collection<V>,V>
options
- optionsListOptions
protected void setItemsToPresentation(java.util.stream.Stream<V> options)
protected boolean filterItem(java.lang.String itemCaption, java.lang.String filterText)
public void setOptionCaptionProvider(@Nullable java.util.function.Function<? super V,java.lang.String> optionCaptionProvider)
HasOptionCaptionProvider
setOptionCaptionProvider
in interface HasOptionCaptionProvider<V>
optionCaptionProvider
- caption provider for options@Nullable public java.util.function.Function<? super V,java.lang.String> getOptionCaptionProvider()
getOptionCaptionProvider
in interface HasOptionCaptionProvider<V>
@Nullable public java.util.function.Function<? super V,java.lang.String> getTagCaptionProvider()
getTagCaptionProvider
in interface TagPicker<V>
null
if not setpublic void setTagCaptionProvider(@Nullable java.util.function.Function<? super V,java.lang.String> tagCaptionProvider)
TagPicker
For instance:
@Install(to = "tagPicker", subject = "tagCaptionProvider") private String tagPickerCaptionProvider(User user) { return "User: " + user.getUsername(); }
setTagCaptionProvider
in interface TagPicker<V>
tagCaptionProvider
- caption provider to set@Nullable public io.jmix.core.metamodel.model.MetaClass getMetaClass()
getMetaClass
in interface TagPicker<V>
null
public void setMetaClass(io.jmix.core.metamodel.model.MetaClass metaClass)
TagPicker
TagLookupAction
.setMetaClass
in interface TagPicker<V>
metaClass
- entity meta classpublic boolean isHideSelectedOptions()
isHideSelectedOptions
in interface TagPicker<V>
public void setHideSelectedOptions(boolean hide)
TagPicker
true
.setHideSelectedOptions
in interface TagPicker<V>
hide
- true
if selected options should be hidden, false
otherwisepublic io.jmix.core.common.event.Subscription addTagClickListener(java.util.function.Consumer<TagPicker.TagClickEvent<V>> listener)
TagPicker
TagPicker.TagClickEvent
that is invoked when
user clicks on tag content.addTagClickListener
in interface TagPicker<V>
listener
- listener to addprotected io.jmix.core.common.event.Subscription removeTagLabelClickListener(java.util.function.Consumer<TagPicker.TagClickEvent<V>> listener)
@Nullable public java.util.function.Function<? super V,java.lang.String> getTagStyleProvider()
getTagStyleProvider
in interface TagPicker<V>
null
if not setpublic void setTagStyleProvider(@Nullable java.util.function.Function<? super V,java.lang.String> tagStyleProvider)
TagPicker
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; } }
setTagStyleProvider
in interface TagPicker<V>
tagStyleProvider
- tag style provider to setpublic HasFilterMode.FilterMode getFilterMode()
getFilterMode
in interface HasFilterMode
public void setFilterMode(HasFilterMode.FilterMode filterMode)
HasFilterMode
setFilterMode
in interface HasFilterMode
filterMode
- filter mode to setpublic java.lang.String getInputPrompt()
getInputPrompt
in interface HasInputPrompt
public void setInputPrompt(java.lang.String inputPrompt)
HasInputPrompt
setInputPrompt
in interface HasInputPrompt
inputPrompt
- input promptpublic boolean isInlineTags()
isInlineTags
in interface TagPicker<V>
true
if tags should be placed inlinepublic void setInlineTags(boolean inline)
TagPicker
AUTO
.false
.setInlineTags
in interface TagPicker<V>
inline
- whether tags should be placed inlinepublic TagPicker.TagPosition getTagPosition()
getTagPosition
in interface TagPicker<V>
public void setTagPosition(TagPicker.TagPosition position)
TagPicker
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
.setTagPosition
in interface TagPicker<V>
position
- position to set@Nullable public java.util.Comparator<? super V> getTagComparator()
getTagComparator
in interface TagPicker<V>
public void setTagComparator(@Nullable java.util.Comparator<? super V> tagComparator)
TagPicker
setTagComparator
in interface TagPicker<V>
tagComparator
- comparator to setpublic void setFormatter(@Nullable Formatter<? super java.util.Collection<V>> formatter)
setFormatter
in interface HasFormatter<java.util.Collection<V>>
setFormatter
in class ValuePickerImpl<java.util.Collection<V>>
@Nullable public Formatter<java.util.Collection<V>> getFormatter()
getFormatter
in interface HasFormatter<java.util.Collection<V>>
getFormatter
in class ValuePickerImpl<java.util.Collection<V>>
public io.jmix.core.common.event.Subscription addFieldValueChangeListener(java.util.function.Consumer<ValuePicker.FieldValueChangeEvent<java.util.Collection<V>>> listener)
ValuePicker
addFieldValueChangeListener
in interface ValuePicker<java.util.Collection<V>>
addFieldValueChangeListener
in class ValuePickerImpl<java.util.Collection<V>>
listener
- a listener to addSubscription
objectValuePicker.setFieldEditable(boolean)
public void addAction(Action action, int index)
ActionsHolder
addAction
in interface ActionsHolder
addAction
in class ValuePickerImpl<java.util.Collection<V>>
public void removeAction(Action action)
ActionsHolder
removeAction
in interface ActionsHolder
removeAction
in class ValuePickerImpl<java.util.Collection<V>>
protected void updateNoActionStyle()
protected void componentValueChanged(java.util.Collection<V> prevComponentValue, java.util.Collection<V> newComponentValue, boolean isUserOriginated)
componentValueChanged
in class AbstractValueComponent<JmixPickerField<java.util.Collection<V>>,java.util.Collection<V>,java.util.Collection<V>>
protected void hideSelectedOptionsInPresentation(@Nullable java.util.Collection<V> compValue)
@Nullable protected java.lang.String generateOptionCaption(@Nullable V item)
@Nullable protected java.lang.String generateTagCaption(@Nullable V item)
protected java.lang.String generateDefaultItemCaption(V item)
protected JmixTagPicker<V> getJmixTagPicker()
protected JmixComboBox<V> getFieldInternal()
protected void onTagClick(V item)
protected void onNewItemEntered(java.lang.String itemCaption)