2012-07-23 79 views
0

我想在Jboss errai应用程序中使用DockLayoutPanel。 我的入口点类:GWT DockLayoutPanel空白页

@EntryPoint 
public class Application { 

private Caller<UserService> userService; 

private Label registerConfirmMessage; 

@AfterInitialization 
public void createUI() { 

    DockLayoutPanel p = new DockLayoutPanel(Unit.EM); 
    p.addNorth(new HTML("header"), 2); 
    p.addSouth(new HTML("footer"), 2); 
    p.addWest(new HTML("navigation"), 10); 
    p.add(new HTML("content")); 
    RootLayoutPanel.get().add(p); 
} 

我Application.gwt.xml:

<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4//EN" 
    "http://google-web-toolkit.googlecode.com/svn/releases/2.4/distro-source/core/src/gwt-module.dtd"> 

<!-- GWT module definition: the rename-to attribute is used to have a shorter 
module name that doesn't reflect the actual package structure. --> 
<module> 
<inherits name="org.jboss.errai.common.ErraiCommon" /> 
<inherits name="org.jboss.errai.bus.ErraiBus" /> 
<inherits name="org.jboss.errai.ioc.Container" /> 
<inherits name="org.jboss.errai.enterprise.CDI" /> 
<inherits name="org.hibernate.validator.HibernateValidator" /> 

<source path="client" /> 
<source path="shared" /> 
</module> 

我发现不同的结果,当我改变DOCTYPE。所以:

在IE6它要么DOCTYPE工作

<!DOCTYPE HTML> 

空白页在Mozilla Firefox 14,Chrome的

<!DOCTYPE> 

空白页的FF14,但它在Chrome工作。

所有其他文档类型导致空白页。

请指正我的问题,正确解决!

回答

1

从文档:

这个小工具只能在标准模式下,它要求在其运行的 HTML页面有一个明确的申报工作。

这样就意味着:

1,浏览器需要在标准模式下运行,而不是在怪癖模式。

2.In你的HTML文件的开头,你应该有这样的:

<!doctype html> 
<!-- The DOCTYPE declaration above will set the  --> 
<!-- browser's rendering engine into    --> 
<!-- "Standards Mode". Replacing this declaration --> 
<!-- with a "Quirks Mode" doctype is not supported. --> 

此外,DOCTYPE HTML页中的应用程序启动,其中定义。

,而不是gwt.xml

还检查下面的链接,它描述了一个GWT项目的组织:

https://developers.google.com/web-toolkit/doc/latest/DevGuideOrganizingProjects

+0

感谢。它部分帮助我。但现在我有另一个身高问题。我是否需要分配一些面板的高度(RootLayoutPanel,DocsLayoutPanel)?我希望我的DockLayoutPanel具有100%的屏幕高度。 – 2012-07-24 10:16:10

+0

当你添加东,北,西和南时,你应该添加大小(北/南的高度和东/西的宽度),中心应该总是被添加到最后,它会占用所有剩余的空间。例如,如果你只是在中心添加一个按钮,那么它应该占用所有空间 – Spiff 2012-07-24 10:56:49

+0

是的,我是按照你写的。我想我找到了解决方案与CSS:HTML,身体{高度:100%; } – 2012-07-24 11:03:51