本文整理了Java中com.vaadin.data.provider.Query.<init>
方法的一些代码示例,展示了Query.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>
方法的具体详情如下:
包路径:com.vaadin.data.provider.Query
类名称:Query
方法名:<init>
[英]Constructs a Query for all rows from 0 to Integer#MAX_VALUEwithout sorting and filtering.
[中]为从0到整数#MAX_值的所有行构造一个查询,无需排序和筛选。
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Fetch all items from the given data provider.
*
* @since 8.1
* @param dataProvider
* the data provider to fetch from
* @return all items in this data provider
*/
private Stream<T> fetchAll(DataProvider<T, ?> dataProvider) {
return dataProvider.fetch(new Query<>());
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Fetches a list of items from the DataProvider.
*
* @param offset
* the starting index of the range
* @param limit
* the max number of results
* @return the list of items in given range
*
* @since 8.1
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public List<T> fetchItemsWithRange(int offset, int limit) {
return (List<T>) getDataProvider().fetch(new Query(offset, limit,
backEndSorting, inMemorySorting, filter))
.collect(Collectors.toList());
}
代码示例来源:origin: com.vaadin/vaadin-server
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.vaadin/vaadin-server
/**
* Writes the data source items to a design. Hierarchical select components
* should override this method to only write the root items.
*
* @param design
* the element into which to insert the items
* @param context
* the DesignContext instance used in writing
*/
protected void writeItems(Element design, DesignContext context) {
internalGetDataProvider().fetch(new Query<>())
.forEach(item -> writeItem(design, item, context));
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Writes the data contained in this grid. Used when serializing a grid to
* its declarative representation, if
* {@link DesignContext#shouldWriteData(Component)} returns {@code true} for
* the grid that is being written.
*
* @since 8.1
*
* @param body
* the body element to write the declarative representation of
* data to
* @param designContext
* the design context
*
* @since 8.1
*/
protected void writeData(Element body, DesignContext designContext) {
getDataProvider().fetch(new Query<>())
.forEach(item -> writeRow(body, item, designContext));
}
代码示例来源:origin: com.vaadin/vaadin-server
/**
* Getter method for finding the size of DataProvider. Can be overridden by
* a subclass that uses a specific type of DataProvider and/or query.
*
* @return the size of data provider with current filter
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public int getDataProviderSize() {
return getDataProvider().size(new Query(getFilter()));
}
代码示例来源:origin: com.vaadin/vaadin-server
@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/vaadin-server
@Override
public int size(Query<T, F> t) {
return dataProvider.size(new Query<>(t.getOffset(), t.getLimit(),
t.getSortOrders(), t.getInMemorySorting(), getFilter(t)));
}
代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin
@Override
public void selectAll() {
getDataProvider().ifPresent(dp -> {
Stream<ITEM> allItemsStream = dp.fetch(new Query<>());
LinkedHashSet<ITEM> allItems = new LinkedHashSet<>();
allItemsStream.forEach(allItems::add);
getInternalField().setValue(allItems);
});
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral
@Test
public void getItems() throws Exception {
// GIVEN WHEN
dataProvider.filterByCategory(PulseItemCategory.ALL_TASKS);
Query query = new Query<Task, Void>(0, 9, Collections.emptyList(), null, null);
List<Task> items = (List<Task>) dataProvider.fetchFromBackEnd(query).collect(Collectors.toList());
dataProvider.filterByCategory(PulseItemCategory.UNCLAIMED);
query = new Query<Task, Void>(0, 3, ImmutableList.of(new QuerySortOrder(TaskConstants.ID, SortDirection.DESCENDING)), null, null);
List<Task> itemsSorted = (List<Task>) dataProvider.fetchFromBackEnd(query).collect(Collectors.toList());
// THEN
assertThat(items.size(), is(9));
assertThat(items, containsIdsInOrder(1, 2, 3, 4, 5, 6, 7, 8, 9));
assertThat(itemsSorted.size(), is(3));
assertThat(itemsSorted, containsIdsInOrder(3, 2, 1));
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral
@Test
public void getItems() throws Exception {
// GIVEN WHEN
dataProvider.filterByCategory(PulseItemCategory.ALL_MESSAGES);
Query query = new Query<Message, Void>(0, 9, Collections.emptyList(), null, null);
List<Message> items = (List<Message>) dataProvider.fetchFromBackEnd(query).collect(Collectors.toList());
dataProvider.filterByCategory(PulseItemCategory.PROBLEM);
query = new Query<Message, Void>(0, 6, ImmutableList.of(new QuerySortOrder(MessageConstants.ID, SortDirection.DESCENDING)), null, null);
List<Message> itemsSorted = (List<Message>) dataProvider.fetchFromBackEnd(query).collect(Collectors.toList());
// THEN
assertThat(items.size(), is(9));
assertThat(items, containsIdsInOrder(1, 2, 3, 4, 5, 6, 7, 8, 9));
assertThat(itemsSorted.size(), is(6));
assertThat(itemsSorted, containsIdsInOrder(6, 5, 4, 3, 2, 1));
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral
@Test
public void getItemsWithGrouping() throws Exception {
// GIVEN
dataProvider.filterByCategory(PulseItemCategory.INFO);
dataProvider.setGrouping(true);
Query query = new Query<Message, Void>(0, 3, ImmutableList.of(new QuerySortOrder(MessageConstants.ID, SortDirection.ASCENDING)), null, null);
// WHEN
List<Message> items = (List<Message>) dataProvider.fetchFromBackEnd(query).collect(Collectors.toList());
// THEN no additional data for grouping
assertThat(items.size(), is(3));
assertThat(items, containsIdsInOrder(7, 8, 9));
}
}
代码示例来源:origin: jpos/jPOS-EE
private HorizontalLayout createFilters() {
HorizontalLayout controls = new HorizontalLayout();
controls.setWidth("100%");
journals = new JournalsCombo(true);
journals.setValue(journals.getDataProvider().fetch(new Query<>()).findFirst().orElse(null));
controls.addComponents(journals, dateRangeComponent);
controls.setComponentAlignment(dateRangeComponent, Alignment.MIDDLE_LEFT);
controls.setComponentAlignment(journals, Alignment.MIDDLE_RIGHT);
controls.setExpandRatio(journals, 0f);
controls.setExpandRatio(dateRangeComponent, 1f);
controls.setMargin(new MarginInfo(false,true,true,true));
controls.setSpacing(true);
return controls;
}
代码示例来源:origin: jpos/jPOS-EE
@Override
public void setGridGetters() {
Grid<Consumer> g = getGrid();
g.addColumn(Consumer::getId).setId("id");
g.addColumn(consumer -> consumer.getRolesAsString()).setId("roles");
g.addColumn(Consumer::getStartDate).setId("startDate");
g.addColumn(Consumer::getEndDate).setId("endDate");
g.addColumn(consumer -> consumer.getUser().getNickAndId()).setId("user");
g.addColumn(Consumer::isActive).setId("active");
g.addColumn(Consumer::isDeleted).setId("deleted");
//select first item on user combobox
userComboBox.setValue(userComboBox.getDataProvider().fetch(new Query<>()).findFirst().orElse(null));
}
内容来源于网络,如有侵权,请联系作者删除!