Package com.vaadin.componentfactory
Class TreeComboBox<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<TreeComboBox<T>,T>
com.vaadin.componentfactory.TreeComboBox<T>
- Type Parameters:
T- Bean type used in TreeData
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<TreeComboBox<T>>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<TreeComboBox<T>>,com.vaadin.flow.component.FocusNotifier<TreeComboBox<T>>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasHelper,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasValidation,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,,T>, T> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,,T>, T> com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T>,com.vaadin.flow.data.selection.SingleSelect<TreeComboBox<T>,,T> Serializable
@Tag("div")
public class TreeComboBox<T>
extends com.vaadin.flow.component.AbstractField<TreeComboBox<T>,T>
implements com.vaadin.flow.data.selection.SingleSelect<TreeComboBox<T>,T>, com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T>, com.vaadin.flow.component.Focusable<TreeComboBox<T>>, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.shared.HasTooltip
This is hierarchical ComboBox type single select component. It currently
works with in-memory data providers, i.e. TreeDataProvider, it supports
filtering, but not adding new items on the fly.
- Author:
- Tatu Lund
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Constructor Summary
ConstructorsConstructorDescriptionTreeComboBox(com.vaadin.flow.data.provider.hierarchy.TreeData<T> treeData, com.vaadin.flow.function.ValueProvider<T, String> valueProvider) Constructs a new TreeComboBox Component with given caption andTreeData.TreeComboBox(com.vaadin.flow.data.provider.hierarchy.TreeDataProvider<T> dataProvider, com.vaadin.flow.function.ValueProvider<T, String> valueProvider) Constructs a new TreeComboBox Component with given caption andTreeDataProvider.TreeComboBox(com.vaadin.flow.function.ValueProvider<T, String> valueProvider) Constructs a new TreeComboBox Component. -
Method Summary
Modifier and TypeMethodDescriptionvoidfocus()com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T, com.vaadin.flow.function.SerializablePredicate<T>> com.vaadin.flow.component.Componentcom.vaadin.flow.component.shared.TooltipgetValue()booleanbooleanbooleanvoidsetClearButtonVisible(boolean clearButtonVisible) When false clear button will not be visible, default true.voidsetDataProvider(com.vaadin.flow.data.provider.DataProvider<T, ?> dataProvider) voidsetDataProvider(com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T, ?> hierarchicalDataProvider) voidsetDisableFiltering(boolean disableFiltering) When set to true, user cannot type into input field, only select values from the popup.voidsetErrorMessage(String errorMessage) voidsetHelperComponent(com.vaadin.flow.component.Component helperComponent) voidsetHelperText(String helperText) voidsetIcon(com.vaadin.flow.component.Component component) Set icon as prefix component of the field.voidsetInvalid(boolean invalid) voidString used for the label element.voidsetPopupWidth(String width) Sets the width of the Popover part.protected voidsetPresentationValue(T newPresentationValue) voidsetReadOnly(boolean readOnly) voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) voidsetSelectOnlyLeafs(boolean selectOnlyLeafs) When true allow selecting only the leaf nodescom.vaadin.flow.component.shared.TooltipsetTooltipText(String tooltipText) voidvoidSets the width of the component.Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, isEmpty, setModelValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, 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.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider
getTreeData, setItems, setItems, setTreeDataMethods 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, 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.shared.HasTooltip
setTooltipMarkdownMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getEmptyValue, getOptionalValue, isEmpty
-
Constructor Details
-
TreeComboBox
Constructs a new TreeComboBox Component.- Parameters:
valueProvider- the item caption provider to use, notnull
-
TreeComboBox
public TreeComboBox(com.vaadin.flow.data.provider.hierarchy.TreeData<T> treeData, com.vaadin.flow.function.ValueProvider<T, String> valueProvider) Constructs a new TreeComboBox Component with given caption andTreeData.- Parameters:
treeData- the tree data for componentvalueProvider- the item caption provider to use, notnull
-
TreeComboBox
public TreeComboBox(com.vaadin.flow.data.provider.hierarchy.TreeDataProvider<T> dataProvider, com.vaadin.flow.function.ValueProvider<T, String> valueProvider) Constructs a new TreeComboBox Component with given caption andTreeDataProvider.- Parameters:
dataProvider- the hierarchical data provider for componentvalueProvider- the item caption provider to use, notnull
-
-
Method Details
-
setValue
- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T> - Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<TreeComboBox<T>,T>
-
getValue
- Specified by:
getValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T> - Overrides:
getValuein classcom.vaadin.flow.component.AbstractField<TreeComboBox<T>,T>
-
setPopupWidth
Sets the width of the Popover part.Note: If setWidth is used, the Popover width be reset to width defined by setWidth.
- Parameters:
width- the width to be set
-
setDataProvider
-
getDataProvider
public com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T,com.vaadin.flow.function.SerializablePredicate<T>> getDataProvider()- Specified by:
getDataProviderin interfacecom.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T>
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T> - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T>
-
isRequiredIndicatorVisible
public boolean isRequiredIndicatorVisible()- Specified by:
isRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T> - Specified by:
isRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T>
-
setReadOnly
public void setReadOnly(boolean readOnly) - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T> - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T>
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T> - Specified by:
isReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>, T>
-
focus
public void focus()- Specified by:
focusin interfacecom.vaadin.flow.component.Focusable<T>
-
setLabel
String used for the label element.- Parameters:
label- the String value to set
-
setWidth
Sets the width of the component.The width should be in a format understood by the browser, e.g. "100px" or "2.5em".
If the provided
widthvalue is null then width is removed.Note: The content in popover needs an explicit width, hence "100%" does not work.
- Specified by:
setWidthin interfacecom.vaadin.flow.component.HasSize- Parameters:
width- the width to set, may benull
-
setDataProvider
public void setDataProvider(com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T, ?> hierarchicalDataProvider) - Specified by:
setDataProviderin interfacecom.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T>
-
setPresentationValue
- Specified by:
setPresentationValuein classcom.vaadin.flow.component.AbstractField<TreeComboBox<T>,T>
-
setSelectOnlyLeafs
public void setSelectOnlyLeafs(boolean selectOnlyLeafs) When true allow selecting only the leaf nodes- Parameters:
selectOnlyLeafs- boolean value.
-
setIcon
public void setIcon(com.vaadin.flow.component.Component component) Set icon as prefix component of the field.- Parameters:
component- Preferably a icon component
-
setClearButtonVisible
public void setClearButtonVisible(boolean clearButtonVisible) When false clear button will not be visible, default true.- Parameters:
clearButtonVisible- boolean value.
-
setDisableFiltering
public void setDisableFiltering(boolean disableFiltering) When set to true, user cannot type into input field, only select values from the popup.- Parameters:
disableFiltering- boolean value
-
setErrorMessage
- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.HasValidation
-
getErrorMessage
- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.HasValidation
-
setInvalid
public void setInvalid(boolean invalid) - Specified by:
setInvalidin interfacecom.vaadin.flow.component.HasValidation
-
isInvalid
public boolean isInvalid()- Specified by:
isInvalidin interfacecom.vaadin.flow.component.HasValidation
-
setHelperText
- Specified by:
setHelperTextin interfacecom.vaadin.flow.component.HasHelper
-
getHelperText
- Specified by:
getHelperTextin interfacecom.vaadin.flow.component.HasHelper
-
setHelperComponent
public void setHelperComponent(com.vaadin.flow.component.Component helperComponent) - Specified by:
setHelperComponentin interfacecom.vaadin.flow.component.HasHelper
-
getHelperComponent
public com.vaadin.flow.component.Component getHelperComponent()- Specified by:
getHelperComponentin interfacecom.vaadin.flow.component.HasHelper
-
setTooltipText
- Specified by:
setTooltipTextin interfacecom.vaadin.flow.component.shared.HasTooltip
-
getTooltip
public com.vaadin.flow.component.shared.Tooltip getTooltip()- Specified by:
getTooltipin interfacecom.vaadin.flow.component.shared.HasTooltip
-