Hi,
I am very new to Vaadin 7 and facing issues in layout positioning.
I am trying to create a page which has 3 parts.
1.header
2.MainBody
3.footer
The MainBody is contained in a panel and is dynamic and keeps increasing or descreasing in height. This should create a scrollbar on the panel and not have browser level scrollbars. However, I am unable to achieve this.
public class MainComponent extends VerticalLayout {
public class MainComponent extends VerticalLayout {
public MainComponent(UI ui)
{
//Header
VerticalLayout headerLayout = new VerticalLayout();
MenuBar menu = new MenuBar();
menu.setWidth(“100%”);
headerLayout.addComponent(menu);
headerLayout.addComponent(new Button(“Logout”));
//MainContent
bodyContent = new Panel();
ExampleNavigator bodyLayout = new ExampleNavigator(bodyContent); // addds the different view to the navigator.
//Footer
HorizontalLayout footerLayout = new HorizontalLayout();
footerLayout.setSizeFull();
footerLayout.addComponents(new Label("Example"));
// Add all to a layout
mainLayout = new VerticalLayout(headerLayout, bodyLayout, footerLayout);
mainLayout.setSpacing(true);
mainLayout.setMargin(true);
mainLayout.setComponentAlignment(headerLayout, Alignment.TOP_CENTER);
mainLayout.setComponentAlignment(footerLayout, Alignment.BOTTOM_CENTER);
mainLayout.setComponentAlignment(bodyLayout, Alignment.MIDDLE_CENTER);
mainLayout.setExpandRatio(headerLayout, 0.1f);
mainLayout.setExpandRatio(bodyLayout, 0.8f);
mainLayout.setExpandRatio(footerLayout, 0.1f);
mainLayout.setSizeFull();
// The view root layout
root = new VerticalLayout(mainLayout);
root.setSizeFull();
addComponent(root);
}
}
Problem:
The footer is kind of floating with the above code.
If I set the Vlayout height to 100%, the footer overlays the mainbody when the size increases.
Kindly let me know what am I missing here?