com.vaadin.flow.data.provider.Query.getOffset()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中com.vaadin.flow.data.provider.Query.getOffset方法的一些代码示例,展示了Query.getOffset的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getOffset方法的具体详情如下:
包路径:com.vaadin.flow.data.provider.Query
类名称:Query
方法名:getOffset

Query.getOffset介绍

[英]Gets the first index of items to fetch. The offset is only used when fetching items, but not when counting the number of available items.
[中]获取要获取的项的第一个索引。偏移量仅在获取项目时使用,但在计算可用项目数时不使用。

代码示例

代码示例来源:origin: com.vaadin/flow-data

@Override
public int getOffset() {
  isOffsetCalled = true;
  return super.getOffset();
}

代码示例来源:origin: com.vaadin/flow-data

@Override
public Stream<T> fetch(Query<T, SerializablePredicate<T>> query) {
  Stream<T> stream = getFilteredStream(query);
  Optional<Comparator<T>> comparing = Stream
      .of(query.getInMemorySorting(), sortOrder)
      .filter(Objects::nonNull)
      .reduce((c1, c2) -> c1.thenComparing(c2));
  if (comparing.isPresent()) {
    stream = stream.sorted(comparing.get());
  }
  return stream.skip(query.getOffset()).limit(query.getLimit());
}

代码示例来源:origin: com.vaadin/flow-data

private Query<T, F> mixInSortOrders(Query<T, F> query) {
  if (sortOrders.isEmpty()) {
    return query;
  }
  Set<String> sortedPropertyNames = query.getSortOrders().stream()
      .map(SortOrder::getSorted).collect(Collectors.toSet());
  List<QuerySortOrder> combinedSortOrders = Stream
      .concat(query.getSortOrders().stream(),
          sortOrders.stream()
              .filter(order -> !sortedPropertyNames
                  .contains(order.getSorted())))
      .collect(Collectors.toList());
  return new Query<>(query.getOffset(), query.getLimit(),
      combinedSortOrders, query.getInMemorySorting(),
      query.getFilter().orElse(null));
}

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin-flow

q.offset(query.getOffset());

代码示例来源:origin: com.vaadin/flow-data

@Override
public Stream<T> fetch(Query<T, F> t) {
  return dataProvider.fetch(new Query<>(t.getOffset(), t.getLimit(),
      t.getSortOrders(), t.getInMemorySorting(), getFilter(t)));
}

代码示例来源:origin: com.vaadin/flow-data

@Override
public int size(Query<T, F> t) {
  return dataProvider.size(new Query<>(t.getOffset(), t.getLimit(),
      t.getSortOrders(), t.getInMemorySorting(), getFilter(t)));
}

相关文章