PDA

View Full Version : Collapsing Panel Height Bug



Ltty
24 Nov 2011, 8:06 AM
I'm not sure whether it's a configuration error or a bug, but I get weird collapsing behaviour of panels although I stick to the tutorial source code. Here is my source code:



mainLayout = new LayoutContainer(new BorderLayout());mainLayout.setStyleAttribute("backgroundColor", "red");


ContentPanel centerPanel = new ContentPanel(new FitLayout());
centerPanel.setBorders(false);
centerPanel.setHeaderVisible(false);
centerPanel.setBodyBorder(false);

ContentPanel westPanel = new ContentPanel(new RowLayout(Orientation.VERTICAL));
westPanel.setHeading("Menu");
westPanel.setBorders(false);
westPanel.setBodyBorder(false);
westPanel.setFrame(true);
westPanel.setHeight((int) (Window.getClientHeight() * 0.7));
westPanel.add(new SideNavigationViewImpl());

LayoutContainer north = new LayoutContainer();

filterPanel = new ContentPanel(new FitLayout());
filterPanel.setCollapsible(true);
filterPanel.setHeight(200);
filterPanel.setHeading("Dashboard");


portalPanel = new ContentPanel(new FitLayout());
portalPanel.setBorders(false);
portalPanel.setBodyBorder(false);
portalPanel.setHeaderVisible(false);
portalPanel.setAutoHeight(true);

portal = new Portal(PORTLET_SIZE);
portal.setColumnWidth(0, .5);
portal.setColumnWidth(1, .5);
portal.setBorders(false);
portal.setStyleAttribute("backgroundColor", "white");
portal.setAutoHeight(true);
portalPanel.add(portal);

centerPanel.add(filterPanel);
centerPanel.add(portalPanel);

BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 100);


BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 300);
westData.setMargins(new Margins(5, 5, 5, 50));
westData.setCollapsible(true);


BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
centerData.setMargins(new Margins(5, 50, 5, 5));


mainLayout.add(north, northData);
mainLayout.add(westPanel, westData);
mainLayout.add(centerPanel, centerData);
mainLayout.setAutoHeight(true);
main.add(mainLayout);

However, whenever I collapse the menu panel, the size of the panel is reduced to zero, which according to the demo cannot be right. Moreover, whenever I resize the browser, the collapsible panel in the north grows and does not keep its size, even if I fix the height to 200px for example. Please check out the screen shots. The common.jpg shows the layout as it should be. If I click on the collapse button of the menu it looks like the collapsed.jpg. Maybe you can tell me how to solve this.