com.holonplatform.vaadin.data.container

## Interface ItemDataSourceContainerBuilder<ITEM,PROPERTY,B extends ItemDataSourceContainerBuilder<ITEM,PROPERTY,B>>

- Type Parameters:
    `PROPERTY` - Item property type
    `ITEM` - Item type
  All Known Subinterfaces:
    ItemDataSourceContainerBuilder.BaseItemDataSourceContainerBuilder<ITEM,PROPERTY>

      public interface ItemDataSourceContainerBuilder<ITEM,PROPERTY,B extends ItemDataSourceContainerBuilder<ITEM,PROPERTY,B>>

  Builder to create `ItemDataSourceContainer` instances.
  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `ItemDataSourceContainerBuilder.BaseItemDataSourceContainerBuilder<ITEM,PROPERTY>` Default `ItemDataSourceContainerBuilder`.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `B` | `autoRefresh(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.
    `B` | `batchSize(int batchSize)` Set batch (page) size for items loading using `ItemDataProvider`.
    `B` | `buffered(boolean buffered)` Sets the buffered mode to the specified status.
    `ItemDataSourceContainer<ITEM,PROPERTY>` | `build()` Build `ItemDataSourceContainer` instance
    `B` | `commitHandler(ItemDataSource.CommitHandler<ITEM> commitHandler)` Set the handler to manage item set modifications.
    `B` | `dataSource(ItemDataProvider<ITEM> dataProvider)` Set the items data provider.
    `B` | `defaultSort(com.holonplatform.core.query.QuerySort sort)` Set query default sort.
    `B` | `defaultValue(PROPERTY propertyId, Object defaultValue)` Set a default value to initialize the given `propertyId`
    `B` | `fixedFilter(com.holonplatform.core.query.QueryFilter filter)` Set query fixed filter (always added to query predicates)
    `B` | `fixedSort(com.holonplatform.core.query.QuerySort sort)` Set query fixed sort (always added to query sorts)
    `B` | `itemAdapter(ItemAdapter<ITEM> itemAdapter)` Set the item adapter to convert data source item data type to a container `Item` and back.
    `<ID> B` | `itemIdentifier(ItemIdentifierProvider<ITEM,ID> itemIdentifierProvider)` Set the item identifier provider to use to obtain item ids.
    `B` | `maxCacheSize(int maxCacheSize)` Set max items cache size
    `B` | `queryParameter(String name, Object value)` Add a query parameter
    `B` | `readOnly(PROPERTY propertyId, boolean readOnly)` Set whether given property id is read-only.
    `B` | `sortable(PROPERTY propertyId, boolean sortable)` Set whether given property id is sortable.
    `B` | `withItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener)` Add an `Container.ItemSetChangeListener`
    `B` | `withProperty(PROPERTY propertyId, Class<?> type)` Add an Item property to this container
    `B` | `withPropertySortGenerator(PROPERTY property, ItemDataSource.PropertySortGenerator<PROPERTY> propertySortGenerator)` Set a `ItemDataSource.PropertySortGenerator` to generate `QuerySort`s for given `property`
    `B` | `withQueryConfigurationProvider(com.holonplatform.core.query.QueryConfigurationProvider queryConfigurationProvider)` Add an external `QueryConfigurationProvider` for additional query configuration
    `B` | `withReadOnlyProperty(PROPERTY propertyId, Class<?> type)` Add an Item property to this container and declares it as read-only
    `B` | `withReadOnlySortableProperty(PROPERTY propertyId, Class<?> type)` Add an Item property to this container and declares it as read-only and sortable
    `B` | `withSortableProperty(PROPERTY propertyId, Class<?> type)` Add an Item property to this container and declares it as sortable

- - ### Method Detail

    - #### dataSource

          B dataSource(ItemDataProvider<ITEM> dataProvider)

      Set the items data provider.
      Parameters:
        `dataProvider` - The items data provider to set
      Returns:
        this

    - #### itemAdapter

          B itemAdapter(ItemAdapter<ITEM> itemAdapter)

      Set the item adapter to convert data source item data type to a container `Item` and back.
      Parameters:
        `itemAdapter` - The item adapter to set
      Returns:
        this

    - #### itemIdentifier

          <ID> B itemIdentifier(ItemIdentifierProvider<ITEM,ID> itemIdentifierProvider)

      Set the item identifier provider to use to obtain item ids.
      Type Parameters:
        `ID` - Item id type
      Parameters:
        `itemIdentifierProvider` - the item identifier provider to set
      Returns:
        this

    - #### withProperty

          B withProperty(PROPERTY propertyId,
                         Class<?> type)

      Add an Item property to this container
      Parameters:
        `propertyId` - Property id
        `type` - Property value type
      Returns:
        this

    - #### withSortableProperty

          B withSortableProperty(PROPERTY propertyId,
                                 Class<?> type)

      Add an Item property to this container and declares it as sortable
      Parameters:
        `propertyId` - Property id
        `type` - Property value type
      Returns:
        this

    - #### withReadOnlyProperty

          B withReadOnlyProperty(PROPERTY propertyId,
                                 Class<?> type)

      Add an Item property to this container and declares it as read-only
      Parameters:
        `propertyId` - Property id
        `type` - Property value type
      Returns:
        this

    - #### withReadOnlySortableProperty

          B withReadOnlySortableProperty(PROPERTY propertyId,
                                         Class<?> type)

      Add an Item property to this container and declares it as read-only and sortable
      Parameters:
        `propertyId` - Property id
        `type` - Property value type
      Returns:
        this

    - #### autoRefresh

          B autoRefresh(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
      Returns:
        this

    - #### batchSize

          B batchSize(int batchSize)

      Set batch (page) size for items loading using `ItemDataProvider`.

      A value `<=0` means no paging, and `ItemDataProvider` should behave in a consistent manner.

      Parameters:
        `batchSize` - Batch (page) size for items loading
      Returns:
        this

    - #### maxCacheSize

          B maxCacheSize(int maxCacheSize)

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

    - #### sortable

          B sortable(PROPERTY propertyId,
                     boolean sortable)

      Set whether given property id is sortable.
      Parameters:
        `propertyId` - Property id
        `sortable` - Whether given property id is sortable
      Returns:
        this

    - #### readOnly

          B readOnly(PROPERTY propertyId,
                     boolean readOnly)

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

    - #### defaultValue

          B defaultValue(PROPERTY propertyId,
                         Object defaultValue)

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

    - #### buffered

          B buffered(boolean buffered)

      Sets the buffered mode to the specified status.

      When in buffered mode, an internal buffer will be used to store changes using `ItemDataSource.CommitHandler` until `ItemDataSource.commit()` is called. Calling `ItemDataSource.discard()` will revert the internal buffer to the value of the data source.

      When in non-buffered mode, write operations will be done directly on the data source using `ItemDataSource.CommitHandler`. In this mode the `ItemDataSource.commit()` and `ItemDataSource.discard()` methods serve no purpose.

      Parameters:
        `buffered` - `true` if buffered mode should be turned on, `false` otherwise
      Returns:
        this

    - #### withPropertySortGenerator

          B withPropertySortGenerator(PROPERTY property,
                                      ItemDataSource.PropertySortGenerator<PROPERTY> propertySortGenerator)

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

    - #### withQueryConfigurationProvider

          B withQueryConfigurationProvider(com.holonplatform.core.query.QueryConfigurationProvider queryConfigurationProvider)

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

    - #### fixedFilter

          B fixedFilter(com.holonplatform.core.query.QueryFilter filter)

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

    - #### fixedSort

          B fixedSort(com.holonplatform.core.query.QuerySort sort)

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

    - #### defaultSort

          B defaultSort(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
      Returns:
        this

    - #### queryParameter

          B queryParameter(String name,
                           Object value)

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

    - #### commitHandler

          B commitHandler(ItemDataSource.CommitHandler<ITEM> commitHandler)

      Set the handler to manage item set modifications.

      This is required to activate item set modification support, using methods such as `Container.addItem()`, `Container.removeItem(Object)` and `Buffered.commit()`.

      Parameters:
        `commitHandler` - Item commit handler
      Returns:
        this

    - #### withItemSetChangeListener

          B withItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener listener)

      Add an `Container.ItemSetChangeListener`
      Parameters:
        `listener` - Listener to add
      Returns:
        this

    - #### build

          ItemDataSourceContainer<ITEM,PROPERTY> build()

      Build `ItemDataSourceContainer` instance
      Returns:
        ItemDataSourceContainer instance

Copyright © 2017 The Holon Platform. All rights reserved.