PDA

View Full Version : AccordionLayoutContainer selected panel needs resizing when selecting it



cgokey2
29 Jul 2015, 8:41 AM
I'm running into trouble with AccordionLayoutContainer with a particular ContentPanel's content that won't resize and fill the entire container when selected.

If the active Widget starts up with this panel, it is sized properly. But if not (and another panel is the first active Widget), then when a user selects, it won't properly resize and fill the entire container.

How can I capture the event when that Widget is selected and then call forceLayout() to get this thing to size properly?

I've been trying all kinds of different things, with no luck, so any help would be greatly appreciated. I have this setting, so this isn't it:

accordionContainer.setExpandMode( AccordionLayoutContainer.ExpandMode.SINGLE_FILL);

Chris

cgokey2
29 Jul 2015, 10:16 AM
Not entirely sure why, but assigning the widget to the content panel in the addExpandHandler(...) seems to do the trick.



mapsPanel.addExpandHandler(new ExpandEvent.ExpandHandler() {
public void onExpand(ExpandEvent expandEvent) {
GWT.log("Expanding!");
if (impl == null) {
impl = new MapViewImpl();

mapsPanel.setWidget(impl);
impl.initializeMap();
}
mapsPanel.forceLayout();
}
});