PDA

View Full Version : [FIXED] Bug in AbsoluteLayout?



moldoe
17 Jul 2009, 12:41 PM
This used to work fine in 1.2.4.

Since 2.0 repositioning a Component in a Container with AbosluteLayout doesn't work anymore in all the cases. Take a look at my test code. If I'd remove the intermediate LayoutContainer everything would work fine. But in my application I can not do it because I need different layout for my ContentPane.

I'm using latest revision 1641 from the releases/2.0 branch.
Windows XP
IE7, FF3.0, Hosted Mode



public class Test implements EntryPoint {


public void onModuleLoad() {

Viewport viewport = new Viewport();

final ContentPanel contentPanel = new ContentPanel();
contentPanel.setLayout(new FitLayout());

final LayoutContainer container = new LayoutContainer(new AbsoluteLayout());
contentPanel.add(container);


final Html html = new Html("<div style='border: 1px solid red;'>test</div>");
container.add(html, new AbsoluteData(100, 100));

contentPanel.addButton(new Button("Move", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
container.setLayoutData(html, new AbsoluteData(200, 200));
container.layout();
}
}));


contentPanel.setFrame(true);
contentPanel.setSize(400, 400);
viewport.add(contentPanel);

RootPanel.get().add(viewport);

}
}

sven
17 Jul 2009, 12:44 PM
Yes, you are right. We added a cache to not call layout when it is not needed. However you just spotted a point were we have to let it through. As workaround you can call
container.layout(true);

moldoe
17 Jul 2009, 12:48 PM
Thanks for the quick reply! :)

sven
18 Jul 2009, 1:48 AM
Fixed in SVN.