Vik
Vik

Reputation: 9289

automatic resize of the tab panel based on contents

Hello I have implemented something like

private VerticalPanel resultPanel;
private TabLayoutPanel tabPanel = new TabLayoutPanel(2.5, Unit.EM);
ResizeLayoutPanel resizePanel = new ResizeLayoutPanel();

myMethod(){
    resizePanel.setWidth("100%");
    resizePanel.setHeight("415px");
    resizePanel.setWidget(tabPanel);

    resultPanel = new VerticalPanel();
    resultPanel.setWidth("100%");
        resultPanel.add(resizePanel);



        tabPanel.add(myVerticalPanel, tabHeader);
}

so the myVerticalPanel is the actual contents which is little large in height. As resizePanel height is set to 415px so rest of the contents are hidden.

I am looking for two things to achieve: 1. If there is a larger screen available then increase the tabPanel area to show more contents automatically 2. If screen is small then a scroll to appear to see rest of the contents

Please advise

Upvotes: 1

Views: 1060

Answers (1)

Ümit
Ümit

Reputation: 17489

You can try to replace the TabLayoutPanel with a HeaderPanel:

A panel that includes a header (top), footer (bottom), and content (middle) area. The header and footer areas resize naturally. The content area is allocated all of the remaining space between the header and footer area.

Alternatively you can override the onResize() method your ResizeLayoutPanel calculate the height of your embedded content and set the appropriate height.

If you want scrolling functionality you have to embed your VerticalPanel in a ScrollPanel or use CSS to set the oferflow property.

Upvotes: 1

Related Questions