PDA

View Full Version : [CLOSED] Layout Bug



joshb
24 Jun 2009, 7:53 AM
Hi I believe this is also a bug on layout.

I have two Layout Containers. The second one is added into the first.

Both have 'flow' layout.
I add the second to the first, with margins(20), expecting the second(blue) to have a 20px padding around it in the first (grey) container. The left side is indeed padded 20px, but the top is not padded, and instead, the first container is now padded 20px from its proper location!

Using GXT2 (SVN) and tested in hosted mode Mac, as well as FF


public class T1 implements EntryPoint {

public void onModuleLoad() {



Window window = new Window();
window.setSize(500,500);

TestLayout tpt = new TestLayout();
window.setLayout( new FitLayout() );
window.add(tpt);
window.show();
}

public class TestLayout extends ContentPanel {

public TestLayout() {

LayoutContainer c = new LayoutContainer();
c.setStyleAttribute("backgroundColor", "#eeeeee" );
c.setSize(400,400);
add( c );

LayoutContainer c2 = new LayoutContainer();
c2.setStyleAttribute("backgroundColor", "#336699");
c2.setSize(200,200);
c.add( c2, new FlowData(20) );

}
}
}

sven
24 Jun 2009, 8:05 AM
This is not an issue in GXT. It is a limitation by the browsers. Modify your code to the following and you get your desired result:



public TestLayout() {

LayoutContainer c = new LayoutContainer();
c.setStyleAttribute("backgroundColor", "#eeeeee" );
c.setStyleAttribute("padding", "20px");
c.setSize(400,400);


LayoutContainer c2 = new LayoutContainer();
c2.setStyleAttribute("backgroundColor", "#336699");
c2.setSize(200,200);
c.add( c2);


add( c );

}