diff --git a/src/test/java/com/flowingcode/vaadin/addons/twincolgrid/FilterableDemo.java b/src/test/java/com/flowingcode/vaadin/addons/twincolgrid/FilterableDemo.java index ee7c8fb..6b62728 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/twincolgrid/FilterableDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/twincolgrid/FilterableDemo.java @@ -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; @@ -31,6 +32,7 @@ @SuppressWarnings("serial") @PageTitle("Filterable") +@DemoSource @Route(value = "twincolgrid/filterable", layout = TwincolDemoView.class) public class FilterableDemo extends VerticalLayout { diff --git a/src/test/java/com/flowingcode/vaadin/addons/twincolgrid/LazyFilterableDemo.java b/src/test/java/com/flowingcode/vaadin/addons/twincolgrid/LazyFilterableDemo.java index 0bbeb0d..7b863b7 100644 --- a/src/test/java/com/flowingcode/vaadin/addons/twincolgrid/LazyFilterableDemo.java +++ b/src/test/java/com/flowingcode/vaadin/addons/twincolgrid/LazyFilterableDemo.java @@ -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; @@ -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 availableDataProvider = + DataProvider 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 availableGrid = new Grid<>(); availableGrid.setDataProvider(availableDataProvider); Grid selectionGrid = new Grid<>(); - BookFilter bookFilter = new BookFilter(); final TwinColGrid twinColGrid = new TwinColGrid<>(availableGrid, selectionGrid)