com.holonplatform.vaadin.data.container

## Interface ItemDataSourceContainer<ITEM,PROPERTY>

- Type Parameters:
    `PROPERTY` - Item property type
    `ITEM` - Item type
  All Superinterfaces:
    com.vaadin.data.Buffered, com.vaadin.data.Container, com.vaadin.data.Container.Filterable, com.vaadin.data.Container.Indexed, com.vaadin.data.Container.ItemSetChangeNotifier, com.vaadin.data.Container.Ordered, com.vaadin.data.Container.PropertySetChangeNotifier, com.vaadin.data.Container.Sortable, ItemDataSource<ITEM,PROPERTY>, Serializable

      public interface ItemDataSourceContainer<ITEM,PROPERTY>
      extends ItemDataSource<ITEM,PROPERTY>, com.vaadin.data.Container.Indexed, com.vaadin.data.Buffered, com.vaadin.data.Container.Filterable, com.vaadin.data.Container.Sortable, com.vaadin.data.Container.ItemSetChangeNotifier, com.vaadin.data.Container.PropertySetChangeNotifier

  An indexed `Container` using an `ItemDataProvider` to load items on demand.
  Since:
    3.5.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.vaadin.data.ItemDataSource

      `ItemDataSource.CommitHandler<ITEM>, ItemDataSource.Configuration<PROPERTY>, ItemDataSource.ItemAction, ItemDataSource.ItemSort<PROPERTY>, ItemDataSource.PropertySortGenerator<PROPERTY>`

    - ### Nested classes/interfaces inherited from interface com.vaadin.data.Container.Indexed

      `com.vaadin.data.Container.Indexed.ItemAddEvent, com.vaadin.data.Container.Indexed.ItemRemoveEvent`

    - ### Nested classes/interfaces inherited from interface com.vaadin.data.Buffered

      `com.vaadin.data.Buffered.SourceException`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_BATCH_SIZE` Default batch (page) size for items loading using `ItemDataProvider`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default boolean` | `addContainerProperty(PROPERTY propertyId, Class<?> type, boolean readOnly, boolean sortable)` Adds an Item property to this container
    `<T> boolean` | `addContainerProperty(PROPERTY propertyId, Class<T> type, boolean readOnly, boolean sortable, T defaultValue)` Adds an Item property to this container
    `Registration` | `addQueryConfigurationProvider(com.holonplatform.core.query.QueryConfigurationProvider queryConfigurationProvider)` Add an external `QueryConfigurationProvider` for additional query configuration
    `void` | `addQueryParameter(String name, Object value)` Add a query parameter
    `static <PROPERTY,ITEM> ItemDataSourceContainerBuilder.BaseItemDataSourceContainerBuilder<PROPERTY,ITEM>` | `builder()` Get a builder to create an `ItemDataSourceContainer`.
    `void` | `refreshItem(Object itemId)` Refresh given the item identified by given `itemId` in data source
    `void` | `removeQueryParameter(String name)` Remove a query parameter
    `void` | `setAutoRefresh(boolean autoRefresh)` Set if auto-refresh is enabled for this container, i.e. items are loaded when one of the Container method which involve operations on item set is called.
    `void` | `setCommitHandler(ItemDataSource.CommitHandler<ITEM> commitHandler)` Handler to manage items and item set modifications.
    `void` | `setDefaultSort(com.holonplatform.core.query.QuerySort sort)` Set query default sort.
    `void` | `setFixedFilter(com.holonplatform.core.query.QueryFilter filter)` Set query fixed filter (always added to query predicates)
    `void` | `setFixedSort(com.holonplatform.core.query.QuerySort sort)` Set query fixed sort (always added to query sorts)
    `void` | `setMaxCacheSize(int maxCacheSize)` Set max items cache size
    `void` | `setPropertyDefaultValue(PROPERTY propertyId, Object defaultValue)` Set a default value to initialize the given `propertyId`
    `void` | `setPropertyReadOnly(PROPERTY propertyId, boolean readOnly)` Set whether the given `propertyId` is read-only
    `void` | `setPropertySortable(PROPERTY propertyId, boolean sortable)` Set whether the given `propertyId` can partecipate in container sorting
    `void` | `setPropertySortGenerator(PROPERTY property, ItemDataSource.PropertySortGenerator<PROPERTY> propertySortGenerator)` Set a `PropertySortGenerator` to generate `QuerySort`s for given `property`

    - ### Methods inherited from interface com.holonplatform.vaadin.data.ItemDataSource

      `add, clear, commit, discard, get, getConfiguration, getId, getItemIds, isBuffered, refresh, refresh, remove, size, sort, update`

    - ### Methods inherited from interface com.vaadin.data.Container.Indexed

      `addItemAt, addItemAt, getIdByIndex, getItemIds, indexOfId`

    - ### Methods inherited from interface com.vaadin.data.Buffered

      `commit, discard, isBuffered, isModified, setBuffered`

    - ### Methods inherited from interface com.vaadin.data.Container.Filterable

      `addContainerFilter, getContainerFilters, removeAllContainerFilters, removeContainerFilter`

    - ### Methods inherited from interface com.vaadin.data.Container.Sortable

      `getSortableContainerPropertyIds, sort`

    - ### Methods inherited from interface com.vaadin.data.Container.Ordered

      `addItemAfter, addItemAfter, firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId`

    - ### Methods inherited from interface com.vaadin.data.Container.ItemSetChangeNotifier

      `addItemSetChangeListener, addListener, removeItemSetChangeListener, removeListener`

    - ### Methods inherited from interface com.vaadin.data.Container.PropertySetChangeNotifier

      `addListener, addPropertySetChangeListener, removeListener, removePropertySetChangeListener`

