// Path: flow-bookstore/bookstore-ui/src/main/java/com/github/mcollovati/vertxvaadin/flowdemo/about/AboutView.java
// @Route(value = "About", layout = MainLayout.class)
// @PageTitle("About")
// public class AboutView extends VerticalLayout {
// 
//     public static final String VIEW_NAME = "About";
// 
//     public AboutView() {
//         add(new HorizontalLayout(
//             VaadinIcon.INFO_CIRCLE.create(),
//             new Span(" This application is using Vaadin Flow " + Version.getFullVersion())
//         ));
//         add(new Span("running on top of Vert.x " + VersionCommand.getVersion()));
//         add(new Span("using Vertx-Vaadin-Flow " + VertxVaadin.getVersion()));
// 
//         add(buildLink("http://vaadin.com/", "Vaadin web page"));
//         add(buildLink("http://vertx.io/", "Vert.x web page"));
//         add(buildLink("https://github.com/mcollovati/vertx-vaadin", "Vertx-Vaadin web page"));
// 
// 
//         setSizeFull();
//         setJustifyContentMode(JustifyContentMode.CENTER);
//         setAlignItems(Alignment.CENTER);
//     }
// 
//     private Anchor buildLink(String href, String text) {
//         Anchor anchor = new Anchor(href, text);
//         anchor.setTarget("_blank");
//         return anchor;
//     }
// 
// }
// 
// Path: flow-bookstore/bookstore-ui/src/main/java/com/github/mcollovati/vertxvaadin/flowdemo/crud/SampleCrudView.java
// @Route(value = "Inventory", layout = MainLayout.class)
// @RouteAlias(value = "", layout = MainLayout.class)
// public class SampleCrudView extends HorizontalLayout
//         implements HasUrlParameter<String> {
// 
//     public static final String VIEW_NAME = "Inventory";
//     private ProductGrid grid;
//     private ProductForm form;
//     private TextField filter;
// 
//     private SampleCrudLogic viewLogic = new SampleCrudLogic(this);
//     private Button newProduct;
// 
//     private ProductDataProvider dataProvider = new ProductDataProvider();
// 
//     public SampleCrudView() {
//         setSizeFull();
//         HorizontalLayout topLayout = createTopBar();
// 
//         grid = new ProductGrid();
//         grid.setDataProvider(dataProvider);
//         grid.asSingleSelect().addValueChangeListener(
//                 event -> viewLogic.rowSelected(event.getValue()));
// 
//         form = new ProductForm(viewLogic);
//         form.setCategories(DataService.get().getAllCategories());
// 
//         VerticalLayout barAndGridLayout = new VerticalLayout();
//         barAndGridLayout.add(topLayout);
//         barAndGridLayout.add(grid);
//         barAndGridLayout.setFlexGrow(1, grid);
//         barAndGridLayout.setFlexGrow(0, topLayout);
//         barAndGridLayout.setSizeFull();
//         barAndGridLayout.expand(grid);
// 
//         add(barAndGridLayout);
//         add(form);
// 
//         viewLogic.init();
//     }
// 
//     public HorizontalLayout createTopBar() {
//         filter = new TextField();
//         filter.setPlaceholder("Filter name, availability or category");
//         // Apply the filter to grid's data provider. TextField value is never null
//         filter.addValueChangeListener(event -> dataProvider.setFilter(event.getValue()));
// 
//         newProduct = new Button("New product");
//         newProduct.getElement().getThemeList().add("primary");
//         newProduct.setIcon(VaadinIcon.PLUS_CIRCLE.create());
//         newProduct.addClickListener(click -> viewLogic.newProduct());
// 
//         HorizontalLayout topLayout = new HorizontalLayout();
//         topLayout.setWidth("100%");
//         topLayout.add(filter);
//         topLayout.add(newProduct);
//         topLayout.setVerticalComponentAlignment(Alignment.START, filter);
//         topLayout.expand(filter);
//         return topLayout;
//     }
// 
//     public void showError(String msg) {
//         Notification.show(msg);
//     }
// 
//     public void showSaveNotification(String msg) {
//         Notification.show(msg);
//     }
// 
//     public void setNewProductEnabled(boolean enabled) {
//         newProduct.setEnabled(enabled);
//     }
// 
//     public void clearSelection() {
//         grid.getSelectionModel().deselectAll();
//     }
// 
//     public void selectRow(Product row) {
//         grid.getSelectionModel().select(row);
//     }
// 
//     public Product getSelectedRow() {
//         return grid.getSelectedRow();
//     }
// 
//     public void updateProduct(Product product) {
//         dataProvider.save(product);
//     }
// 
//     public void removeProduct(Product product) {
//         dataProvider.delete(product);
//     }
// 
//     public void editProduct(Product product) {
//         showForm(product != null);
//         form.editProduct(product);
//     }
// 
//     public void showForm(boolean show) {
//         form.setVisible(show);
//         form.getElement().setEnabled(show);
//     }
// 
//     @Override
//     public void setParameter(BeforeEvent event,
//                              @OptionalParameter String parameter) {
//         viewLogic.enter(parameter);
//     }
// }


