PDA

View Full Version : [CLOSED [2.0 M1/M2/M3] RowLayout problem



Yukideluxe
25 Jun 2009, 6:06 AM
I don't know how to explain this problem but I'll do my best. I hope you understand me! hehe

- Detailed description of the problem:
I have a window with FitLayout setted. In this window I've attached a LayoutContainer which uses a RowLayout where I've added different LayoutContainers.
One container is added as RowData(1,1) and the other ones are added as RowData(1,-1).
One panel is not visible and I want to show it when the user clicks a button. (See example, please)

Here comes my problem, when I set visible this panel, the container added with RowData(1,1) does not resize properly. It didn't happen with 1.2.x!

In this example when I click to "Show blue panel" the button disappears and the panel is not viewed propertly. If I resize the window then I obtain what I want!! The three panels, the button and the red one with the proper size.

- GXT version: 2.0 M1/M2/M3
- Host mode / web mode / both: Both
- Browser and version: IE7, Firefox 3.0, Chrome, Safari, Opera
- Operating System: Windows
- Sample code:



public class Test implements EntryPoint {

private LayoutContainer three;

@Override
public void onModuleLoad() {

final Window window = new Window();
window.setLayout(new FitLayout());
window.setSize("500", "400");

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

LayoutContainer one = new LayoutContainer();
one.setHeight("100");
one.setStyleAttribute("background", "green");
main.add(one, new RowData(1,-1));

LayoutContainer two = new LayoutContainer();
two.setStyleAttribute("background", "red");
main.add(two, new RowData(1,1));

three = new LayoutContainer();
three.setHeight("100");
three.setVisible(false);
three.setStyleAttribute("background", "blue");
main.add(three, new RowData(1,-1));

Button b = new Button("Show Blue Panel", new SelectionListener<ButtonEvent>(){
@Override
public void componentSelected(ButtonEvent ce) {
three.setVisible(true);
}
});

main.add(b, new RowData(1,-1));

window.add(main);

ButtonBar buttons = new ButtonBar();
buttons.add(new Button("Show", new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
window.show();
}
}));

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

}

Thank you!

sven
25 Jun 2009, 6:10 AM
I am closing this issue. There is an issue in your code. After showing your panel you need to call for layout with the force attribute set to true:


main.layout(true);

Yukideluxe
25 Jun 2009, 6:24 AM
I thought that it was a problem because in the previous versions I didn't have to make this call. Thank you for the quick answer! :D

sven
25 Jun 2009, 6:26 AM
GXT2 has introduced several new caching mechanism to improve speed. GXT 1 just always called layout (which is good, but takes times, which is not good)