PDA

View Full Version : [CLOSED] AccordionLayout and HBoxLayout



Jerome C.
11 Dec 2009, 1:08 AM
Hello,

I can't find a solution to add HBoxLayout panels in an accordion. The size of these panels is not good.

I think it's a bug.

Example:



// create the accordion layout
AccordionLayout layout = new AccordionLayout();

// create root element
LayoutContainer root = new LayoutContainer();
root.setLayout(layout);

// add the root to the current panel
add(root);

// create two sections in this accordion
final ContentPanel toBuy = new ContentPanel();
final ContentPanel owned = new ContentPanel();

// add it to accordion panel
root.add(toBuy);
root.add(owned);

// make the second active
layout.setActiveItem(owned);

// create a new item with HBoxLayout
LayoutContainer item = new LayoutContainer(new HBoxLayout());

// make the first element flex
HBoxLayoutData layoutDatas = new HBoxLayoutData();
layoutDatas.setFlex(1);

// add two texts
item.add(new Text("test"), layoutDatas);
item.add(new Text("anotherItem"));

// create a new item with HBoxLayout
LayoutContainer item1 = new LayoutContainer(new HBoxLayout());

// make the first element flex
HBoxLayoutData layoutDatas1 = new HBoxLayoutData();
layoutDatas1.setFlex(1);

// add two texts
item1.add(new Text("test"), layoutDatas1);
item1.add(new Text("anotherItem"));

// add this item in toBuy panel
toBuy.add(item);
toBuy.add(item1);

// do the same for owned panel
// create a new item with HBoxLayout
LayoutContainer item2 = new LayoutContainer(new HBoxLayout());

// make the first element flex
HBoxLayoutData layoutDatas2 = new HBoxLayoutData();
layoutDatas2.setFlex(1);

// add two texts
item2.add(new Text("test"), layoutDatas);
item2.add(new Text("anotherItem"));

// add this item in toBuy panel
owned.add(item2);

// layout the root
layout();
when I do it, I can't see the second text "anotherItem". If I use the "Inspect element" in hosted mode, I can see the flex element "test" has a big width, so the anotherItem can't be see.

How can I achieve to have an accordion and a succession of HBoxLayout on its panels ?

thanks

Jerome C.
17 Dec 2009, 7:41 AM
Anyone here to help me ?

thanks

darrellmeyer
30 Mar 2010, 5:12 PM
HBoxLayout is only in GXT 2.0. If you are still having issues please submit a post in the 2.0 forums.