Time for action – the main layout
Let's start by coding the main layout using our well known friend VerticalLayout
and the new guy HorizontalLayout
:
Create a new Vaadin project. For this example, we will use layout-framework as project name and
LayoutFrameworkUI
as the UI class.Create a new Java class
MainLayout
.Let
MainLayout
extendVerticalLayout
:public class MainLayout extends VerticalLayout { }
Add layouts for upper and lower sections of
MainLayout
:public class MainLayout extends VerticalLayout { private VerticalLayout upperSection = new VerticalLayout(); private HorizontalLayout lowerSection = new HorizontalLayout(); private VerticalLayout menuLayout = new VerticalLayout(); private VerticalLayout contentLayout = new VerticalLayout(); }
Add the following default constructor for
MainLayout
:public MainLayout() { upperSection.addComponent(new Label("Header")); menuSection.addComponent(new Label("Menu")); contentSection.addComponent(new Label("Content")); lowerSection...