V - the type of the object inside the inputpublic abstract class AbstractTagsInput<T extends AbstractTagsInput<T,V>,V> extends AbstractValueBox<T,elemental2.dom.HTMLElement,List<V>>
This component provides an input field which takes multiple values and each value is represented in a tag. It also provides a suggestion feature to list all the items in a store for the user to select from it.
Customize the component can be done by overwriting classes provided by TagStyles
For example:
TagsInput.create("Free tag")
.setPlaceholder("Type anything...")
.value(Collections.singletonList("Hey! how are you?"))
// with a store
Person schroeder_coleman = new Person(1, "Schroeder Coleman");
LocalTagsStore personsStore =
LocalTagsStore.create()
.addItem("Schroeder Coleman", schroeder_coleman)
.addItem("Renee Mcintyre", new Person(2, "Renee Mcintyre"))
.addItem("Casey Garza", new Person(3, "Casey Garza"));
TagsInput objectTags = TagsInput.create("Friends", personsStore);
objectTags.setValue(Collections.singletonList(schroeder_coleman));
AbstractValueBoxValueBox.AutoValidate, ValueBox.AutoValidatorBasicFormElement.FieldHandler<T>BaseDominoElement.ElementHandler<T>, BaseDominoElement.ResizeHandler<T>, BaseDominoElement.StyleEditor<E extends elemental2.dom.HTMLElement,T extends org.jboss.elemento.IsElement<E>>, BaseDominoElement.WavesStylerHasChangeHandlers.ChangeHandler<V>HasValidation.ValidatorchangeHandlers, changeListener, DISABLED, fieldContainer, fieldGroup, FLOATING, FOCUSED, inputContainer, inputListenerelement| Constructor and Description |
|---|
AbstractTagsInput(String label,
TagsStore<V> store) |
| Modifier and Type | Method and Description |
|---|---|
T |
addValue(V value)
Adds a new value.
|
void |
appendChip(Chip chip,
V value)
Appends a new chip representing to the value
|
void |
appendChip(String displayValue,
V value)
Appends a value as a chip with a display value
|
protected void |
clearValue(boolean silent)
clear the field value
|
protected ValueBox.AutoValidator |
createAutoValidator(ValueBox.AutoValidate autoValidate)
Create an AutoValidator that will automatically validate the component when it loses focus
|
protected elemental2.dom.HTMLElement |
createInputElement(String type)
Creates an input element with the specified type
|
T |
disable() |
T |
disableUserInput()
Disables the ability for typing in the input field and all values should be selected from the
suggestion drop down
|
protected void |
doSetValue(List<V> values) |
T |
enable() |
T |
enableUserInput()
Enables the ability for typing in the input field
|
int |
getMaxValue()
Gets the maximum number of selected values
|
String |
getStringValue() |
TagsStore<V> |
getTagsStore() |
List<V> |
getValue() |
boolean |
isEmpty() |
boolean |
isEmptyIgnoreSpaces() |
T |
setDropDownPosition(DropDownPosition position)
Sets the position of the suggestion drop down
|
T |
setMaxValue(int maxSize)
Sets the maximum number of selected values
|
T |
setPlaceholder(String placeholder) |
T |
setTagsColor(ColorScheme colorScheme)
Sets the color scheme that will be used for tags
|
T |
setTagsStore(TagsStore<V> store) |
getMaxLength, getMinLength, getMinLengthErrorMessage, setMaxLength, setMinLength, setMinLengthErrorMessage, setReadOnly, updateCharacterCount, valueaddChangeHandler, addLeftAddOn, addLeftAddOn, addLeftAddOn, addOnClearHandler, addRightAddOn, addRightAddOn, addRightAddOn, allowEmptyLabel, asTableField, autoValidate, callChangeHandlers, changeLabelFloating, clear, clear, clearInvalid, clearValue, condense, createLabelElement, createMandatoryAddOn, doFocus, doUnfocus, element, floating, floatLabel, focus, getAdditionalInfoContainer, getCountItem, getErrorItem, getErrorsContainer, getFieldContainer, getFieldGroup, getFieldInputContainer, getFieldStyle, getFocusColor, getHelperContainer, getHelpItem, getInputContainer, getInputElement, getLabelElement, getLabelTextElement, getLeftAddonContainer, getLeftAddOnsContainer, getMandatoryAddOn, getNotesContainer, getOnClearHandlers, getPlaceholder, getPostfix, getPostFixItem, getPrefix, getPrefixItem, getRightAddonContainer, getRightAddOnsContainer, hasChangeHandler, hideLabelText, hidePlaceholder, invalidate, invalidate, isAddFocusColor, isAutoValidation, isFloating, isFocused, isReadOnly, linkLabelToField, nonfloating, onEnterKey, pauseChangeHandlers, pauseFocusValidation, removeChangeHandler, removeLeftAddOn, removeLeftAddOn, removeLeftAddOn, removeLeftAddOn, removeLeftAddOns, removeOnClearHandler, removeRightAddOn, removeRightAddOn, removeRightAddOn, removeRightAddOn, removeRightAddOns, resumeChangeHandlers, resumeFocusValidation, setAutoValidation, setFieldStyle, setFixErrorsPosition, setFloating, setFocusColor, setLabel, setLabel, setLabel, setLabel, setLabelTextVisible, setPauseChangeHandlers, setPostFix, setPrefix, setSpellCheck, setTableField, shouldShowPlaceholder, showLabelText, showPlaceholder, spread, unfloatLabel, unfocus, updateLabel, valueaddValidator, getErrorLabels, getErrors, getHelperText, getLabel, getName, getRequiredErrorMessage, groupBy, hasValidator, isDisabled, isEnabled, isFixErrorsPosition, isRequired, isShowRequiredIndicator, isValidationDisabled, makeErrorLabel, removeValidator, setHelperText, setName, setRequired, setRequired, setRequiredErrorMessage, setShowRequiredIndicator, setValidationDisabled, setValue, showErrors, ungroup, validate, withValidationDisabledadd, add, addClickListener, addCss, addCss, addEventListener, addEventListener, addEventsListener, addHideListener, addShowListener, alignCenter, alignRight, appendChild, appendChild, apply, attr, blur, childNodes, clearElement, contains, contains, contains, containsCss, css, css, cssClassByIndex, cssClassesCount, cssText, elevate, elevate, firstChild, getAttachObserver, getAttribute, getBoundingClientRect, getChildElementCount, getClickableElement, getCollapsible, getCollapsibleElement, getDetachObserver, getDominoId, getElementsCount, getElevation, getFirstChild, getId, getTextContent, getTooltip, getWavesElement, hasAttribute, hasChildNodes, hasDirectChild, hide, hideOn, id, init, insertAfter, insertAfter, insertAfter, insertAfter, insertBefore, insertBefore, insertBefore, insertBefore, insertFirst, insertFirst, insertFirst, isAttached, isCollapsed, isEmptyElement, isEqualNode, isForceHidden, isHidden, item, lastChild, length, onAttached, onDetached, onResize, pullLeft, pullRight, querySelector, querySelectorAll, remove, removeAttachObserver, removeAttribute, removeChild, removeChild, removeCss, removeCss, removeCssProperty, removeDetachObserver, removeEventListener, removeEventListener, removeHideListener, removeHideOn, removeShowListener, removeShowOn, removeTooltip, removeWaves, replaceCss, setAlignItems, setAttribute, setAttribute, setAttribute, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBottom, setBottom, setBoxShadow, setCollapseStrategy, setColor, setColor, setContent, setContent, setCssProperty, setCssProperty, setCursor, setCursor, setDisabled, setDisplay, setDisplay, setDropMenu, setFlex, setFloat, setFloat, setFontSize, setFontSize, setForceHidden, setHeight, setHeight, setId, setInnerHtml, setLeft, setLeft, setLineHeight, setLineHeight, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setOpacity, setOpacity, setOverFlow, setOverFlow, setOverFlowY, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPointerEvents, setPosition, setPosition, setRight, setRight, setTabIndex, setTextAlign, setTextAlign, setTextContent, setTooltip, setTooltip, setTooltip, setTooltip, setTop, setTop, setTransitionDuration, setWidth, setWidth, setZIndex, show, showOn, style, style, styler, textContent, toggleDisplay, toggleDisplay, withWaves, withWavesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvalidateAllisExpandedadd, add, remove, remove, removeProperty, replace, setProperty, setPropertyprotected elemental2.dom.HTMLElement createInputElement(String type)
ValueBoxcreateInputElement in class ValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>type - String the input element typeprotected void clearValue(boolean silent)
ValueBoxclearValue in class ValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>protected void doSetValue(List<V> values)
doSetValue in class ValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>values - V the value to set for this fieldpublic T setTagsStore(TagsStore<V> store)
store - TagsStorepublic T addValue(V value)
The value itself should be exist in the store, in case of dynamic store, the value
will be string and will be added automatically
value - the new value to addpublic void appendChip(String displayValue, V value)
displayValue - the display of the valuevalue - the value objectpublic void appendChip(Chip chip, V value)
chip - the Chipvalue - the value objectpublic boolean isEmpty()
isEmpty in interface HasGrouping<T extends AbstractTagsInput<T,V>>isEmpty in class AbstractValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>public boolean isEmptyIgnoreSpaces()
isEmptyIgnoreSpaces in interface HasGrouping<T extends AbstractTagsInput<T,V>>isEmptyIgnoreSpaces in class AbstractValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>public T setPlaceholder(String placeholder)
setPlaceholder in interface HasPlaceHolder<T extends AbstractTagsInput<T,V>>setPlaceholder in class ValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>placeholder - String placeholderpublic T setDropDownPosition(DropDownPosition position)
position - the DropDownPositionpublic T disable()
disable in interface Switchable<T extends AbstractTagsInput<T,V>>disable in class ValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>public T enable()
enable in interface Switchable<T extends AbstractTagsInput<T,V>>enable in class ValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>public T setTagsColor(ColorScheme colorScheme)
colorScheme - the ColorSchemepublic T setMaxValue(int maxSize)
maxSize - the maximum sizepublic int getMaxValue()
public String getStringValue()
getStringValue in interface HasInputElementgetStringValue in class ValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>public T disableUserInput()
public T enableUserInput()
protected ValueBox.AutoValidator createAutoValidator(ValueBox.AutoValidate autoValidate)
ValueBoxcreateAutoValidator in class ValueBox<T extends AbstractTagsInput<T,V>,elemental2.dom.HTMLElement,List<V>>autoValidate - ValueBox.AutoValidateCopyright © 2019–2022 Dominokit. All rights reserved.