2013-07-20 50 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