本文整理汇总了Java中com.vaadin.data.provider.Query.getSortOrders方法的典型用法代码示例。如果您正苦于以下问题:Java Query.getSortOrders方法的具体用法?Java Query.getSortOrders怎么用?Java Query.getSortOrders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.data.provider.Query
的用法示例。
在下文中一共展示了Query.getSortOrders方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSpringSort
import com.vaadin.data.provider.Query; //导入方法依赖的package包/类
private <T, F> Sort createSpringSort(Query<T, F> q) {
List<QuerySortOrder> sortOrders;
if (q.getSortOrders().isEmpty()) {
sortOrders = getDefaultSortOrders();
} else {
sortOrders = q.getSortOrders();
}
List<Order> orders = sortOrders.stream()
.map(PageableDataProvider::queryOrderToSpringOrder)
.collect(Collectors.toList());
if (orders.isEmpty()) {
return null;
} else {
return new Sort(orders);
}
}
示例2: getConfiguration
import com.vaadin.data.provider.Query; //导入方法依赖的package包/类
protected QueryConfigurationProvider getConfiguration(final Query<ITEM, QueryFilter> query) {
final QueryFilter filter = query.getFilter().orElse(null);
final List<QuerySort> sorts = new LinkedList<>();
List<QuerySortOrder> orders = query.getSortOrders();
if (orders != null && !orders.isEmpty()) {
orders.forEach(o -> sorts.add(fromOrder(o)));
}
final QuerySort sort = getSort(sorts);
return new QueryConfigurationProvider() {
@Override
public QueryFilter getQueryFilter() {
return filter;
}
@Override
public QuerySort getQuerySort() {
return sort;
}
};
}
示例3: testOffsetProvidedByQuery
import com.vaadin.data.provider.Query; //导入方法依赖的package包/类
@Test
public void testOffsetProvidedByQuery() {
Query<String, SerializablePredicate<String>> zeroOffsetQuery = new Query<>();
Assert.assertEquals(controls.getPageLength(), pagedDP.size(zeroOffsetQuery));
Query<String, SerializablePredicate<String>> singleOffsetQuery = new Query<>(
1,
zeroOffsetQuery.getLimit(),
zeroOffsetQuery.getSortOrders(),
zeroOffsetQuery.getInMemorySorting(),
zeroOffsetQuery.getFilter().orElse(null));
Assert.assertEquals(controls.getPageLength(), pagedDP.size(singleOffsetQuery));
Assert.assertEquals(controls.getPageLength() - 1, pagedDP.fetch(singleOffsetQuery).count());
controls.nextPage();
Assert.assertEquals(controls.getPageLength(), pagedDP.size(singleOffsetQuery));
Assert.assertEquals(controls.getPageLength() - 1, pagedDP.fetch(singleOffsetQuery).count());
}
示例4: testLimitProvidedByQuery
import com.vaadin.data.provider.Query; //导入方法依赖的package包/类
@Test
public void testLimitProvidedByQuery() {
Query<String, SerializablePredicate<String>> implicitLimitQuery = new Query<>();
Assert.assertEquals(controls.getPageLength(), pagedDP.size(implicitLimitQuery));
Query<String, SerializablePredicate<String>> explicitLimitQuery = new Query<>(
implicitLimitQuery.getOffset(),
controls.getPageLength() - 1,
implicitLimitQuery.getSortOrders(),
implicitLimitQuery.getInMemorySorting(),
implicitLimitQuery.getFilter().orElse(null));
Assert.assertEquals(controls.getPageLength(), pagedDP.size(explicitLimitQuery));
Assert.assertEquals(controls.getPageLength() - 1, pagedDP.fetch(explicitLimitQuery).count());
controls.nextPage();
Assert.assertEquals(controls.getPageLength(), pagedDP.size(explicitLimitQuery));
Assert.assertEquals(controls.getPageLength() - 1, pagedDP.fetch(explicitLimitQuery).count());
}
示例5: testOffsetAndLimitProvidedByQuery
import com.vaadin.data.provider.Query; //导入方法依赖的package包/类
@Test
public void testOffsetAndLimitProvidedByQuery() {
Query<String, SerializablePredicate<String>> implicitLimitQuery = new Query<>();
Assert.assertEquals(controls.getPageLength(), pagedDP.size(implicitLimitQuery));
Query<String, SerializablePredicate<String>> explicitLimitQuery = new Query<>(
1,
controls.getPageLength() - 2,
implicitLimitQuery.getSortOrders(),
implicitLimitQuery.getInMemorySorting(),
implicitLimitQuery.getFilter().orElse(null));
Assert.assertEquals(controls.getPageLength(), pagedDP.size(explicitLimitQuery));
Assert.assertEquals(controls.getPageLength()- 2, pagedDP.fetch(explicitLimitQuery).count());
controls.nextPage();
Assert.assertEquals(controls.getPageLength(), pagedDP.size(explicitLimitQuery));
Assert.assertEquals(controls.getPageLength() - 2, pagedDP.fetch(explicitLimitQuery).count());
}
示例6: alignQuery
import com.vaadin.data.provider.Query; //导入方法依赖的package包/类
<T, F> Query<T, F> alignQuery(Query<T, F> query) {
BigInteger pageNumber = BigInteger.valueOf(this.pageNumber);
BigInteger pageLength = BigInteger.valueOf(this.pageLength);
BigInteger queryOffset = BigInteger.valueOf(query.getOffset());
BigInteger queryLimit = BigInteger.valueOf(query.getLimit());
BigInteger maxInteger = BigInteger
.valueOf(Integer.MAX_VALUE);
BigInteger offset = pageNumber
.multiply(pageLength)
.add(queryOffset)
.max(BigInteger.ZERO)
.min(maxInteger);
BigInteger limit = pageLength.subtract(queryOffset)
.min(queryLimit)
.max(BigInteger.ZERO)
.min(maxInteger);
return new Query<>(
offset.intValue(),
limit.intValue(),
query.getSortOrders(),
query.getInMemorySorting(),
query.getFilter().orElse(null));
}
示例7: testOffsetProvidedByQueryIsOnePageLength
import com.vaadin.data.provider.Query; //导入方法依赖的package包/类
@Test
public void testOffsetProvidedByQueryIsOnePageLength() {
Query<String, SerializablePredicate<String>> zeroOffsetQuery = new Query<>();
Assert.assertEquals(controls.getPageLength(), pagedDP.size(zeroOffsetQuery));
Query<String, SerializablePredicate<String>> singlePageOffsetQuery = new Query<>(
controls.getPageLength(),
zeroOffsetQuery.getLimit(),
zeroOffsetQuery.getSortOrders(),
zeroOffsetQuery.getInMemorySorting(),
zeroOffsetQuery.getFilter().orElse(null));
Assert.assertEquals(controls.getPageLength(), pagedDP.size(singlePageOffsetQuery));
Assert.assertEquals(0, pagedDP.fetch(singlePageOffsetQuery).count());
}
示例8: testOffsetProvidedByQueryIsTwoPageLengths
import com.vaadin.data.provider.Query; //导入方法依赖的package包/类
@Test
public void testOffsetProvidedByQueryIsTwoPageLengths() {
Query<String, SerializablePredicate<String>> zeroOffsetQuery = new Query<>();
Assert.assertEquals(controls.getPageLength(), pagedDP.size(zeroOffsetQuery));
Query<String, SerializablePredicate<String>> twoPageOffsetQuery = new Query<>(
controls.getPageLength() * 2,
zeroOffsetQuery.getLimit(),
zeroOffsetQuery.getSortOrders(),
zeroOffsetQuery.getInMemorySorting(),
zeroOffsetQuery.getFilter().orElse(null));
Assert.assertEquals(controls.getPageLength(), pagedDP.size(twoPageOffsetQuery));
Assert.assertEquals(0, pagedDP.fetch(twoPageOffsetQuery).count());
}