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 Classes
    Modifier and Type
    Class
    Description
    static enum 
     

    Nested 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

    Constructors
    Constructor
    Description
    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 and TreeData.
    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 and TreeDataProvider.
    TreeComboBox(com.vaadin.flow.function.ValueProvider<T,String> valueProvider)
    Constructs a new TreeComboBox Component.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T,com.vaadin.flow.function.SerializablePredicate<T>>
     
     
    com.vaadin.flow.component.Component
     
     
    com.vaadin.flow.component.shared.Tooltip
     
     
    boolean
     
    boolean
     
    boolean
     
    void
    setClearButtonVisible(boolean clearButtonVisible)
    When false clear button will not be visible, default true.
    void
    setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
     
    void
    setDataProvider(com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T,?> hierarchicalDataProvider)
     
    void
    setDisableFiltering(boolean disableFiltering)
    When set to true, user cannot type into input field, only select values from the popup.
    void
    setErrorMessage(String errorMessage)
     
    void
    setHelperComponent(com.vaadin.flow.component.Component helperComponent)
     
    void
    setHelperText(String helperText)
     
    void
    setIcon(com.vaadin.flow.component.Component component)
    Set icon as prefix component of the field.
    void
    setInvalid(boolean invalid)
     
    void
    String used for the label element.
    void
    Sets the width of the Popover part.
    protected void
    setPresentationValue(T newPresentationValue)
     
    void
    setReadOnly(boolean readOnly)
     
    void
    setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
     
    void
    setSelectOnlyLeafs(boolean selectOnlyLeafs)
    When true allow selecting only the leaf nodes
    com.vaadin.flow.component.shared.Tooltip
    setTooltipText(String tooltipText)
     
    void
    setValue(T value)
     
    void
    Sets the width of the component.

    Methods inherited from class com.vaadin.flow.component.AbstractField

    addValueChangeListener, getEmptyValue, isEmpty, setModelValue, valueEquals

    Methods 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, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider

    getTreeData, setItems, setItems, setTreeData

    Methods 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, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip

    setTooltipMarkdown

    Methods inherited from interface com.vaadin.flow.component.HasValidation

    setManualValidation

    Methods inherited from interface com.vaadin.flow.component.HasValue

    addValueChangeListener, clear, getEmptyValue, getOptionalValue, isEmpty
  • Constructor Details

    • TreeComboBox

      public TreeComboBox(com.vaadin.flow.function.ValueProvider<T,String> valueProvider)
      Constructs a new TreeComboBox Component.
      Parameters:
      valueProvider - the item caption provider to use, not null
    • 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 and TreeData.
      Parameters:
      treeData - the tree data for component
      valueProvider - the item caption provider to use, not null
    • 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 and TreeDataProvider.
      Parameters:
      dataProvider - the hierarchical data provider for component
      valueProvider - the item caption provider to use, not null
  • Method Details

    • setValue

      public void setValue(T value)
      Specified by:
      setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
      Overrides:
      setValue in class com.vaadin.flow.component.AbstractField<TreeComboBox<T>,T>
    • getValue

      public T getValue()
      Specified by:
      getValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
      Overrides:
      getValue in class com.vaadin.flow.component.AbstractField<TreeComboBox<T>,T>
    • setPopupWidth

      public void setPopupWidth(String width)
      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

      public void setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
    • getDataProvider

      public com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T,com.vaadin.flow.function.SerializablePredicate<T>> getDataProvider()
      Specified by:
      getDataProvider in interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T>
    • setRequiredIndicatorVisible

      public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
    • isRequiredIndicatorVisible

      public boolean isRequiredIndicatorVisible()
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
    • isReadOnly

      public boolean isReadOnly()
      Specified by:
      isReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
      Specified by:
      isReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TreeComboBox<T>,T>,T>
    • focus

      public void focus()
      Specified by:
      focus in interface com.vaadin.flow.component.Focusable<T>
    • setLabel

      public void setLabel(String label)
      String used for the label element.
      Parameters:
      label - the String value to set
    • setWidth

      public void setWidth(String width)
      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 width value is null then width is removed.

      Note: The content in popover needs an explicit width, hence "100%" does not work.

      Specified by:
      setWidth in interface com.vaadin.flow.component.HasSize
      Parameters:
      width - the width to set, may be null
    • setDataProvider

      public void setDataProvider(com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider<T,?> hierarchicalDataProvider)
      Specified by:
      setDataProvider in interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T>
    • setPresentationValue

      protected void setPresentationValue(T newPresentationValue)
      Specified by:
      setPresentationValue in class com.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

      public void setErrorMessage(String errorMessage)
      Specified by:
      setErrorMessage in interface com.vaadin.flow.component.HasValidation
    • getErrorMessage

      public String getErrorMessage()
      Specified by:
      getErrorMessage in interface com.vaadin.flow.component.HasValidation
    • setInvalid

      public void setInvalid(boolean invalid)
      Specified by:
      setInvalid in interface com.vaadin.flow.component.HasValidation
    • isInvalid

      public boolean isInvalid()
      Specified by:
      isInvalid in interface com.vaadin.flow.component.HasValidation
    • setHelperText

      public void setHelperText(String helperText)
      Specified by:
      setHelperText in interface com.vaadin.flow.component.HasHelper
    • getHelperText

      public String getHelperText()
      Specified by:
      getHelperText in interface com.vaadin.flow.component.HasHelper
    • setHelperComponent

      public void setHelperComponent(com.vaadin.flow.component.Component helperComponent)
      Specified by:
      setHelperComponent in interface com.vaadin.flow.component.HasHelper
    • getHelperComponent

      public com.vaadin.flow.component.Component getHelperComponent()
      Specified by:
      getHelperComponent in interface com.vaadin.flow.component.HasHelper
    • setTooltipText

      public com.vaadin.flow.component.shared.Tooltip setTooltipText(String tooltipText)
      Specified by:
      setTooltipText in interface com.vaadin.flow.component.shared.HasTooltip
    • getTooltip

      public com.vaadin.flow.component.shared.Tooltip getTooltip()
      Specified by:
      getTooltip in interface com.vaadin.flow.component.shared.HasTooltip