Java Code Examples for com.vaadin.flow.data.provider.Query#getLimit()

The following examples show how to use com.vaadin.flow.data.provider.Query#getLimit() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PageableDataProvider.java    From spring-data-provider with Apache License 2.0 5 votes vote down vote up
private <T> Stream<T> fromPageable(Page<T> result, Pageable pageable,
        Query<T, ?> query) {
    List<T> items = result.getContent();

    int firstRequested = query.getOffset();
    int nrRequested = query.getLimit();
    int firstReturned = (int) pageable.getOffset();
    int firstReal = firstRequested - firstReturned;
    int afterLastReal = firstReal + nrRequested;
    if (afterLastReal > items.size()) {
        afterLastReal = items.size();
    }
    return items.subList(firstReal, afterLastReal).stream();
}
 
Example 2
Source File: FilterablePageableDataProvider.java    From spring-data-provider with Apache License 2.0 4 votes vote down vote up
private Query<T, F> getFilterQuery(Query<T, F> t) {
    return new Query(t.getOffset(), t.getLimit(), t.getSortOrders(),
            t.getInMemorySorting(), filter);
}
 
Example 3
Source File: OffsetBasedPageRequest.java    From crudui with Apache License 2.0 4 votes vote down vote up
public OffsetBasedPageRequest(Query query) {
    this(query.getOffset(), query.getLimit(), toSort(query.getSortOrders()));
}