Book Image

Data-Centric Applications with Vaadin 8

By : Alejandro Duarte
Book Image

Data-Centric Applications with Vaadin 8

By: Alejandro Duarte

Overview of this book

Vaadin is an open-source Java framework used to build modern user interfaces. Vaadin 8 simplifies application development and improves user experience. The book begins with an overview of the architecture of Vaadin applications and the way you can organize your code in modules.Then it moves to the more advanced topics about advanced topics such as internationalization, authentication, authorization, and database connectivity. The book also teaches you how to implement CRUD views, how to generate printable reports, and how to manage data with lazy loading. By the end of this book you will be able to architect, implement, and deploy stunning Vaadin applications, and have the knowledge to master web development with Vaadin.
Table of Contents (11 chapters)

Implementing a CRUD using Grids and forms

In this section, we'll develop a CRUD user interface using modal pop-up windows to show a form for adding and editing User instances. The following is a screenshot of the finished form:

Let's start with the following component:

public class CustomCrud extends Composite {

private Button refresh = new Button("", VaadinIcons.REFRESH);
private Button add = new Button("", VaadinIcons.PLUS);
private Button edit = new Button("", VaadinIcons.PENCIL);

private Grid<User> grid = new Grid<>(User.class);

public CustomCrud() {
initLayout();
initBehavior();
refresh();
}

private void initLayout() {
CssLayout header = new CssLayout(refresh, add, edit);
header.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

grid.setSizeFull();

VerticalLayout...