Package org.vaadin.tatu
Class TwinColSelect<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<TwinColSelect<T>,Set<T>>
org.vaadin.tatu.TwinColSelect<T>
- Type Parameters:
T- The bean type in TwinColSelect
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.HasValidation,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,,Set<T>>, Set<T>> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,,Set<T>>, Set<T>> com.vaadin.flow.data.binder.HasItemComponents<T>,com.vaadin.flow.data.provider.HasDataView<T,,Void, TwinColSelectDataView<T>> com.vaadin.flow.data.provider.HasListDataView<T,,TwinColSelectListDataView<T>> com.vaadin.flow.data.selection.MultiSelect<TwinColSelect<T>,,T> Serializable
@Tag("twin-col-select")
@CssImport("./twincolselect.css")
public class TwinColSelect<T>
extends com.vaadin.flow.component.AbstractField<TwinColSelect<T>,Set<T>>
implements com.vaadin.flow.data.binder.HasItemComponents<T>, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasTheme, com.vaadin.flow.data.selection.MultiSelect<TwinColSelect<T>,T>, com.vaadin.flow.data.provider.HasListDataView<T,TwinColSelectListDataView<T>>, com.vaadin.flow.data.provider.HasDataView<T,Void,TwinColSelectDataView<T>>
TwinColSelect component, also known as list builder. It is a component for
multiselection.
This is component consists of two lists. You can move items from the other
list to other. The left list is master list and backed by DataProvider. The
right list is the selection list and reflects the value of the selection.
The component also has drag and drop support.
- Author:
- Tatu Lund
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe column as LEFT, RIGHT, BOTHstatic enumDefines the filter modestatic enumDefines the picking modestatic enumstatic classClass for defining internationalization textsNested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.data.binder.HasItemComponents
com.vaadin.flow.data.binder.HasItemComponents.ItemComponent<T extends Object>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddSelectionListener(com.vaadin.flow.data.selection.MultiSelectionListener<TwinColSelect<T>, T> listener) voidaddThemeVariants(TwinColSelectVariant... variants) Adds theme variants to the component.voidclear()voidclearTicks(TwinColSelect.ColType column) Clear the ticks for specified column(s) without affecting the selection.com.vaadin.flow.data.provider.DataProvider<T,?> Deprecated.com.vaadin.flow.dom.ElementGets the current error message from the twincolselect.getI18n()Gets the internationalization object previously set for this component.com.vaadin.flow.function.SerializablePredicate<T>Returns the item enabled predicate.com.vaadin.flow.component.ItemLabelGenerator<T>Gets the item label generator that is used to produce the strings shown in the twincolselect for each item.getLabel()Gets the label of the twincolselect.Gets the tooltip generator that is used to produce the strings shown in the twincolselect for each item.booleanReturns if ticks are currently set to be cleared or not.protected booleanbooleanbooleanDetermines whether the twincolselect is marked as input required.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent) voidremoveThemeVariants(TwinColSelectVariant... variants) Removes theme variants from the component.voidsetAddButtonCaption(String text) voidsetAddButtonIcon(com.vaadin.flow.component.Component icon) voidsetAllButtonCaption(String text) voidsetAllButtonIcon(com.vaadin.flow.component.Component icon) voidsetClearButtonCaption(String text) voidsetClearButtonIcon(com.vaadin.flow.component.Component icon) voidsetClearTicks(boolean clearTicksOnSelect) Clear the ticks after selection action.voidsetDataProvider(com.vaadin.flow.data.provider.DataProvider<T, ?> dataProvider) Deprecated.voidsetErrorMessage(String errorMessage) voidsetFilterMode(TwinColSelect.FilterMode filterMode) Define how data providers filter is applied.voidSets the internationalization properties (texts used for button tooltips) for this component.voidsetInvalid(boolean invalid) voidsetItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T> itemEnabledProvider) Sets the item enabled predicate for this twincolselect.voidsetItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) Sets the item label generator that is used to produce the strings shown in the twincolselect for each item.voidvoidSet the caption label of the twincolselectvoidsetPickMode(TwinColSelect.PickMode pickMode) Set the used PickMode, default is PickMode.DOUBLE.protected voidsetPresentationValue(Set<T> newPresentationValue) voidsetReadOnly(boolean readOnly) voidvoidsetRecycleButtonIcon(com.vaadin.flow.component.Component icon) voidsetRemoveButtonCaption(String text) voidsetRemoveButtonIcon(com.vaadin.flow.component.Component icon) voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) voidsetSortMode(TwinColSelect.SortMode sortMode) Define how filters are applied with sorting.voidsetTooltipGenerator(com.vaadin.flow.function.SerializableFunction<T, String> tooltipGenerator) Sets the tooltip generator that is used to produce the tooltips shown in the twincolselect for each item.voidSets the value of this component.voidupdateSelection(Set<T> addedItems, Set<T> removedItems) protected booleanvalueEquals(Set<T> value1, Set<T> value2) Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getValue, isEmpty, setModelValueMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.data.binder.HasItemComponents
addComponents, getItemPosition, prependComponentsMethods inherited from interface com.vaadin.flow.data.provider.HasListDataView
setItems, setItemsMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, getOptionalValue, isEmptyMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnlyMethods inherited from interface com.vaadin.flow.data.selection.MultiSelect
deselect, deselect, deselectAll, getValue, isSelected, select, select
-
Constructor Details
-
TwinColSelect
public TwinColSelect()Default constructor -
TwinColSelect
-
-
Method Details
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,Set<T>>, Set<T>> - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,Set<T>>, Set<T>>
-
isRequiredIndicatorVisible
public boolean isRequiredIndicatorVisible()Determines whether the twincolselect is marked as input required.- Specified by:
isRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,Set<T>>, Set<T>> - Specified by:
isRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,Set<T>>, Set<T>> - Returns:
trueif the input is required,falseotherwise
-
setLabel
Set the caption label of the twincolselect- Parameters:
label- The label as String
-
getLabel
Gets the label of the twincolselect.- Returns:
- the of the twincolselect
-
setItemLabelGenerator
public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) Sets the item label generator that is used to produce the strings shown in the twincolselect for each item. By default,String.valueOf(Object)is used.- Parameters:
itemLabelGenerator- the item label provider to use, not null
-
setTooltipGenerator
public void setTooltipGenerator(com.vaadin.flow.function.SerializableFunction<T, String> tooltipGenerator) Sets the tooltip generator that is used to produce the tooltips shown in the twincolselect for each item. By default,String.valueOf(Object)is used.- Parameters:
tooltipGenerator- the item label provider to use, set null to disable tooltips.
-
setItemEnabledProvider
public void setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T> itemEnabledProvider) Sets the item enabled predicate for this twincolselect. The predicate is applied to each item to determine whether the item should be enabled (true) or disabled (false). Disabled items are displayed as grayed out and the user cannot select them. The default predicate always returns true (all the items are enabled).- Parameters:
itemEnabledProvider- the item enable predicate, notnull
-
getItemLabelGenerator
Gets the item label generator that is used to produce the strings shown in the twincolselect for each item.- Returns:
- the item label generator used, not null
-
getTooltipGenerator
Gets the tooltip generator that is used to produce the strings shown in the twincolselect for each item.- Returns:
- the tooltip generator used
-
getItemEnabledProvider
Returns the item enabled predicate.- Returns:
- the item enabled predicate
- See Also:
-
isDisabledBoolean
protected boolean isDisabledBoolean() -
getEmptyValue
- Specified by:
getEmptyValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,Set<T>>, Set<T>> - Specified by:
getEmptyValuein interfacecom.vaadin.flow.data.selection.MultiSelect<TwinColSelect<T>,T> - Overrides:
getEmptyValuein classcom.vaadin.flow.component.AbstractField<TwinColSelect<T>,Set<T>>
-
getElement
public com.vaadin.flow.dom.Element getElement()- Specified by:
getElementin interfacecom.vaadin.flow.component.HasElement- Overrides:
getElementin classcom.vaadin.flow.component.Component
-
setInvalid
public void setInvalid(boolean invalid) - Specified by:
setInvalidin interfacecom.vaadin.flow.component.HasValidation
-
clear
public void clear() -
clearTicks
Clear the ticks for specified column(s) without affecting the selection.- Parameters:
column- The column(s) from which to clear the ticks
-
setClearTicks
public void setClearTicks(boolean clearTicksOnSelect) Clear the ticks after selection action. Default is false.- Parameters:
clearTicksOnSelect- A boolean value
-
isClearTicksOnSelect
public boolean isClearTicksOnSelect()Returns if ticks are currently set to be cleared or not.- Returns:
- A boolean value
-
setValue
Sets the value of this component. If the new value is not equal to the previous value, fires a value change event.The component doesn't accept
nullvalues. The value of a checkbox group without any selected items is an empty set. You can use theclear()method to set the empty value.- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,Set<T>>, Set<T>> - Specified by:
setValuein interfacecom.vaadin.flow.data.selection.MultiSelect<TwinColSelect<T>,T> - Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<TwinColSelect<T>,Set<T>> - Parameters:
value- the new value to set, notnull- Throws:
NullPointerException- if value isnull
-
isInvalid
public boolean isInvalid()- Specified by:
isInvalidin interfacecom.vaadin.flow.component.HasValidation
-
setDataProvider
@Deprecated public void setDataProvider(com.vaadin.flow.data.provider.DataProvider<T, ?> dataProvider) Deprecated. -
addThemeVariants
Adds theme variants to the component.- Parameters:
variants- theme variants to add
-
removeThemeVariants
Removes theme variants from the component.- Parameters:
variants- theme variants to remove
-
getSelectedItems
- Specified by:
getSelectedItemsin interfacecom.vaadin.flow.data.selection.MultiSelect<TwinColSelect<T>,T>
-
updateSelection
- Specified by:
updateSelectionin interfacecom.vaadin.flow.data.selection.MultiSelect<TwinColSelect<T>,T>
-
setErrorMessage
- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.HasValidation
-
getErrorMessage
Gets the current error message from the twincolselect.- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Returns:
- the current error message
-
addSelectionListener
public com.vaadin.flow.shared.Registration addSelectionListener(com.vaadin.flow.data.selection.MultiSelectionListener<TwinColSelect<T>, T> listener) - Specified by:
addSelectionListenerin interfacecom.vaadin.flow.data.selection.MultiSelect<TwinColSelect<T>,T>
-
setPresentationValue
- Specified by:
setPresentationValuein classcom.vaadin.flow.component.AbstractField<TwinColSelect<T>,Set<T>>
-
getDataProvider
Deprecated. -
setReadOnly
public void setReadOnly(boolean readOnly) - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,Set<T>>, Set<T>> - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TwinColSelect<T>,Set<T>>, Set<T>>
-
setFilterMode
Define how data providers filter is applied.- Parameters:
filterMode- FilterMode
-
setSortMode
Define how filters are applied with sorting.Note: This is for performance optimization when also filtering is applied.
- Parameters:
sortMode- SortMode
-
setAllButtonCaption
-
setAllButtonIcon
public void setAllButtonIcon(com.vaadin.flow.component.Component icon) -
setClearButtonCaption
-
setClearButtonIcon
public void setClearButtonIcon(com.vaadin.flow.component.Component icon) -
setRecycleButtonCaption
-
setRecycleButtonIcon
public void setRecycleButtonIcon(com.vaadin.flow.component.Component icon) -
setRemoveButtonCaption
-
setRemoveButtonIcon
public void setRemoveButtonIcon(com.vaadin.flow.component.Component icon) -
setAddButtonCaption
-
setAddButtonIcon
public void setAddButtonIcon(com.vaadin.flow.component.Component icon) -
getGenericDataView
- Specified by:
getGenericDataViewin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, TwinColSelectDataView<T>>
-
setItems
public TwinColSelectDataView<T> setItems(com.vaadin.flow.data.provider.DataProvider<T, Void> dataProvider) - Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, TwinColSelectDataView<T>>
-
setItems
public TwinColSelectDataView<T> setItems(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider) - Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, TwinColSelectDataView<T>>
-
getListDataView
- Specified by:
getListDataViewin interfacecom.vaadin.flow.data.provider.HasListDataView<T,TwinColSelectListDataView<T>>
-
setItems
public TwinColSelectListDataView<T> setItems(com.vaadin.flow.data.provider.ListDataProvider<T> dataProvider) - Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasListDataView<T,TwinColSelectListDataView<T>>
-
setItems
-
valueEquals
- Overrides:
valueEqualsin classcom.vaadin.flow.component.AbstractField<TwinColSelect<T>,Set<T>>
-
setPickMode
Set the used PickMode, default is PickMode.DOUBLE.- Parameters:
pickMode- The PickMode.
-
setI18n
Sets the internationalization properties (texts used for button tooltips) for this component.- Parameters:
i18n- the internationalized properties, null to disable all tooltips.
-
getI18n
Gets the internationalization object previously set for this component.- Returns:
- the i18n object. It will be
null, If the i18n properties weren't set.
-