PDA

View Full Version : How to listen for Collapse/Expand events in a BorderLayout?



moldoe
14 Jul 2009, 9:59 AM
Hi all,

I can't find a consistent way to listen for Collapse/Expand events in BorderLayout.
BorderLayout class doesn't seem to expose such functionality.
Even if I try to use BeforeCollapse/BeforeExpand events on the ContentPanel that I'm adding to the BorderLayout that doesn't work completely because BeforeExpand is never fired.

Looking at the BorderLayout source code I find it strange that there is a collapseListener which is supposed to handle BeforeCollapse and BeforeExpand on the ContentPanels which are added to the layout, but like I told you BeforeExpand is never fired when you click on the expand button or on the CollapsePanel.

Is this a bug? Is there another way to do this?

Thanks,

Daniel

LordLuky
15 Jul 2009, 4:52 AM
Hi, Have you found inteligent solution?

I found this not int. one:


contentPanel.setCollapsible(false);

ToolButton tb = new ToolButton("xxx");
tb.addListener(Events.OnClick, new Listener<BaseEvent>() {
private boolean collapse = true;

public void handleEvent(BaseEvent be) {
if (collapse) {
contentPanel.collapse();
southData.setSize(100);
layout.layout();
colapse = !colapse;
} else {
contentPanel.expand();
southData.setSize(200);
layout.layout();
colapse = !colapse;
}
}
});
southPanel.getHeader().addTool(tb);


So I dont listen whet it collapse, but I collapse It :-)

moldoe
15 Jul 2009, 6:06 AM
Please, can anyone from Ext GWT team answer this?

Thanks