PDA

View Full Version : Explorer demo



edumrf
23 Mar 2012, 5:52 AM
Hi there,I copied the explorer sample code to a new project, but in my project its showing a white space on the top and left margins, as you can see on the picture below. 33067Did i do something wrong?
public class AppView { public static final String CENTER_PANEL = "centerPanel"; public static final String WEST_PANEL = "westPanel"; public static final String NORTH_PANEL = "northPanel"; public static final String VIEWPORT = "viewPort"; private Viewport viewport; private ContentPanel centerPanel; private HtmlContainer northPanel; private ContentPanel westPanel; public AppView() { initialize(); } protected void initialize() { viewport = new Viewport(); viewport.setLayout(new BorderLayout()); Registry.register(VIEWPORT, viewport); createNorth(); createWest(); createCenter(); RootPanel.get().add(viewport); } private void createCenter() { centerPanel = new ContentPanel(); centerPanel.setBorders(false); centerPanel.setHeaderVisible(false); centerPanel.setLayout(new FitLayout()); BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER); data.setMargins(new Margins(5, 5, 5, 0)); viewport.add(centerPanel, data); Registry.register(CENTER_PANEL, centerPanel); } private void createWest() { BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 220, 150, 320); data.setMargins(new Margins(5, 5, 5, 5)); data.setCollapsible(true); westPanel = new ContentPanel(); ToolBar toolBar = new ToolBar(); westPanel.setTopComponent(toolBar); viewport.add(westPanel, data); Registry.register(WEST_PANEL, westPanel); } private void createNorth() { StringBuffer sb = new StringBuffer(); sb.append("
Ext GWT Explorer Demo
"); northPanel = new HtmlContainer(sb.toString()); northPanel.setStateful(false); northPanel.setId("demo-header"); northPanel.addStyleName("x-small-editor"); ThemeSelector selector = new ThemeSelector(); selector.setWidth(125); northPanel.add(selector, "#demo-theme"); BorderLayoutData data = new BorderLayoutData(LayoutRegion.NORTH, 33); data.setMargins(new Margins()); viewport.add(northPanel, data); Registry.register(NORTH_PANEL, northPanel); }}If i add the following code right after setting the viewport layout, it works fine.
viewport.setStyleName("x-border-panel"); Thanks.