com.holonplatform.vaadin.flow.data

## Interface ItemListingDataProviderAdapter<T,F>

- Type Parameters:
    `T` - Data type
    `F` - Filter type
  All Superinterfaces:
    com.vaadin.flow.data.provider.DataProvider<T,F>, Serializable

      public interface ItemListingDataProviderAdapter<T,F>
      extends com.vaadin.flow.data.provider.DataProvider<T,F>

  A `DataProvider` adapter to be used in item listings.
  Since:
    5.2.2

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T,F> ItemListingDataProviderAdapter<T,F>` | `adapt(com.vaadin.flow.data.provider.DataProvider<T,F> dataProvider)` Create a new `ItemListingDataProviderAdapter` using given concrete `dataProvider`.
    `void` | `addAdditionalItem(T item)` Add an additional item to the data provider.
    `List<T>` | `getAdditionalItems()` Get the current additional items, if any.
    `boolean` | `isFrozen()` Get whether the data provider is frozen.
    `boolean` | `removeAdditionalItem(T item)` Remove an additional item from the data provider.
    `void` | `removeAdditionalItems()` Remove all the additional items from the data provider.
    `void` | `setFrozen(boolean frozen)` Set whether the data provider is frozen.

    - ### Methods inherited from interface com.vaadin.flow.data.provider.DataProvider

      `addDataProviderListener, fetch, fromCallbacks, fromFilteringCallbacks, fromStream, getId, isInMemory, ofCollection, ofItems, refreshAll, refreshItem, size, withConfigurableFilter, withConfigurableFilter, withConvertedFilter`

- - ### Method Detail

    - #### isFrozen

          boolean isFrozen()

      Get whether the data provider is frozen.

      When the data provider is frozen, it never returns any item (the `DataProvider.size(com.vaadin.flow.data.provider.Query)` will always be `0`).

      Returns:
        Whether the data provider is frozen

    - #### setFrozen

          void setFrozen(boolean frozen)

      Set whether the data provider is frozen.

      When the data provider is frozen, it never returns any item (the `DataProvider.size(com.vaadin.flow.data.provider.Query)` will always be `0`).

      Parameters:
        `frozen` - Whether the data provider is frozen

    - #### getAdditionalItems

          List<T> getAdditionalItems()

      Get the current additional items, if any.

      Additional items are provided in addition to the ones returned by the concrete data provider, for example from a backend service. They are always provided before any other item, and do not take part in filters and sorts.

      Returns:
        The additional items, in the order they were added. An empty list if none. The list is not modifiable.
      See Also:
        `addAdditionalItem(Object)`

    - #### addAdditionalItem

          void addAdditionalItem(T item)

      Add an additional item to the data provider.

      Additional items are provided in addition to the ones returned by the concrete data provider, for example from a backend service. They are always provided before any other item, and do not take part in filters and sorts.

      The additional items should be used, for example, to edit item values before saving into the backend. Then they should be removed from the data provider.

      NOTE: Additional items are identified in the same way than any other item, using the `DataProvider.getId(Object)` method. So the id providing logic should be consistent with any other item.

      Parameters:
        `item` - The item to add (not null)
      See Also:
        `removeAdditionalItem(Object)`

    - #### removeAdditionalItem

          boolean removeAdditionalItem(T item)

      Remove an additional item from the data provider.
      Parameters:
        `item` - The item to remove (not null)
      Returns:
        `true` if given item was an additional item and it's been removed, `false` otherwise
      See Also:
        `addAdditionalItem(Object)`, `removeAdditionalItems()`

    - #### removeAdditionalItems

          void removeAdditionalItems()

      Remove all the additional items from the data provider.
      See Also:
        `addAdditionalItem(Object)`

    - #### adapt

          static <T,F> ItemListingDataProviderAdapter<T,F> adapt(com.vaadin.flow.data.provider.DataProvider<T,F> dataProvider)

      Create a new `ItemListingDataProviderAdapter` using given concrete `dataProvider`.
      Type Parameters:
        `T` - Data type
        `F` - Filter type
      Parameters:
        `dataProvider` - The concrete data provider (not null)
      Returns:
        A new `ItemListingDataProviderAdapter`

Copyright © 2019 The Holon Platform. All rights reserved.