PDA

View Full Version : [FIXED] RowLayout bug



gslender
31 May 2008, 2:47 AM
The rowlayout on this tab does not layout correctly for the borderlayout. When you collapse the south panel, it becomes hidden below the visible area. If you comment out the toolbar, all is shown correctly.


package com.mycompany.gxt.client;

import com.extjs.gxt.ui.client.Style.*;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.*;
import com.extjs.gxt.ui.client.widget.custom.ThemeSelector;
import com.extjs.gxt.ui.client.widget.layout.*;
import com.extjs.gxt.ui.client.widget.toolbar.*;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class BorderLayoutTest implements EntryPoint
{
public void onModuleLoad() {
Viewport v = new Viewport();
v.setLayout(new FillLayout());

TabPanel tp = new TabPanel();
tp.add(new TestTab());

v.add(tp);
v.layout();
RootPanel.get().add(v);
}

public class TestTab extends TabItem
{
public TestTab() {
super();
setText("Test");

setLayout(new RowLayout(Orientation.VERTICAL));

ToolBar toolBar = new ToolBar();
toolBar.add(new AdapterToolItem(new ThemeSelector()));
add(toolBar,new RowData(1,-1));

LayoutContainer lowercontainer = new LayoutContainer();
add(lowercontainer,new RowData(1,1));

lowercontainer.setLayout(new BorderLayout());

ContentPanel cp1 = new ContentPanel();
cp1.setHeading("Summary");
cp1.setLayout(new FillLayout());
BorderLayoutData bld = new BorderLayoutData(LayoutRegion.WEST,300);
bld.setMargins(new Margins(10,0,0,10));
lowercontainer.add(cp1,bld);

ContentPanel cp2 = new ContentPanel();
cp2.setHeading("Details");
cp2.setLayout(new FillLayout());
bld = new BorderLayoutData(LayoutRegion.CENTER);
bld.setMargins(new Margins(10,10,0,10));
lowercontainer.add(cp2,bld);

ContentPanel cp3 = new ContentPanel();
cp3.setHeading("Overview");
bld = new BorderLayoutData(LayoutRegion.SOUTH,200);
bld.setMargins(new Margins(10,10,10,10));
bld.setCollapsible(true);
lowercontainer.add(cp3,bld);
}
}
}

gslender
31 May 2008, 8:05 PM
This snippet now causes a NPE with the current build 353 and GWT 1.5 RC1

Commenting out the toolitem prevents the NPE, but the render is still wrong.


// toolBar.add(new AdapterToolItem(new ThemeSelector()));