2013-07-20 51 views
1

我在我的GWT应用程序中使用JS覆盖对象。调试应用程序时,我无法看到Overlay对象的值。它是使用GWT覆盖对象的限制吗? 是否因为Overlay对象是本机对象..?如果它是一个限制,是否有任何未来计划为GWT中的Overlay对象带来调试支持。在Eclipse中调试GWT覆盖对象

[我无法上传图片。所以,键入我在调试窗口中看到]

> customer= JavaScriptObject$ (id=52) 
    > hostedmodeReference= JsValusOOPHM (id=183) 
    > value= BrowserChannel$JsObjectRef (id=188) 
     refId= 2 

GWT版本2.5.1

+0

我见下文涉及到我的问题了两张票。但不确定是否插入eclipse调试。 https://code.google.com/p/google-web-toolkit/issues/detail?id=2912 https://code.google.com/p/google-plugin-for-eclipse/issues/detail ?id = 95 – suresh

+0

代码块会有帮助,您是否扩展了JavaScriptObject,因为如果是的话,您可以使用Window.alert(新的JSONObject(customer).toString())打印它。 –

回答

1

在GWT覆盖类型是一个非常特殊的野兽,使用字节码重写实现。详情请参阅https://code.google.com/p/google-web-toolkit/wiki/OverlayTypes(可能有点过时)。

As Suresh points out in the comments,在GWT中对它有低级别的支持,但IDE必须使用它进行无缝集成。

Pending that integration,你可以直接在你的IDE中的“表”视图(或类似)在调试会话过程中使用的工具类:

com.google.gwt.core.ext.debug.JsoEval.call(MyJso.class, myJso, "myMethod") 
1

这将打印从JavscriptObject JSON字符串。

// Print it to the log 
GWT.log(new JSONObject(customer).toString()); 

// Popup window 
Window.alert(new JSONObject(customer).toString()); 
+0

感谢您的回答。它有助于。 – suresh