本文整理汇总了Java中com.vaadin.data.provider.Query.getInMemorySorting方法的典型用法代码示例。如果您正苦于以下问题:Java Query.getInMemorySorting方法的具体用法?Java Query.getInMemorySorting怎么用?Java Query.getInMemorySorting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.data.provider.Query
的用法示例。
在下文中一共展示了Query.getInMemorySorting方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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());
}
示例3: 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());
}
示例4: 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));
}
示例5: 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());
}
示例6: 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());
}