- - ### Field Detail

    - #### DEFAULT_BATCH_SIZE

          static final int DEFAULT_BATCH_SIZE

      Default batch (page) size for items loading using `ItemDataProvider`
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### setAutoRefresh

          void setAutoRefresh(boolean autoRefresh)

      Set if auto-refresh is enabled for this container, i.e. items are loaded when one of the Container method which involve operations on item set is called.

      If auto-refresh is not enabled, `ItemDataSource.refresh()` method must be called to load items before using this Container.

      Parameters:
        `autoRefresh` - `true` to enable auto-refresh

    - #### setMaxCacheSize

          void setMaxCacheSize(int maxCacheSize)

      Set max items cache size
      Parameters:
        `maxCacheSize` - Max cache size to set

    - #### addContainerProperty

          <T> boolean addContainerProperty(PROPERTY propertyId,
                                           Class<T> type,
                                           boolean readOnly,
                                           boolean sortable,
                                           T defaultValue)

      Adds an Item property to this container
      Type Parameters:
        `T` - Property type
      Parameters:
        `propertyId` - Property id
        `type` - Property value type
        `readOnly` - Whether property is read-only
        `sortable` - Whether property is sortable
        `defaultValue` - Property default value
      Returns:
        `true` if property was successfully added

    - #### addContainerProperty

          default boolean addContainerProperty(PROPERTY propertyId,
                                               Class<?> type,
                                               boolean readOnly,
                                               boolean sortable)

      Adds an Item property to this container
      Parameters:
        `propertyId` - Property id
        `type` - Property value type
        `readOnly` - Whether property is read-only
        `sortable` - Whether property is sortable
      Returns:
        `true` if property was successfully added

    - #### setPropertySortable

          void setPropertySortable(PROPERTY propertyId,
                                   boolean sortable)

      Set whether the given `propertyId` can partecipate in container sorting
      Parameters:
        `propertyId` - Property id
        `sortable` - Whether the property is sortable or not

    - #### setPropertyReadOnly

          void setPropertyReadOnly(PROPERTY propertyId,
                                   boolean readOnly)

      Set whether the given `propertyId` is read-only
      Parameters:
        `propertyId` - Property id
        `readOnly` - Whether the property is read-only

    - #### setPropertyDefaultValue

          void setPropertyDefaultValue(PROPERTY propertyId,
                                       Object defaultValue)

      Set a default value to initialize the given `propertyId`
      Parameters:
        `propertyId` - Property id
        `defaultValue` - Property default value

    - #### addQueryConfigurationProvider

          Registration addQueryConfigurationProvider(com.holonplatform.core.query.QueryConfigurationProvider queryConfigurationProvider)

      Add an external `QueryConfigurationProvider` for additional query configuration
      Parameters:
        `queryConfigurationProvider` - QueryConfigurationProvider to add
      Returns:
        the configuration provider `Registration`

    - #### setFixedFilter

          void setFixedFilter(com.holonplatform.core.query.QueryFilter filter)

      Set query fixed filter (always added to query predicates)
      Parameters:
        `filter` - Query fixed filter, or `null` for none

    - #### setDefaultSort

          void setDefaultSort(com.holonplatform.core.query.QuerySort sort)

      Set query default sort. If not `null` and no other sort is available, this one will be used
      Parameters:
        `sort` - Default query sort

    - #### setFixedSort

          void setFixedSort(com.holonplatform.core.query.QuerySort sort)

      Set query fixed sort (always added to query sorts)
      Parameters:
        `sort` - Query fixed sort, or `null` for none

    - #### addQueryParameter

          void addQueryParameter(String name,
                                 Object value)

      Add a query parameter
      Parameters:
        `name` - Parameter name
        `value` - Parameter value

    - #### removeQueryParameter

          void removeQueryParameter(String name)

      Remove a query parameter
      Parameters:
        `name` - Parameter name to remove

    - #### setPropertySortGenerator

          void setPropertySortGenerator(PROPERTY property,
                                        ItemDataSource.PropertySortGenerator<PROPERTY> propertySortGenerator)

      Set a `PropertySortGenerator` to generate `QuerySort`s for given `property`
      Parameters:
        `property` - Property (not null)
        `propertySortGenerator` - PropertySortGenerator (not null)

    - #### setCommitHandler

          void setCommitHandler(ItemDataSource.CommitHandler<ITEM> commitHandler)

      Handler to manage items and item set modifications.
      Parameters:
        `commitHandler` - Item set commit handler

    - #### refreshItem

          void refreshItem(Object itemId)

      Refresh given the item identified by given `itemId` in data source
      Parameters:
        `itemId` - Id of the item to refresh (not null)
      Throws:
        `UnsupportedOperationException` - If the refresh operation is not supported by concrete data store

    - #### builder

          static <PROPERTY,ITEM> ItemDataSourceContainerBuilder.BaseItemDataSourceContainerBuilder<PROPERTY,ITEM> builder()

      Get a builder to create an `ItemDataSourceContainer`.
      Type Parameters:
        `PROPERTY` - Item property type
        `ITEM` - Item type
      Returns:
        `ItemDataSourceContainer` builder

Copyright © 2017 The Holon Platform. All rights reserved.