Interface ListDataView<T,​V extends ListDataView<T,​?>>

    • Method Detail

      • getNextItem

        Optional<T> getNextItem​(T item)
        Gets the item after given item from the filtered and sorted data.

        Note! Item might be present in the data set, but be filtered out or be the last item so that the next item won't be available.

        Parameters:
        item - item to get next for
        Returns:
        next item if available, else empty optional if item doesn't exist or not in current filtered items
        See Also:
        getPreviousItem(Object)
      • getPreviousItem

        Optional<T> getPreviousItem​(T item)
        Gets the item before given item from the filtered and sorted data.

        Note! Item might be present in the data set, but be filtered out or be the first item so that the previous item won't be available.

        Parameters:
        item - item to get previous for
        Returns:
        previous item if available, else empty optional if item doesn't exist or not in current filtered items
        See Also:
        getNextItem(Object)
      • addItemAfter

        V addItemAfter​(T item,
                       T after)
        Adds an item after the given target item.

        The backing List must be mutable to use this method. Immutable data structure will throw an exception.

        If the item is already present in the data provider, then it is moved.

        Note! Item is added to the unfiltered and unsorted List.

        Parameters:
        item - item to add
        after - item after which to add the item at
        Returns:
        this ListDataView instance
        Throws:
        UnsupportedOperationException - if backing collection doesn't support modification
        IllegalArgumentException - if item doesn't exist or collection is not a list
        See Also:
        addItem(Object), addItemBefore(Object, Object)
      • addItemBefore

        V addItemBefore​(T item,
                        T before)
        Adds an item before the given target item.

        The backing List must be mutable to use this method. Immutable data structure will throw an exception.

        If the item is already present in the data provider, then it is moved.

        Note! Item is added to the unfiltered and unsorted List.

        Parameters:
        item - item to add
        before - item before which to add the item at
        Returns:
        this ListDataView instance
        Throws:
        UnsupportedOperationException - if backing collection doesn't support modification
        IllegalArgumentException - if item doesn't exist or collection is not a list
        See Also:
        addItem(Object), addItemAfter(Object, Object)
      • addItemsAfter

        V addItemsAfter​(Collection<T> items,
                        T after)
        Adds multiple items after the given target item. The full collection is added in order after the target.

        The backing List must be mutable to use this method. Immutable data structure will throw an exception. Any items that already present in the data provider are moved.

        Note! Item is added to the unfiltered and unsorted List.

        Parameters:
        items - collection of items to add
        after - item after which to add the item at
        Returns:
        this ListDataView instance
        Throws:
        UnsupportedOperationException - if backing collection doesn't support modification
        IllegalArgumentException - if item doesn't exist or collection is not a list
        See Also:
        addItems(Collection), addItemsBefore(Collection, Object)
      • addItemsBefore

        V addItemsBefore​(Collection<T> items,
                         T before)
        Adds multiple items before the given target item. The full collection is added in order before the target.

        The backing List must be mutable to use this method. Immutable data structure will throw an exception.

        Any items that already present in the data provider are moved.

        Note! Item is added to the unfiltered and unsorted List.

        Parameters:
        items - collection of items to add
        before - item before which to add the item at
        Returns:
        this ListDataView instance
        Throws:
        UnsupportedOperationException - if backing collection doesn't support modification
        IllegalArgumentException - if item doesn't exist or collection is not a list
        See Also:
        addItems(Collection), addItemsAfter(Collection, Object)
      • removeItem

        V removeItem​(T item)
        Remove an item from the data list.

        The backing List must be mutable to use this method. Immutable data structure will throw an exception.

        Parameters:
        item - item to remove
        Returns:
        this ListDataView instance
        Throws:
        UnsupportedOperationException - if backing collection doesn't support modification
        See Also:
        addItem(Object), removeItems(Collection)
      • setFilter

        V setFilter​(SerializablePredicate<T> filter)
        Sets a filter to be applied to the data. The filter replaces any filter that has been set or added previously. null will clear all filters.

        This filter is bound to the component. Thus, any other component using the same DataProvider object would not be affected by setting a filter through data view of another component. A filter set by this method won't be retained when a new DataProvider is set to the component.

        Parameters:
        filter - filter to be set, or null to clear any previously set filters
        Returns:
        ListDataView instance
        See Also:
        addFilter(SerializablePredicate), removeFilters()
      • addFilter

        V addFilter​(SerializablePredicate<T> filter)
        Adds a filter to be applied to all queries. The filter will be used in addition to any filter that has been set or added previously.

        This filter is bound to the component. Thus, any other component using the same DataProvider object would not be affected by setting a filter through data view of another component. A filter set by this method won't be retained when a new DataProvider is set to the component.

        Parameters:
        filter - the filter to add, not null
        Returns:
        ListDataView instance
        See Also:
        setFilter(SerializablePredicate), removeFilters()
      • setSortComparator

        V setSortComparator​(SerializableComparator<T> sortComparator)
        Sets the comparator to use as the default sorting. This overrides the sorting set by any other method that manipulates the default sorting.

        This comparator is bound to the component. Thus, any other component using the same DataProvider object would not be affected by setting a sort comparator through data view of another component. A sorting set by this method won't be retained when a new DataProvider is set to the component.

        Parameters:
        sortComparator - a comparator to use, or null to clear any previously set sort order
        Returns:
        ListDataView instance
        See Also:
        addSortComparator(SerializableComparator)
      • addSortComparator

        V addSortComparator​(SerializableComparator<T> sortComparator)
        Adds a comparator to the data default sorting. If no default sorting has been defined, then the provided comparator will be used as the default sorting. If a default sorting has been defined, then the provided comparator will be used to determine the ordering of items that are considered equal by the previously defined default sorting.

        This comparator is bound to the component. Thus, any other component using the same DataProvider object would not be affected by setting a sort comparator through data view of another component. A sorting set by this method won't be retained when a new DataProvider is set to the component.

        Parameters:
        sortComparator - a comparator to add, not null
        Returns:
        ListDataView instance
        See Also:
        setSortComparator(SerializableComparator)
      • setSortOrder

        <V1 extends Comparable<? super V1>> V setSortOrder​(ValueProvider<T,​V1> valueProvider,
                                                           SortDirection sortDirection)
        Sets the property and direction to use as the default sorting. This overrides the sorting set by any other method that manipulates the default sorting of this DataProvider.

        This sort order is bound to the component. Thus, any other component using the same DataProvider object would not be affected by setting a sort order through data view of another component. A sort order set by this method won't be retained when a new DataProvider is set to the component.

        Type Parameters:
        V1 - the provided value type
        Parameters:
        valueProvider - the value provider that defines the property do sort by, not null
        sortDirection - the sort direction to use, not null
        Returns:
        ListDataView instance
        See Also:
        addSortOrder(ValueProvider, SortDirection)
      • addSortOrder

        <V1 extends Comparable<? super V1>> V addSortOrder​(ValueProvider<T,​V1> valueProvider,
                                                           SortDirection sortDirection)
        Adds a property and direction to the default sorting. If no default sorting has been defined, then the provided sort order will be used as the default sorting. If a default sorting has been defined, then the provided sort order will be used to determine the ordering of items that are considered equal by the previously defined default sorting.

        This sort order is bound to the component. Thus, any other component using the same DataProvider object would not be affected by setting a sort sort through data view of another component. A sorting set by this method won't be retained when a new DataProvider is set to the component.

        Type Parameters:
        V1 - the provided value type
        Parameters:
        valueProvider - the value provider that defines the property do sort by, not null
        sortDirection - the sort direction to use, not null
        Returns:
        ListDataView instance
        See Also:
        setSortOrder(ValueProvider, SortDirection)