GWT简单DockPanel使用错误

发布于 2024-10-20 05:36:41 字数 4033 浏览 6 评论 0原文

为什么这个“代码”失败了,

<g:DockPanel unit="px">
    <g:south size="100">
        <g:TextBox ui:field="host" text="localhost"/>
    </g:south>
    <g:south size="100">
        <g:TextBox ui:field="port" text="3287"/>
    </g:south>
</g:DockPanel>

而这个

<g:HorizontalPanel>
    <g:cell>
        <g:TextBox ui:field="host" text="localhost"/>
    </g:cell>
    <g:cell>
        <g:TextBox ui:field="port" text="3287"/>
    </g:cell>
</g:HorizontalPanel>

却没有?

附加信息:

stacktrace

ERROR: Deferred binding failed for 'client.view.EnterPage.EnterPageUiBinder'; expect subsequent failures. 
ERROR: Unable to load module entry point class client.Dbweb (see associated exception for details). java.lang.RuntimeException: Deferred binding failed for 'client.view.EnterPage$EnterPageUiBinder' (did you forget to inherit a required module?)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
    at com.google.gwt.core.client.GWT.create(GWT.java:98)
    at client.view.EnterPage.<clinit>(EnterPage.java:27)
    at client.Dbweb.onModuleLoad(Dbweb.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
    at com.google.gwt.core.client.GWT.create(GWT.java:98)
    at client.view.EnterPage.<clinit>(EnterPage.java:27)
    at client.Dbweb.onModuleLoad(Dbweb.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Thread.java:662)

活页夹创建

interface EnterPageUiBinder extends UiBinder<HTMLPanel, EnterPage> {
}

private static EnterPageUiBinder ourUiBinder = GWT.create(EnterPageUiBinder.class);

两个面板描述我都包裹到

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
         xmlns:g='urn:import:com.google.gwt.user.client.ui'>
    <g:HTMLPanel>
    panel description
    bla-bla
    </g:HTMLPanel>
</ui:UiBinder>

upd中如果您遇到同样的问题,您可以遵循@Peter Knego的解决方案或执行smt之类的操作

<g:DockLayoutPanel unit="PX">
      <g:south size="100">
          <g:TextBox ui:field="host" text="localhost"/>
      </g:south>
      <g:south size="100">
          <g:TextBox ui:field="port" text="3287"/>
      </g:south>
  </g:DockLayoutPanel>

why this "code" fails

<g:DockPanel unit="px">
    <g:south size="100">
        <g:TextBox ui:field="host" text="localhost"/>
    </g:south>
    <g:south size="100">
        <g:TextBox ui:field="port" text="3287"/>
    </g:south>
</g:DockPanel>

while this

<g:HorizontalPanel>
    <g:cell>
        <g:TextBox ui:field="host" text="localhost"/>
    </g:cell>
    <g:cell>
        <g:TextBox ui:field="port" text="3287"/>
    </g:cell>
</g:HorizontalPanel>

doesn't?

Additional info:

stacktrace

ERROR: Deferred binding failed for 'client.view.EnterPage.EnterPageUiBinder'; expect subsequent failures. 
ERROR: Unable to load module entry point class client.Dbweb (see associated exception for details). java.lang.RuntimeException: Deferred binding failed for 'client.view.EnterPage$EnterPageUiBinder' (did you forget to inherit a required module?)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
    at com.google.gwt.core.client.GWT.create(GWT.java:98)
    at client.view.EnterPage.<clinit>(EnterPage.java:27)
    at client.Dbweb.onModuleLoad(Dbweb.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
    at com.google.gwt.core.client.GWT.create(GWT.java:98)
    at client.view.EnterPage.<clinit>(EnterPage.java:27)
    at client.Dbweb.onModuleLoad(Dbweb.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Thread.java:662)

binder creation

interface EnterPageUiBinder extends UiBinder<HTMLPanel, EnterPage> {
}

private static EnterPageUiBinder ourUiBinder = GWT.create(EnterPageUiBinder.class);

both panels description I wrap into

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
         xmlns:g='urn:import:com.google.gwt.user.client.ui'>
    <g:HTMLPanel>
    panel description
    bla-bla
    </g:HTMLPanel>
</ui:UiBinder>

upd If you have same problem you can go after @Peter Knego's solution or do smt like

<g:DockLayoutPanel unit="PX">
      <g:south size="100">
          <g:TextBox ui:field="host" text="localhost"/>
      </g:south>
      <g:south size="100">
          <g:TextBox ui:field="port" text="3287"/>
      </g:south>
  </g:DockLayoutPanel>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风流物 2024-10-27 05:36:41

如有疑问,请参阅源代码

正确的布局是:

    <g:DockPanel>
        <g:Dock direction="SOUTH" size="100px">
            <g:TextBox text="localhost"/>
        </g:Dock>
        <g:Dock direction="SOUTH" size="100px">
            <g:TextBox text="3287"/>
        </g:Dock>
    </g:DockPanel>

When in doubt consult the source.

The correct layout is:

    <g:DockPanel>
        <g:Dock direction="SOUTH" size="100px">
            <g:TextBox text="localhost"/>
        </g:Dock>
        <g:Dock direction="SOUTH" size="100px">
            <g:TextBox text="3287"/>
        </g:Dock>
    </g:DockPanel>
爱已欠费 2024-10-27 05:36:41

我不确定您的 DockPanel 中是否应该有两次南面板。我认为你现在应该使用 DockLayoutPanel 。

I'm not sure you're supposed to have two time a south panel in your DockPanel. And I think your supposed to use DockLayoutPanel now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文