Skip to content

Commit

Permalink
fix: add missing annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
flang committed Mar 7, 2023
1 parent c09855a commit e3427b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package com.flowingcode.vaadin.addons.twincolgrid;

import com.flowingcode.vaadin.addons.demo.DemoSource;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
Expand All @@ -31,6 +32,7 @@

@SuppressWarnings("serial")
@PageTitle("Filterable")
@DemoSource
@Route(value = "twincolgrid/filterable", layout = TwincolDemoView.class)
public class FilterableDemo extends VerticalLayout {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package com.flowingcode.vaadin.addons.twincolgrid;

import com.flowingcode.vaadin.addons.demo.DemoSource;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.notification.Notification;
Expand All @@ -38,28 +39,28 @@

@SuppressWarnings("serial")
@PageTitle("Lazy Filterable")
@DemoSource
@Route(value = "twincolgrid/lazyfilterable", layout = TwincolDemoView.class)
public class LazyFilterableDemo extends VerticalLayout {

public LazyFilterableDemo() {
BookService bookService = new BookService();
BookFilter bookFilter = new BookFilter();

DataProvider<Book, BookFilter> availableDataProvider =
DataProvider<Book, Void> availableDataProvider =
DataProvider.fromFilteringCallbacks(
query -> {
BookFilter filter = query.getFilter().orElseGet(BookFilter::new);
filter.setSorting(query.getSortOrders().stream()
bookFilter.setSorting(query.getSortOrders().stream()
.map(q -> new SortOrder<>(q.getSorted(), q.getDirection()))
.collect(Collectors.toList()));
return bookService.fetch(query.getOffset(), query.getLimit(), filter);
return bookService.fetch(query.getOffset(), query.getLimit(), bookFilter);
},
query -> bookService.count(query.getFilter().orElseGet(BookFilter::new)));
query -> bookService.count(bookFilter));

Grid<Book> availableGrid = new Grid<>();
availableGrid.setDataProvider(availableDataProvider);

Grid<Book> selectionGrid = new Grid<>();
BookFilter bookFilter = new BookFilter();

final TwinColGrid<Book> twinColGrid =
new TwinColGrid<>(availableGrid, selectionGrid)
Expand Down

0 comments on commit e3427b2

Please sign in to comment.