com.vaadin.data.

Interface HasDataProvider<T>

    • Method Detail

      • setDataProvider

        void setDataProvider​(DataProvider<T,​?> dataProvider)

        Sets the data provider for this listing. The data provider is queried for displayed items as needed.

        Parameters:

        dataProvider - the data provider, not null

      • setItems

        default void setItems​(Collection<T> items)

        Description copied from interface: HasItems

        Sets the data items of this component provided as a collection.

        The provided items are wrapped into a ListDataProvider and this instance is used as a data provider for the setDataProvider(DataProvider) method. It means that the items collection can be accessed later on via ListDataProvider.getItems():

         
         HasDataProvider<String> listing = new CheckBoxGroup<>();
         listing.setItems(Arrays.asList("a","b"));
         ...
        
         Collection<String> collection = ((ListDataProvider<String>)listing.getDataProvider()).getItems();
         
         

        The provided collection instance may be used as-is. Subsequent modification of the collection might cause inconsistent data to be shown in the component unless it is explicitly instructed to read the data again.

        Specified by:

        setItems in interface HasItems<T>

        Parameters:

        items - the data items to display, not null