From fdc6a7e1ded57eff219c5d4037a4458148b235d0 Mon Sep 17 00:00:00 2001 From: Felipe Lang Date: Tue, 7 Mar 2023 12:49:44 -0300 Subject: [PATCH] fix: add missing annotations --- .../vaadin/addons/twincolgrid/FilterableDemo.java | 2 ++ .../addons/twincolgrid/LazyFilterableDemo.java | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) 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)