T
- data typeV
- ListDataView typepublic interface ListDataView<T,V extends ListDataView<T,?>> extends DataView<T>
List
is mutable.Modifier and Type | Method and Description |
---|---|
V |
addFilter(SerializablePredicate<T> filter)
Adds a filter to be applied to all queries.
|
V |
addItem(T item)
Adds an item to the data list if it is not already present.
|
V |
addItemAfter(T item,
T after)
Adds an item after the given target item.
|
V |
addItemBefore(T item,
T before)
Adds an item before the given target item.
|
V |
addItems(Collection<T> items)
Adds multiple items to the data list.
|
V |
addItemsAfter(Collection<T> items,
T after)
Adds multiple items after the given target item.
|
V |
addItemsBefore(Collection<T> items,
T before)
Adds multiple items before the given target item.
|
V |
addSortComparator(SerializableComparator<T> sortComparator)
Adds a comparator to the data default sorting.
|
<V1 extends Comparable<? super V1>> |
addSortOrder(ValueProvider<T,V1> valueProvider,
SortDirection sortDirection)
Adds a property and direction to the default sorting.
|
boolean |
contains(T item)
Check if item is present in the currently filtered data set.
|
int |
getItemCount()
Get the full item count with filters if any set.
|
Optional<T> |
getNextItem(T item)
Gets the item after given item from the filtered and sorted data.
|
Optional<T> |
getPreviousItem(T item)
Gets the item before given item from the filtered and sorted data.
|
V |
removeFilters()
Removes all in-memory filters set or added.
|
V |
removeItem(T item)
Remove an item from the data list.
|
V |
removeItems(Collection<T> items)
Remove multiple items from the data list.
|
V |
removeSorting()
Removes any default sorting that has been set or added previously.
|
V |
setFilter(SerializablePredicate<T> filter)
Sets a filter to be applied to the data.
|
V |
setSortComparator(SerializableComparator<T> sortComparator)
Sets the comparator to use as the default sorting.
|
<V1 extends Comparable<? super V1>> |
setSortOrder(ValueProvider<T,V1> valueProvider,
SortDirection sortDirection)
Sets the property and direction to use as the default sorting.
|
addItemCountChangeListener, getItem, getItems, refreshAll, refreshItem, setIdentifierProvider
boolean contains(T item)
By default, equals
method implementation of the item is used for
identity check. If a custom data provider is used, then the
DataProvider.getId(Object)
method is used instead. Item's custom
identity can be set up with a
DataView.setIdentifierProvider(IdentifierProvider)
.
item
- item to search fortrue
if item is found in filtered data setDataView.setIdentifierProvider(IdentifierProvider)
int getItemCount()
DataView.addItemCountChangeListener(ComponentEventListener)
method
instead to get notified when the item count has changed.DataView.addItemCountChangeListener(ComponentEventListener)
Optional<T> getNextItem(T item)
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.
item
- item to get next forgetPreviousItem(Object)
Optional<T> getPreviousItem(T item)
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.
item
- item to get previous forgetNextItem(Object)
V addItem(T item)
The backing List
must be mutable to use this method. Immutable data
structure will throw an exception.
item
- item to addUnsupportedOperationException
- if backing collection doesn't support modificationaddItemBefore(Object, Object)
,
addItemAfter(Object, Object)
,
removeItem(Object)
V addItemAfter(T item, T after)
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.
item
- item to addafter
- item after which to add the item atUnsupportedOperationException
- if backing collection doesn't support modificationIllegalArgumentException
- if item doesn't exist or collection is not a listaddItem(Object)
,
addItemBefore(Object, Object)
V addItemBefore(T item, T before)
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.
item
- item to addbefore
- item before which to add the item atUnsupportedOperationException
- if backing collection doesn't support modificationIllegalArgumentException
- if item doesn't exist or collection is not a listaddItem(Object)
,
addItemAfter(Object, Object)
V addItems(Collection<T> items)
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 to the end.
items
- collection of item to addUnsupportedOperationException
- if backing collection doesn't support modificationremoveItems(Collection)
,
addItemsBefore(Collection, Object)
,
addItemsAfter(Collection, Object)
V addItemsAfter(Collection<T> items, T after)
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.
items
- collection of items to addafter
- item after which to add the item atUnsupportedOperationException
- if backing collection doesn't support modificationIllegalArgumentException
- if item doesn't exist or collection is not a listaddItems(Collection)
,
addItemsBefore(Collection, Object)
V addItemsBefore(Collection<T> items, T before)
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.
items
- collection of items to addbefore
- item before which to add the item atUnsupportedOperationException
- if backing collection doesn't support modificationIllegalArgumentException
- if item doesn't exist or collection is not a listaddItems(Collection)
,
addItemsAfter(Collection, Object)
V removeItem(T item)
The backing List
must be mutable to use this method. Immutable data
structure will throw an exception.
item
- item to removeUnsupportedOperationException
- if backing collection doesn't support modificationaddItem(Object)
,
removeItems(Collection)
V removeItems(Collection<T> items)
The backing List
must be mutable to use this method. Immutable data
structure will throw an exception.
items
- collection of items to removeUnsupportedOperationException
- if backing collection doesn't support modificationremoveItem(Object)
,
removeItems(Collection)
V setFilter(SerializablePredicate<T> filter)
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.
filter
- filter to be set, or null
to clear any previously
set filtersaddFilter(SerializablePredicate)
,
removeFilters()
V addFilter(SerializablePredicate<T> filter)
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.
filter
- the filter to add, not null
setFilter(SerializablePredicate)
,
removeFilters()
V removeFilters()
addFilter(SerializablePredicate)
,
setFilter(SerializablePredicate)
V setSortComparator(SerializableComparator<T> sortComparator)
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.
sortComparator
- a comparator to use, or null
to clear any
previously set sort orderaddSortComparator(SerializableComparator)
V addSortComparator(SerializableComparator<T> sortComparator)
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.
sortComparator
- a comparator to add, not null
setSortComparator(SerializableComparator)
V removeSorting()
Any other component using the same DataProvider
object would not
be affected by removing default sorting through data view of another
component.
setSortComparator(SerializableComparator)
,
addSortComparator(SerializableComparator)
<V1 extends Comparable<? super V1>> V setSortOrder(ValueProvider<T,V1> valueProvider, SortDirection sortDirection)
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.
V1
- the provided value typevalueProvider
- the value provider that defines the property do sort by, not
null
sortDirection
- the sort direction to use, not null
addSortOrder(ValueProvider, SortDirection)
<V1 extends Comparable<? super V1>> V addSortOrder(ValueProvider<T,V1> valueProvider, SortDirection sortDirection)
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.
V1
- the provided value typevalueProvider
- the value provider that defines the property do sort by, not
null
sortDirection
- the sort direction to use, not null
setSortOrder(ValueProvider, SortDirection)
Copyright © 2021. All rights reserved.