PDA

View Full Version : It does not work.



taocore
24 Oct 2008, 10:57 PM
Environment:
java 1.6.0_07
gwt 1.5.3
ext-gwt 1.1.1

I just test the BorderLayout, the core part code is copy from your demo explorer.
I use eclipse, following your doc. I start hosted browser from eclipse.



package com.desktop.web.client;

import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class App implements EntryPoint
{

/**
* This is the entry point method.
*/
public void onModuleLoad()
{
Viewport view = new Viewport();
view.add(new BorderLayoutExample());
RootPanel.get().add(view);
}

public class BorderLayoutExample extends LayoutContainer {

public BorderLayoutExample() {
setLayout(new BorderLayout());

ContentPanel north = new ContentPanel();
north.setHeight(200);
ContentPanel west = new ContentPanel();
ContentPanel center = new ContentPanel();
center.setHeight(100);
ContentPanel east = new ContentPanel();
ContentPanel south = new ContentPanel();
south.setHeight(200);

BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 100);
northData.setCollapsible(true);
northData.setFloatable(true);
northData.setSplit(true);
northData.setMargins(new Margins(5, 5, 0, 5));

BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 200);
westData.setSplit(true);
westData.setCollapsible(true);
westData.setMargins(new Margins(5));

BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
centerData.setMargins(new Margins(5, 0, 5, 0));

BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 200);
eastData.setSplit(true);
eastData.setCollapsible(true);
eastData.setMargins(new Margins(5));

BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, 100);
southData.setSplit(true);
southData.setCollapsible(true);
southData.setFloatable(true);
southData.setMargins(new Margins(0, 5, 5, 5));

add(north, northData);
add(west, westData);
add(center, centerData);
add(east, eastData);
add(south, southData);
}
}
}



problems:

1. it is rendered, but not like the explorer demo
2. I compile it by pressing the compile/browse button on the hosted browser, then the page was open by my default browser firefox 3.0.3, but show nothing. I used ie to browse the page, the output is the same as the hosted browser.

Anything I lost?

gslender
24 Oct 2008, 11:16 PM
what does the contents of your html file look like?

taocore
26 Oct 2008, 4:54 PM
Now I have Viewport with BorderLayout as the child of the RootPanel, it seems works fine.

Is it some widget should not be added to some other widget?

More info would be appreciated.

gslender
26 Oct 2008, 5:00 PM
post the code as you have it now and I will check it for you... your problem is probably to do with layouts, so ensure each container has a layout that does what you want it to do (ie if you are relying on default flowlayout, ensure the child widgets are sizing themselves, if you don't want to do that, change the layout to one that sizes its children).