Wednesday, September 22, 2010

Re: External Javascript library in GWT (Canviz)

Note:
If I create another HTML object with content:
HTML image = new HTML("<div id=\"debug_output\"></div>");
Then there are any error. But I see anything. There isn't picture
either log message.

Do you have any idea please?

On 22 zář, 09:39, vkrejcirik <vkrejci...@gmail.com> wrote:
> I try to use javascript library Canviz for rendering dot file to image
> on client side in my GWT application. I did these steps:
>
> 1) Insert <script> elements into my html main page.
>
>         <script type="text/javascript" src="js/prototype.js"></script>
>         <script type="text/javascript" src="js/path.js"></script>
>         <script type="text/javascript" src="js/canviz.js"></script>
>         <script type="text/javascript" src="js/x11colors.js"></script>
>
> 2) In java class, I create HTML object and set:
>
> image1.setHTML("<div id=\"image_2\"></div>");
>
> 3) Then I create native method:
>
> public static native void getImage2(String dot) /*-{
>
>           var canviz;
>
>           canviz = new $wnd.Canviz("image_2");
>           canviz.load(dot);
>
>         }-*/;
>
> When I push the button and call method getImage2, then I get this
> error:
>
> com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot
> set property 'innerHTML' of null
>  stack: TypeError: Cannot set property 'innerHTML' of null
>     at klass.load (http://127.0.0.1:8889/js/canviz.js:464:31)
>     at unknown source
>     at __gwt_jsInvoke (http://127.0.0.1:8889/clan/hosted.html?clan:
> 70:35)
>     at eval at <anonymous> (http://127.0.0.1:8889/clan/hosted.html?
> clan:54:12)
>     at XMLHttpRequest.<anonymous> (unknown source)
>     at unknown source
>     at __gwt_jsInvoke (http://127.0.0.1:8889/clan/hosted.html?clan:
> 70:35)
>     at eval at <anonymous> (http://127.0.0.1:8889/clan/hosted.html?
> clan:54:12)
>     at XMLHttpRequest.onreadystatechange (unknown source)
>  type: non_object_property_store
>  arguments: innerHTML,
>  __gwt_ObjectId: 3497
>     at
> com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChann elServer.java:
> 195)
>     at
> com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
> 120)
>     at
> com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
> 507)
>     at
> com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
> 264)
>     at
> com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.j ava:
> 91)
>     at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
>     at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
>     at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     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.jav a:
> 157)
>     at
> com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java :
> 1669)
>     at
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChan nelServer.java:
> 401)
>     at
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java :
> 222)
>     at java.lang.Thread.run(Unknown Source)
>
> Could you help me please? Thanks.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment