Ejemplo n.º 1
0
  @SuppressWarnings("serial")
  @Override
  public void init(VaadinRequest request) {
    GridLayout layout = new GridLayout();
    layout.setSizeFull();
    layout.setMargin(true);
    setContent(layout);

    handleURLParams(request.getParameterMap());

    initContent();
  }
Ejemplo n.º 2
0
  @Override
  protected void init(VaadinRequest request) {
    // setContent(new But-ton("Click me", e -> Notification.show("Hello
    // Spring+Vaadin user!")));

    System.out.println(request);
    String page = request.getParameter("page");
    String size = request.getParameter("size");
    Map<String, String[]> m = request.getParameterMap();
    for (Map.Entry<String, String[]> e : m.entrySet()) {
      System.out.println(e.getKey());
      for (String s : e.getValue()) {
        System.out.println(s);
      }
    }

    VerticalLayout actions = new VerticalLayout(addNewBtn, grid);
    HorizontalLayout mainLayout = new HorizontalLayout(actions, editor);

    // actions.setSpacing(true);
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    setContent(mainLayout);

    // setContent(grid);

    // Connect selected Customer to editor or hide if none is selected
    grid.addSelectionListener(
        e -> {
          if (e.getSelected().isEmpty()) {
            editor.setVisible(false);
          } else {
            editor.editTask((Task) e.getSelected().iterator().next());
          }
        });

    // Instantiate and edit new Customer the new button is clicked
    addNewBtn.addClickListener(e -> editor.editTask(new Task()));

    // Listen changes made by the editor, refresh data from backend
    editor.setChangeHandler(
        () -> {
          editor.setVisible(false);
          listTasks();
        });

    // Initialize listing
    listTasks();
  }