Interface DataView<T>

    • Method Detail

      • getItem

        T getItem​(int index)
        Gets the item at the given index from the data available to the component. Data is filtered and sorted the same way as in the component.
        Parameters:
        index - item index number
        Returns:
        item on index
        Throws:
        IndexOutOfBoundsException - requested index is outside of the filtered and sorted data set
      • getItems

        Stream<T> getItems()
        Get the full data available to the component. Data is filtered and sorted the same way as in the component.
        Returns:
        filtered and sorted data set
      • refreshAll

        void refreshAll()
        Notifies the component that all the items should be refreshed.
      • addItemCountChangeListener

        Registration addItemCountChangeListener​(ComponentEventListener<ItemCountChangeEvent<?>> listener)
        Add an item count change listener that is fired when the item count changes. This can happen for instance when filtering the items.

        Item count change listener is bound to the component and will be retained even if the data changes by setting of a new items or DataProvider to component.

        NOTE: when the component supports lazy loading (implements HasLazyDataView) and a count callback has not been provided, an estimate of the item count is used and increased until the actual count has been reached. When the estimate is used, the event is fired with the ItemCountChangeEvent.isItemCountEstimated() returning true.

        Parameters:
        listener - item count change listener to register
        Returns:
        registration for removing the listener
      • setIdentifierProvider

        void setIdentifierProvider​(IdentifierProvider<T> identifierProvider)
        Sets an identifier provider, which returns an identifier for the given item. The identifier is used for comparing the equality of items. Usage example: dataView.setIdentifiedProvider(Item::getId);.
        Parameters:
        identifierProvider - function that returns the non-null identifier for a given item