PDA

View Full Version : [CLOSED] programmatically expand does not work



sqtz
20 Jan 2011, 12:52 AM
Hi,

Expanding a region clicking on the tool button works fine but it does not work programmatically. (Collapse works both clicking and programmatically). I think this is a bug of GXT.

Tested with Ext GWT 2.2.1. Both Dev Mode and Compiled. All Browsers.

This is a test case for that :



public class ExpandCollapseTestCase implements EntryPoint {
private ContentPanel southPanel;

public void onModuleLoad() {
final Viewport viewport = new Viewport();
viewport.setLayout(new FitLayout());

LayoutContainer main = new LayoutContainer();
main.setLayout(new BorderLayout());

ContentPanel centerPanel = new ContentPanel();
centerPanel.setHeading("Center");

Button expandCollapseButton = new Button("Expand/Collapse");
expandCollapseButton
.addSelectionListener(new SelectionListener<ButtonEvent>() {

@Override
public void componentSelected(ButtonEvent ce) {
if (southPanel.isExpanded()) {
southPanel.collapse();
} else {
// expand does not works!
southPanel.expand();
}
}
});

centerPanel.add(expandCollapseButton);

BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);

main.add(centerPanel, centerData);

southPanel = new ContentPanel();
southPanel.setLayout(new FitLayout());
southPanel.setBorders(false);
southPanel.setHeading("South");

BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH);
southData.setSplit(true);
southData.setCollapsible(true);
southData.setSize(400);

main.add(southPanel, southData);

viewport.add(main);

RootPanel.get().add(viewport);
}
}


Please, help.

sven
20 Jan 2011, 11:00 AM
This is not a bug. You need to use the expand and collapse methods BorderLayout gives you. BorderLayout does not use a real expand/collapse

sqtz
20 Jan 2011, 11:51 PM
Silly of me. Thank you very much.