com.vaadin.flow.spring.data.
Interface VaadinSpringDataHelpers
All Superinterfaces:
Contains helper methods to work with Spring Data based back-ends and Vaadin components.
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T> CallbackDataProvider.FetchCallback<T,
Void> fromPagingRepository
(org.springframework.data.repository.PagingAndSortingRepository<T, ?> repo) Binds all items from a given paging Spring Data repository to
Grid
.static org.springframework.data.domain.Sort
toSpringDataSort
(Query<?, ?> vaadinQuery) Translates given Query object from a Vaadin component to Spring Data Sort object.
static org.springframework.data.domain.PageRequest
toSpringPageRequest
(Query<?, ?> vaadinQuery) Creates a Spring Data
PageRequest
based on the VaadinQuery
object.
-
Method Details
-
toSpringDataSort
Translates given Query object from a Vaadin component to Spring Data Sort object.
Can be used as a helper when making a lazy data binding from a Vaadin component to a Spring Data based back-end. The method expects Vaadin sort data to include the property name.
Parameters:
vaadinQuery
- the Vaadin Query object passed by the componentReturns:
the Sort object that can be passed for Spring Data based back-end
-
toSpringPageRequest
Creates a Spring Data
PageRequest
based on the VaadinQuery
object. Takes sort into account, based on properties.Parameters:
vaadinQuery
- the query object from Vaadin componentReturns:
a
PageRequest
that can be passed for Spring Data based back-end -
fromPagingRepository
static <T> CallbackDataProvider.FetchCallback<T,Void> fromPagingRepository(org.springframework.data.repository.PagingAndSortingRepository<T, ?> repo) Binds all items from a given paging Spring Data repository to
Grid
. Usage example:grid.setItems(fromPagingRepository(repo));
Type Parameters:
T
- the type of items to bindParameters:
repo
- the repository where the results should be fetched fromReturns:
the FetchCallback that makes the lazy binding to
Grid
.
-