PDA

View Full Version : borderlayout north panel can't resize , there is a white space .



derek_lee
30 Mar 2009, 6:18 AM
hi
i create new window , and give it with borderlayout



but between north and center ,there is a space, i want remove it , but can't remore or resize .



my code is :

Window w = new Window();
w.setCloseAction(CloseAction.HIDE);
w.setIconStyle("gwtmail");
w.setMinimizable(true);
w.setMaximizable(true);
w.setHeading("GWT Mail ");
w.setSize(640, 480);
w.setLayout(new BorderLayout());

....................
private void createNorth(){
BorderLayoutData data = new BorderLayoutData(LayoutRegion.NORTH,66);
data.setMargins(new Margins(5,5,0,5));

north = new ContentPanel();
north.setBodyBorder(false);
north.setLayoutOnChange(true);
north.setHeaderVisible(false);
north.setLayout(new FitLayout());



window.add(north,data);
}


....................
Registry.register(NORTH_PANEL, north);
Registry.register(WEST_PANEL, west);
Registry.register(SOUTH_PANEL, south);
Registry.register(EAST_PANEL, east);
Registry.register(CENTER_PANEL, center);


...................

mainMenu = new PlatformMainMenu();

ContentPanel wapper = (ContentPanel) Registry.get(PlatformAppView.NORTH_PANEL);
wapper.removeAll();
wapper.add(mainMenu);
wapper.layout();

PlatformMainMenu class is :


import com.allen_sauer.gwt.log.client.Log;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.custom.ThemeSelector;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.extjs.gxt.ui.client.widget.toolbar.AdapterToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToggleToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
public class PlatformMainMenu extends ContentPanel {

private Menu subFileMenu;
private MenuItem newMenuItem;
private MenuItem exitMenuItem;
private Menu subHelpMenu;
private MenuItem help;
private MenuItem about;



public PlatformMainMenu(){

Log.info("Begin : init Platform Main Menu.");
setHeaderVisible(false);
setLayout(new FitLayout());

ContentPanel content = new ContentPanel();
content.setBodyBorder(false);
content.setHeaderVisible(false);
content.setLayout(new FlowLayout());

newMenuItem = new MenuItem("New");
exitMenuItem = new MenuItem("Exit");
subFileMenu = new Menu();
subFileMenu.add(newMenuItem);
subFileMenu.add(exitMenuItem);

help = new MenuItem("Help");
about = new MenuItem("About");
subHelpMenu = new Menu();
subHelpMenu.add(help);
subHelpMenu.add(about);

ToolBar menubar = new ToolBar();
menubar.setBorders(false);
TextToolItem fileItem = new TextToolItem("File");
fileItem.setMenu(subFileMenu);
menubar.add(fileItem);

TextToolItem helpItem = new TextToolItem("Help");
helpItem.setMenu(subHelpMenu);
menubar.add(helpItem);

content.setTopComponent(menubar);

ToolBar toolBar = new ToolBar();

TextToolItem item = new TextToolItem();
item.setIconStyle("icon-connect");
toolBar.add(item);

toolBar.add(new SeparatorToolItem());

item = new TextToolItem();
item.setIconStyle("icon-user-add");
toolBar.add(item);

item = new TextToolItem();
item.setIconStyle("icon-user-delete");
toolBar.add(item);

toolBar.add(new SeparatorToolItem());

ToggleToolItem toggle = new ToggleToolItem("Toggle");
toolBar.add(toggle);

toolBar.add(new SeparatorToolItem());

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

content.add(toolBar);

add(content);

Log.info("End : init Platform Main Menu.");

}


}

help me !

thank you very much!

sunshinerain
13 Apr 2009, 11:28 AM
I don't know if this helps, but I just spent several hours fighting something similar.
Finally, I put a blank ContentPanel in the region, stuck a FitLayout in it, and then
stuck my ContentPanel-derived Widget inside it. Now it works. When I put my
ContentPanel directly in the BorderLayout, I could not resize it.

micgala
14 Apr 2009, 6:27 AM
Not able to see why... You didn't post the code you use for adding the center panel...