Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Composing Layouts with components with specific dimension
I'm new to Vaadin and having some trouble with the layouts. I read all I could before come here to ask, but I couldn't find any answer.
Considering the layout presented in the attached image, I would like to know which properties must be set in order that the page layout just in the image.
The red lines corresponds to a horizontal layout, the blue ones vertical and finally the components/panels delimited by the green.
I wish they could have the specific width and height set in their properties when had been defined, but I probably may doing it in order and/or setting properties that shouldn't be set.
Here's some one of my attempts to do what want to, but all of them and other combinations never seemed to work. I think I should have used the property, but I just can't understand its usage too.
If this approach seems too clumsy or is not ideal according to Vaadin standards, please, let me know :)
Panel panel1 = new Panel();
panel1.setContent(new Label("PANEL 1"));
Panel panel2 = new Panel();
panel2.setContent(new Label("PANEL 2"));
Panel alerts = new Panel();
panel4.setContent(new Label("PANEL 4"));
Panel panel3= new Panel();
panel3.setContent(new Label("PANEL 3"));
VerticalLayout verticalLayout = new VerticalLayout();
HorizontalLayout horizontalLayout = new HorizontalLayout();
VerticalLayout root = new VerticalLayout();
Thank you very much,
You should probably use Layout (Vertical or Horizontal) instead of Panel if you do not need captions nor icons (see panels advantages on https://vaadin.com/book/-/page/layout.panel.html and Jouni answer on http://stackoverflow.com/questions/5592389/in-vaadin-what-are-the-advantages-of-using-a-panel-over-a-verticalcontainer)
If you wish to get the panel1 as some kind of fixed menu, its size (height) will not change, so you can set it as pixels, and then you can use setExpandRatio for the red-lined zone for it to get the remaining space.
You could also take a look at Vaadin Designer, let it do the job for you ;-)
Victor, don't set widths for panels. Your all panels are full size.
verticlaLayoutSmall.addComponent(panel3); verticlaLayoutSmall.addComponent(panel4); horizontalLayout.addComponent(panel2); horizontalLayout.addComponent(verticlaLayoutSmall); verticlaLayout.addComponent(panel1); verticalLayout.addComponent(horizontalLayout); verticalLayout.setComponentExpandRatio(horizontalLayout, 1);