当前位置: 首页>>代码示例>>Java>>正文


Java Query.getSortOrders方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:vaadin,项目名称:trippy,代码行数:17,代码来源:PageableDataProvider.java

示例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;
		}

	};
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:25,代码来源:ItemDataProviderAdapter.java

示例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());
}
 
开发者ID:tsuoanttila,项目名称:GridExtensionPack,代码行数:19,代码来源:PagedDataProviderTest.java

示例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());
}
 
开发者ID:tsuoanttila,项目名称:GridExtensionPack,代码行数:19,代码来源:PagedDataProviderTest.java

示例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());
}
 
开发者ID:tsuoanttila,项目名称:GridExtensionPack,代码行数:19,代码来源:PagedDataProviderTest.java

示例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));
}
 
开发者ID:tsuoanttila,项目名称:GridExtensionPack,代码行数:28,代码来源:PagingControls.java

示例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());
}
 
开发者ID:tsuoanttila,项目名称:GridExtensionPack,代码行数:15,代码来源:PagedDataProviderTest.java

示例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());
}
 
开发者ID:tsuoanttila,项目名称:GridExtensionPack,代码行数:15,代码来源:PagedDataProviderTest.java


注:本文中的com.vaadin.data.provider.Query.getSortOrders方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。