PDA

View Full Version : [FNR] BorderLayout expand does not close popup



quodroc
22 Jun 2011, 8:07 AM
Expanding a BorderLayout region while the popup panel is open results in some odd behaviour.
The widget gets moved from the popup to the panel, but the empty popup stays open until you make another click.

Demonstration:

final BorderLayout layout = new BorderLayout();
Dialog dialog = new Dialog();
dialog.setSize(800, 600);
dialog.setLayout(layout);

BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST);
data.setCollapsible(true);

Button button = new Button("Expand");
button.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(final ButtonEvent ce) {
layout.expand(LayoutRegion.WEST);
}
});

ContentPanel panel = new ContentPanel();
panel.add(button);
dialog.add(panel, data);
dialog.show();
layout.collapse(LayoutRegion.WEST);

I was able to come up with a simple workaround.

layout.addListener(Events.BeforeExpand, new Listener<BorderLayoutEvent>() {
@Override
public void handleEvent(final BorderLayoutEvent be) {
final CollapsePanel cp = be.getPanel().getData("collapse");
if (cp != null)
cp.setExpanded(false);
}
});

sven
23 Jun 2011, 4:24 AM
Fixed in SVN as of revision 2404