gwt标签点击处理程序问题

时间:2011-01-04 05:40:52

标签: java gwt onclick label

点击标签时出错,标签有 单击处理程序附加到它,我使用GWT 2.1,问题是 只在IE上

堆栈跟踪:

09:27:45.777 [ERROR] [biddingsystem] Uncaught exception escaped
com.google.gwt.event.shared.UmbrellaException: One or more exceptions
caught, see full set in UmbrellaException#getCauses
    at
com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
214)
    at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
103)
    at
com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
96)
    at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:107)
    at
com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:
116)
    at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:
155)
    at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
    at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1264)
    at sun.reflect.GeneratedMethodAccessor206.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
157)
    at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
    at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
    at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
126)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
    at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
    at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
157)
    at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
281)
    at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
531)
    at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.google.gwt.event.shared.UmbrellaException: One or more
exceptions caught, see full set in UmbrellaException#getCauses
    at
com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
214)
    at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
103)
    at
com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
96)
    at com.BiddingSystem.client.Presenter.SigninRegisterPresenter
$1.onClick(SigninRegisterPresenter.java:50)
    at
com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:
54)
    at
com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
    at
com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
204)
    at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
103)
    at
com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
96)
    at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:107)
    at
com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:
116)
    at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:
155)
    at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
    at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1264)
    at sun.reflect.GeneratedMethodAccessor206.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
157)
    at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
    at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
    at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
126)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
    at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
    at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
157)
    at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
281)
    at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
531)
    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.client.JavaScriptException: (Error):
Invalid argument.
 number: -2147024809
 description: Invalid argument.
    at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
237)
    at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
126)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
289)
    at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
107)
    at com.google.gwt.dom.client.Element$.setPropertyInt$
(Element.java)
    at com.google.gwt.user.client.DOM.setElementPropertyInt(DOM.java:
1118)
    at com.google.gwt.user.client.ui.FlexTable
$FlexCellFormatter.setColSpan(FlexTable.java:78)
    at com.BiddingSystem.client.View.LoginView.<init>(LoginView.java:
61)
    at com.BiddingSystem.client.ApplicationController
$1.onSignIn(ApplicationController.java:110)
    at
com.BiddingSystem.client.event.SignInEvent.dispatch(SignInEvent.java:
18)
    at
com.BiddingSystem.client.event.SignInEvent.dispatch(SignInEvent.java:
1)
    at
com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
204)
    at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
103)
    at
com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
96)
    at com.BiddingSystem.client.Presenter.SigninRegisterPresenter
$1.onClick(SigninRegisterPresenter.java:50)
    at
com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:
54)
    at
com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
    at
com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
204)
    at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
103)
    at
com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:
96)
    at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:107)
    at
com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:
116)
    at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:
155)
    at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
    at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1264)
    at sun.reflect.GeneratedMethodAccessor206.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:
157)
    at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
    at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
    at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
126)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
    at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
    at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
    at 

2 个答案:

答案 0 :(得分:1)

检查您的*.gwt.xml文件 并在下面删除所有这些

<set-property name="user.agent" value="..anything.." />

将以下行添加到project_name.gwt.xml

<set-property name="user.agent" value="ie6" />

然后尝试使用Internet Explorer而不是Firefox等。

如果仍然不起作用,请尝试此代码;

com.google.gwt.user.client.ui.Label = new com.google.gwt.user.client.ui.Label("asdasd");
        l.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                // TODO Auto-generated method stub
                MessageBox.info("", "asd", null);
            }
        });

答案 1 :(得分:0)

您可以尝试使用HTML而不是Label。实际上,如果你想要一个“可点击”的组件,带有超链接或锚点或超链接的Button或HTML会更有意义,因为它们对用户来说更直观。