Class CustomFilterLookupField<T,FilterType>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.Div
com.vaadin.componentfactory.lookupfield.AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>
com.vaadin.componentfactory.lookupfield.CustomFilterLookupField<T,FilterType>
Type Parameters:
T - the type of the items to be inserted in the combo box and grid
FilterType - Type of the filter
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Div>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasOrderedComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomFilterLookupField<T,FilterType>,T>,T>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomFilterLookupField<T,FilterType>,T>,T>, com.vaadin.flow.data.binder.HasFilterableDataProvider<T,FilterType>, com.vaadin.flow.data.binder.HasItems<T>, Serializable
Direct Known Subclasses:
LookupField

public class CustomFilterLookupField<T,FilterType> extends AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType> implements com.vaadin.flow.component.HasHelper
Server-side component for the vcf-lookup-field webcomponent.

The CustomFilterLookupField is a combination of a combobox and a dialog for advanced search.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.vaadin.componentfactory.lookupfield.AbstractLookupField

    AbstractLookupField.CreateItemEvent, AbstractLookupField.FilterEvent<FILTERTYPE>, AbstractLookupField.LookupFieldI18n

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText

    com.vaadin.flow.component.HasText.WhiteSpace

    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<?>>
  • Field Summary

    Fields inherited from class com.vaadin.componentfactory.lookupfield.AbstractLookupField

    comboBox, FIELD_SLOT_NAME, filterConverter, invertedFilterConverter, SLOT_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    CustomFilterLookupField(com.vaadin.flow.component.grid.Grid<T> grid, com.vaadin.flow.component.combobox.ComboBox<T> comboBox, com.vaadin.flow.function.SerializableFunction<String,FilterType> filterConverter, com.vaadin.flow.function.SerializableFunction<FilterType,String> invertedFilterConverter)
     
    CustomFilterLookupField(com.vaadin.flow.function.SerializableFunction<String,FilterType> filterConverter, com.vaadin.flow.function.SerializableFunction<FilterType,String> invertedFilterConverter)
    Constructor The converters are used to convert the backend filter to the combobox filter (String) or if you are using setItems
    CustomFilterLookupField(Class<T> beanType, com.vaadin.flow.function.SerializableFunction<String,FilterType> filterConverter, com.vaadin.flow.function.SerializableFunction<FilterType,String> invertedFilterConverter)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomFilterLookupField<T,FilterType>,T>> listener)
     
    protected void
    Copy the selected value of the grid into the field
    protected void
    Copy the selected value of the field into the grid
    com.vaadin.flow.component.combobox.ComboBox<T>
     
    com.vaadin.flow.component.Component
     
     
     
    void
    setComboBox(com.vaadin.flow.component.combobox.ComboBox<T> comboBox)
    Set the comboBox
    void
    setDataProvider(com.vaadin.flow.component.combobox.ComboBox.ItemFilter<T> itemFilter, com.vaadin.flow.data.provider.ListDataProvider<T> listDataProvider)
    Sets a list data provider with an item filter as the data provider.
    void
    setDataProvider(com.vaadin.flow.data.provider.ListDataProvider<T> listDataProvider)
     
    void
    setHelperComponent(com.vaadin.flow.component.Component component)
     
    void
    setHelperText(String helperText)
     
    void
    setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)
    Sets the item label generator that is used to produce the strings shown in the combo box for each item.
    void
    Set the label of the field
    void
    setValue(T value)
     
    protected void
    showNoSelectionNotification(String noSelectionNotificationMessage)
     

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

    getTitle, setTitle

    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.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

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

    addDetachListener

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

    add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll

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

    getElement

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

    isEnabled

    Methods inherited from interface com.vaadin.flow.data.binder.HasFilterableDataProvider

    setDataProvider

    Methods inherited from interface com.vaadin.flow.data.binder.HasItems

    setItems, setItems

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

    getChildren, getComponentAt, getComponentCount, indexOf, replace

    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, 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.HasText

    getText, getWhiteSpace, setText, setWhiteSpace

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

    addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

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

    setManualValidation

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

    clear, getEmptyValue, getOptionalValue, isEmpty

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

    isReadOnly, isRequiredIndicatorVisible
  • Constructor Details

    • CustomFilterLookupField

      public CustomFilterLookupField(com.vaadin.flow.function.SerializableFunction<String,FilterType> filterConverter, com.vaadin.flow.function.SerializableFunction<FilterType,String> invertedFilterConverter)
      Constructor The converters are used to convert the backend filter to the combobox filter (String) or if you are using setItems
      Parameters:
      filterConverter - Convert a string to FilterType
      invertedFilterConverter - Convert a FilterType to String
    • CustomFilterLookupField

      public CustomFilterLookupField(Class<T> beanType, com.vaadin.flow.function.SerializableFunction<String,FilterType> filterConverter, com.vaadin.flow.function.SerializableFunction<FilterType,String> invertedFilterConverter)
    • CustomFilterLookupField

      public CustomFilterLookupField(com.vaadin.flow.component.grid.Grid<T> grid, com.vaadin.flow.component.combobox.ComboBox<T> comboBox, com.vaadin.flow.function.SerializableFunction<String,FilterType> filterConverter, com.vaadin.flow.function.SerializableFunction<FilterType,String> invertedFilterConverter)
  • Method Details

    • setValue

      public void setValue(T value)
      Specified by:
      setValue in interface com.vaadin.flow.component.HasValue<T,FilterType>
    • getValue

      public T getValue()
      Specified by:
      getValue in interface com.vaadin.flow.component.HasValue<T,FilterType>
    • addValueChangeListener

      public com.vaadin.flow.shared.Registration addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomFilterLookupField<T,FilterType>,T>> listener)
      Specified by:
      addValueChangeListener in interface com.vaadin.flow.component.HasValue<T,FilterType>
    • setComboBox

      public void setComboBox(com.vaadin.flow.component.combobox.ComboBox<T> comboBox)
      Set the comboBox
      Specified by:
      setComboBox in class AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>
      Parameters:
      comboBox - the comboBox
    • getComboBox

      public com.vaadin.flow.component.combobox.ComboBox<T> getComboBox()
      Specified by:
      getComboBox in class AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>
      Returns:
      the internal field
    • setDataProvider

      public void setDataProvider(com.vaadin.flow.data.provider.ListDataProvider<T> listDataProvider)
      Specified by:
      setDataProvider in class AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>
    • setDataProvider

      public void setDataProvider(com.vaadin.flow.component.combobox.ComboBox.ItemFilter<T> itemFilter, com.vaadin.flow.data.provider.ListDataProvider<T> listDataProvider)
      Sets a list data provider with an item filter as the data provider.
      Specified by:
      setDataProvider in class AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>
      Parameters:
      itemFilter - filter to check if an item is shown when user typed some text into the ComboBox
      listDataProvider - the list data provider to use, not null
    • 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 combo box for each item. By default, String.valueOf(Object) is used.

      Specified by:
      setItemLabelGenerator in class AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>
      Parameters:
      itemLabelGenerator - the item label provider to use, not null
    • setLabel

      public void setLabel(String label)
      Set the label of the field
      Specified by:
      setLabel in class AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>
      Parameters:
      label - label of the field
    • getHelperText

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

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

      public void setHelperComponent(com.vaadin.flow.component.Component component)
      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
    • copyFieldValueFromGrid

      @ClientCallable protected void copyFieldValueFromGrid()
      Copy the selected value of the grid into the field
      Specified by:
      copyFieldValueFromGrid in class AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>
    • showNoSelectionNotification

      protected void showNoSelectionNotification(String noSelectionNotificationMessage)
    • copyFieldValueToGrid

      @ClientCallable protected void copyFieldValueToGrid()
      Copy the selected value of the field into the grid
      Specified by:
      copyFieldValueToGrid in class AbstractLookupField<T,T,com.vaadin.flow.component.combobox.ComboBox<T>,CustomFilterLookupField<T,FilterType>,FilterType>