T
- item typeF
- filter typeV
- DataView typepublic interface HasLazyDataView<T,F,V extends LazyDataView<T>> extends Serializable
LazyDataView
.Modifier and Type | Method and Description |
---|---|
V |
getLazyDataView()
Get the LazyDataView for the component that allows access to the items in
the component.
|
V |
setItems(BackEndDataProvider<T,F> dataProvider)
Supply items with a
BackEndDataProvider that lazy loads items
from a backend. |
default V |
setItems(CallbackDataProvider.FetchCallback<T,F> fetchCallback)
Supply items lazily with a callback from a backend.
|
default V |
setItems(CallbackDataProvider.FetchCallback<T,F> fetchCallback,
CallbackDataProvider.CountCallback<T,F> countCallback)
Supply items lazily with callbacks: the first one fetches the items based
on offset, limit and an optional filter, the second provides the exact
count of items in the backend.
|
default V setItems(CallbackDataProvider.FetchCallback<T,F> fetchCallback)
component.setItems(query -> orderService.getOrders(query.getOffset(), query.getLimit());
If the component supports filtering, it can be fetched with query.getFilter().
The returned data view object can be used for further configuration, or
later on fetched with getLazyDataView()
. For using in-memory
data, like Collection
, use
HasListDataView.setItems(Collection)
instead.
fetchCallback
- function that returns a stream of items from the backend based
on the offset, limit and an optional filter provided by the
query objectdefault V setItems(CallbackDataProvider.FetchCallback<T,F> fetchCallback, CallbackDataProvider.CountCallback<T,F> countCallback)
component.setItems(
query -> orderService.getOrders(query.getOffset, query.getLimit()),
query -> orderService.getSize());
If the component supports filtering, it can be fetched with query.getFilter().
The returned data view object can be used for further configuration, or
later on fetched with getLazyDataView()
. For using in-memory
data, like Collection
, use
HasListDataView.setItems(Collection)
instead.
fetchCallback
- function that returns a stream of items from the back end for
a querycountCallback
- function that return the number of items in the back end for a
queryV setItems(BackEndDataProvider<T,F> dataProvider)
BackEndDataProvider
that lazy loads items
from a backend. Note that component will query the data provider for the
item count. In case that is not desired for performance reasons, use
setItems(CallbackDataProvider.FetchCallback)
instead.
The returned data view object can be used for further configuration, or
later on fetched with getLazyDataView()
. For using in-memory
data, like Collection
, use
HasListDataView.setItems(Collection)
instead.
dataProvider
- BackEndDataProvider instanceV getLazyDataView()
ListDataView
.IllegalStateException
- when lazy data view is not applicableCopyright © 2021. All rights reserved.