Class ComboBoxLight<T>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<ComboBoxLight<T>,T>
com.vaadin.flow.component.AbstractSinglePropertyField<ComboBoxLight<T>,T>
org.vaadin.addons.componentfactory.AbstractComboBox<ComboBoxLight<T>,T>
org.vaadin.addons.componentfactory.ComboBoxLight<T>
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<ComboBoxLight<T>>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<ComboBoxLight<T>>, com.vaadin.flow.component.FocusNotifier<ComboBoxLight<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<ComboBoxLight<T>,T>,T>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ComboBoxLight<T>,T>,T>, com.vaadin.flow.data.binder.HasDataProvider<T>, com.vaadin.flow.data.binder.HasItems<T>, Serializable

public class ComboBoxLight<T> extends AbstractComboBox<ComboBoxLight<T>,T> implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValidation, com.vaadin.flow.data.binder.HasDataProvider<T>, com.vaadin.flow.component.HasHelper
See Also:
  • Constructor Details

    • ComboBoxLight

      public ComboBoxLight()
  • Method Details

    • setItemLabelGenerator

      public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)
    • getItemLabelGenerator

      public com.vaadin.flow.component.ItemLabelGenerator<T> getItemLabelGenerator()
    • setAutoOpen

      public void setAutoOpen(boolean autoOpen)
      Enables or disables the dropdown opening automatically. If false the dropdown is only opened when clicking the toggle button or pressing Up or Down arrow keys.
      Parameters:
      autoOpen - false to prevent the dropdown from opening automatically
    • isAutoOpen

      public boolean isAutoOpen()
      Gets whether dropdown will open automatically or not.
      Returns:
      @{code true} if enabled, false otherwise
    • setAutofocus

      public void setAutofocus(boolean autofocus)
      Overrides:
      setAutofocus in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      autofocus - the boolean value to set
    • isAutofocus

      public boolean isAutofocus()
    • setPreventInvalidInput

      public void setPreventInvalidInput(boolean preventInvalidInput)
      Description copied from class: AbstractComboBox

      Description copied from corresponding location in WebComponent:

      Set to true to prevent the user from entering invalid input.

      Overrides:
      setPreventInvalidInput in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      preventInvalidInput - the boolean value to set
    • setLabel

      public void setLabel(String label)
      Description copied from class: AbstractComboBox

      Description copied from corresponding location in WebComponent:

      The label for this element.

      Overrides:
      setLabel in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      label - the String value to set
    • getLabel

      public String getLabel()
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      Description copied from class: AbstractComboBox

      Description copied from corresponding location in WebComponent:

      The error message to display when the input is invalid.

      Specified by:
      setErrorMessage in interface com.vaadin.flow.component.HasValidation
      Overrides:
      setErrorMessage in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      errorMessage - the String value to set
    • getErrorMessage

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

      public void setInvalid(boolean invalid)
      Description copied from class: AbstractComboBox

      Description copied from corresponding location in WebComponent:

      Set to true if the value is invalid.

      Specified by:
      setInvalid in interface com.vaadin.flow.component.HasValidation
      Overrides:
      setInvalid in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      invalid - the boolean value to set
    • isInvalid

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

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

      public void setClearButtonVisible(boolean clearButtonVisible)
    • isClearButtonVisible

      public boolean isClearButtonVisible()
    • setOpened

      public void setOpened(boolean opened)
      Description copied from class: AbstractComboBox

      Description copied from corresponding location in WebComponent:

      True if the dropdown is open, false otherwise.

      Overrides:
      setOpened in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      opened - the boolean value to set
    • isOpened

      public boolean isOpened()
    • setPlaceholder

      public void setPlaceholder(String placeholder)
      Description copied from class: AbstractComboBox

      Description copied from corresponding location in WebComponent:

      A placeholder string in addition to the label.

      Overrides:
      setPlaceholder in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      placeholder - the String value to set
    • getPlaceholder

      public String getPlaceholder()
    • setPattern

      public void setPattern(String pattern)
      Description copied from class: AbstractComboBox

      Description copied from corresponding location in WebComponent:

      A pattern to validate the input with.

      Overrides:
      setPattern in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      pattern - the String value to set
    • getPattern

      public String getPattern()
    • setDataProvider

      public void setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
      Specified by:
      setDataProvider in interface com.vaadin.flow.data.binder.HasDataProvider<T>
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • getDataProvider

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

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • setAllowCustomValue

      public void setAllowCustomValue(boolean allowCustomValue)
      Description copied from class: AbstractComboBox

      Description copied from corresponding location in WebComponent:

      If true, the user can input a value that is not present in the items list. value property will be set to the input value in this case. Also, when value is set programmatically, the input value will be set to reflect that value.

      Overrides:
      setAllowCustomValue in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      allowCustomValue - the boolean value to set
    • isAllowCustomValue

      public boolean isAllowCustomValue()
    • addCustomValueSetListener

      public com.vaadin.flow.shared.Registration addCustomValueSetListener(com.vaadin.flow.component.ComponentEventListener<AbstractComboBox.CustomValueSetEvent<ComboBoxLight<T>>> listener)
      Description copied from class: AbstractComboBox
      Adds a listener for custom-value-set events fired by the webcomponent.
      Overrides:
      addCustomValueSetListener in class AbstractComboBox<ComboBoxLight<T>,T>
      Parameters:
      listener - the listener
      Returns:
      a Registration for removing the event listener
    • setRenderer

      public void setRenderer(com.vaadin.flow.data.renderer.Renderer<T> renderer)
      Sets the Renderer responsible to render the individual items in the list of possible choices of the ComboBox. It doesn't affect how the selected item is rendered - that can be configured by using setItemLabelGenerator(ItemLabelGenerator).
      Parameters:
      renderer - a renderer for the items in the selection list of the ComboBox, not null

      Note that filtering of the ComboBox is not affected by the renderer that is set here. Filtering is done on the original values and can be affected by setItemLabelGenerator(ItemLabelGenerator).

    • setDisableBackendAutoselect

      public void setDisableBackendAutoselect(boolean disableBackendAutoslect)
      Sets whether to disable the backend dataprovider autoselect feature. When disabled, the autoselect functionality will not be triggered.
      Parameters:
      disableBackendAutoslect - true to disable backend autoselect, false to enable it.
    • setDisableResetAfterChange

      public void setDisableResetAfterChange(boolean disableResetAfterChange)
      Sets whether the reset behavior after a change should be disabled when using backend dataprovider. When set to true, the component will not reset its state after a value change. When set to false, the component will reset its state after a value change.
      Parameters:
      disableResetAfterChange - true to disable reset after change, false to enable it.
    • getDataGenerator

      protected com.vaadin.flow.data.provider.CompositeDataGenerator<T> getDataGenerator()
      Accesses the data generator managed by this controller
    • getKeyMapper

      protected com.vaadin.flow.data.provider.KeyMapper<T> getKeyMapper()
      Returns the used key mapper. Please note, that any changes to this instance will affect the combo box.
      Returns:
      key mapper