Interface HasDataView<T,F,V extends DataView<T>>

Type Parameters:
T - data type
F - filter type
V - DataView type
All Superinterfaces:
Serializable
All Known Implementing Classes:
CheckboxGroup, ComboBox, ComboBoxBase, CrudGrid, Grid, GridPro, ListBox, ListBoxBase, MultiSelectComboBox, MultiSelectListBox, RadioButtonGroup, Select, TreeGrid

public interface HasDataView<T,F,V extends DataView<T>> extends Serializable
An interface for components that get items from the generic data provider types DataProvider and InMemoryDataProvider. The methods return a DataView which has the generic API for getting information on the items.
  • Method Summary

    Modifier and Type
    Method
    Description
    default V
    bindItems(Signal<? extends List<? extends Signal<T>>> itemsSignal)
    Binds a signal containing a list of item signals to this component, enabling fine-grained reactive updates.
    Get the DataView for the component.
    setItems(DataProvider<T,F> dataProvider)
    Set a generic data provider for the component to use and returns the base DataView that provides API to get information on the items.
    Sets an in-memory data provider for the component to use
  • Method Details

    • setItems

      V setItems(DataProvider<T,F> dataProvider)
      Set a generic data provider for the component to use and returns the base DataView that provides API to get information on the items.

      This method should be used only when the data provider type is not either ListDataProvider or BackEndDataProvider.

      Parameters:
      dataProvider - DataProvider instance to use, not null
      Returns:
      DataView providing information on the data
    • setItems

      V setItems(InMemoryDataProvider<T> dataProvider)
      Sets an in-memory data provider for the component to use

      Note! Using a ListDataProvider instead of a InMemoryDataProvider is recommended to get access to ListDataView API by using HasListDataView.setItems(ListDataProvider).

      Parameters:
      dataProvider - InMemoryDataProvider to use, not null
      Returns:
      DataView providing information on the data
    • getGenericDataView

      V getGenericDataView()
      Get the DataView for the component.

      The returned DataView only contains a minimal common API. Use of HasListDataView.getListDataView() or HasLazyDataView.getLazyDataView() should be used for more targeted helper features

      Returns:
      DataView instance
    • bindItems

      default V bindItems(Signal<? extends List<? extends Signal<T>>> itemsSignal)
      Binds a signal containing a list of item signals to this component, enabling fine-grained reactive updates. This method establishes a reactive binding where:

      The binding is automatically managed based on the component's lifecycle. When the component is attached, the effects are activated; when detached, they are deactivated.

      Example usage:

       ListSignal<String> items = new ListSignal<>();
       items.insertLast("Item 1");
       items.insertLast("Item 2");
      
       component.bindItems(items);
      
       // Structural change - triggers refreshAll()
       items.insertLast("Item 3");
      
       // Item value change - triggers refreshItem()
       items.peek().get(0).set("Updated Item 1");
       
      Parameters:
      itemsSignal - the signal containing a list of item signals (e.g., ListSignal), not null
      Returns:
      the DataView providing access to the items
      Throws:
      IllegalArgumentException - if this is not a Component instance
      BindingActiveException - if there is already an active items binding