import com.vaadin.flow.component.dependency.StyleSheet;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.FlexLayout;
import com.vaadin.flow.router.RouterLayout;
import com.vaadin.flow.theme.Theme;
import com.vaadin.flow.theme.lumo.Lumo;
import com.github.mcollovati.vertxvaadin.flowdemo.about.AboutView;
import com.github.mcollovati.vertxvaadin.flowdemo.crud.SampleCrudView;
package com.github.mcollovati.vertxvaadin.flowdemo;

//import com.vaadin.flow.server.PWA;

/**
 * The layout of the pages e.g. About and Inventory.
 */
@StyleSheet("css/shared-styles.css")
@Theme(value = Lumo.class, variant = Lumo.DARK)
public class MainLayout extends FlexLayout implements RouterLayout {
    private Menu menu;

// Path: flow-bookstore/bookstore-ui/src/main/java/com/github/mcollovati/vertxvaadin/flowdemo/about/AboutView.java
// @Route(value = "About", layout = MainLayout.class)
// @PageTitle("About")
// public class AboutView extends VerticalLayout {
// 
//     public static final String VIEW_NAME = "About";
// 
//     public AboutView() {
//         add(new HorizontalLayout(
//             VaadinIcon.INFO_CIRCLE.create(),
//             new Span(" This application is using Vaadin Flow " + Version.getFullVersion())
//         ));
//         add(new Span("running on top of Vert.x " + VersionCommand.getVersion()));
//         add(new Span("using Vertx-Vaadin-Flow " + VertxVaadin.getVersion()));
// 
//         add(buildLink("http://vaadin.com/", "Vaadin web page"));
//         add(buildLink("http://vertx.io/", "Vert.x web page"));
//         add(buildLink("https://github.com/mcollovati/vertx-vaadin", "Vertx-Vaadin web page"));
// 
// 
//         setSizeFull();
//         setJustifyContentMode(JustifyContentMode.CENTER);
//         setAlignItems(Alignment.CENTER);
//     }
// 
//     private Anchor buildLink(String href, String text) {
//         Anchor anchor = new Anchor(href, text);
//         anchor.setTarget("_blank");
//         return anchor;
//     }
// 
// }
// 
// Path: flow-bookstore/bookstore-ui/src/main/java/com/github/mcollovati/vertxvaadin/flowdemo/crud/SampleCrudView.java
// @Route(value = "Inventory", layout = MainLayout.class)
// @RouteAlias(value = "", layout = MainLayout.class)
// public class SampleCrudView extends HorizontalLayout
//         implements HasUrlParameter<String> {
// 
//     public static final String VIEW_NAME = "Inventory";
//     private ProductGrid grid;
//     private ProductForm form;
//     private TextField filter;
// 
//     private SampleCrudLogic viewLogic = new SampleCrudLogic(this);
//     private Button newProduct;
// 
//     private ProductDataProvider dataProvider = new ProductDataProvider();
// 
//     public SampleCrudView() {
//         setSizeFull();
//         HorizontalLayout topLayout = createTopBar();
// 
//         grid = new ProductGrid();
//         grid.setDataProvider(dataProvider);
//         grid.asSingleSelect().addValueChangeListener(
//                 event -> viewLogic.rowSelected(event.getValue()));
// 
//         form = new ProductForm(viewLogic);
//         form.setCategories(DataService.get().getAllCategories());
// 
//         VerticalLayout barAndGridLayout = new VerticalLayout();
//         barAndGridLayout.add(topLayout);
//         barAndGridLayout.add(grid);
//         barAndGridLayout.setFlexGrow(1, grid);
//         barAndGridLayout.setFlexGrow(0, topLayout);
//         barAndGridLayout.setSizeFull();
//         barAndGridLayout.expand(grid);
// 
//         add(barAndGridLayout);
//         add(form);
// 
//         viewLogic.init();
//     }
// 
//     public HorizontalLayout createTopBar() {
//         filter = new TextField();
//         filter.setPlaceholder("Filter name, availability or category");
//         // Apply the filter to grid's data provider. TextField value is never null
//         filter.addValueChangeListener(event -> dataProvider.setFilter(event.getValue()));
// 
//         newProduct = new Button("New product");
//         newProduct.getElement().getThemeList().add("primary");
//         newProduct.setIcon(VaadinIcon.PLUS_CIRCLE.create());
//         newProduct.addClickListener(click -> viewLogic.newProduct());
// 
//         HorizontalLayout topLayout = new HorizontalLayout();
//         topLayout.setWidth("100%");
//         topLayout.add(filter);
//         topLayout.add(newProduct);
//         topLayout.setVerticalComponentAlignment(Alignment.START, filter);
//         topLayout.expand(filter);
//         return topLayout;
//     }
// 
//     public void showError(String msg) {
//         Notification.show(msg);
//     }
// 
//     public void showSaveNotification(String msg) {
//         Notification.show(msg);
//     }
// 
//     public void setNewProductEnabled(boolean enabled) {
//         newProduct.setEnabled(enabled);
//     }
// 
//     public void clearSelection() {
//         grid.getSelectionModel().deselectAll();
//     }
// 
//     public void selectRow(Product row) {
//         grid.getSelectionModel().select(row);
//     }
// 
//     public Product getSelectedRow() {
//         return grid.getSelectedRow();
//     }
// 
//     public void updateProduct(Product product) {
//         dataProvider.save(product);
//     }
// 
//     public void removeProduct(Product product) {
//         dataProvider.delete(product);
//     }
// 
//     public void editProduct(Product product) {
//         showForm(product != null);
//         form.editProduct(product);
//     }
// 
//     public void showForm(boolean show) {
//         form.setVisible(show);
//         form.getElement().setEnabled(show);
//     }
// 
//     @Override
//     public void setParameter(BeforeEvent event,
//                              @OptionalParameter String parameter) {
//         viewLogic.enter(parameter);
//     }
// }


// Path: flow-bookstore/bookstore-ui/src/main/java/com/github/mcollovati/vertxvaadin/flowdemo/MainLayout.java
import com.vaadin.flow.component.dependency.StyleSheet;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.FlexLayout;
import com.vaadin.flow.router.RouterLayout;
import com.vaadin.flow.theme.Theme;
import com.vaadin.flow.theme.lumo.Lumo;
import com.github.mcollovati.vertxvaadin.flowdemo.about.AboutView;
import com.github.mcollovati.vertxvaadin.flowdemo.crud.SampleCrudView;

package com.github.mcollovati.vertxvaadin.flowdemo;

//import com.vaadin.flow.server.PWA;

/**
 * The layout of the pages e.g. About and Inventory.
 */
@StyleSheet("css/shared-styles.css")
@Theme(value = Lumo.class, variant = Lumo.DARK)
public class MainLayout extends FlexLayout implements RouterLayout {
    private Menu menu;

    public MainLayout() {