PDA

View Full Version : TabPanel Layout Problems


jtmille3
06-25-2008, 10:38 AM
I've got a problem where I've got a Table inside a TabPanel that isn't being fit to the full length of the TabItem. I've tried everything. Here's a code snippet that I think should work.


public class TabPanelExample extends Viewport implements EntryPoint {

public void onModuleLoad() {
setLayout(new FitLayout());

ContentPanel cp = new ContentPanel();
cp.setFrame(true);
cp.setHeading("Test FitLayout Inside TabItem");

TabItem item = new TabItem("Tab 1");
item.add(cp, new FitLayout());

TabPanel tabPanel = new TabPanel();
tabPanel.add(item);
tabPanel.setData(new RowData(1, 1));

LayoutContainer lc = new LayoutContainer();
lc.setLayout(new RowLayout(Orientation.VERTICAL));
lc.add(tabPanel);

add(lc);

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

}


If you run this, you can see that the content panel is not fit to the tab item. The same problem is occurring for the Table widget. I can set the height of the content panel to 100% but if the tab panel is resized then the item is not resized. Any help would be appreciated.

jtmille3
06-25-2008, 11:36 AM
In hind sight it wasn't to difficult a fix. I was assuming TabItem.add(widget, layout) would fit the object to the container. I had to actually set the layout of the tab item for this to happen. Problem solved.

TabItem.setLayout(new FitLayout());