Re: [Dev] calling javascript methods in an external js file from gwt JSNI native mthods
Hi all, I have successfully achieved this with GWT script injection and JSNI native methods. Thanks for the input. thanks and regards Awanthika On Thu, Sep 4, 2014 at 7:55 AM, Awanthika Senarath awanth...@wso2.com wrote: Hi Danushka, I don't think Jaggery is an option as we are using this to implement a jQuery, JavaScript and jsplumb based application in GWT. I am having the problem in calling the js page functions from the JSNI native Java methods. The js file is imported from html page. GWT compiles my Java code to JavaScript and calls the js page. But the error to my understanding states that the source js file is unknown in gwt context. thanks and regards Awanthika On Wed, Sep 3, 2014 at 9:01 PM, Danushka Fernando danush...@wso2.com wrote: Hi When I read your description and code segments [2] what I understood was you are having a problem with referring to a separate js file from a html page. When I read the [1] and exception trace what I understood was when you referred to an external js file you are having some troubles calling the java method. However assuming latter is the case, may be changing the order of your js imports will help. BTW jaggery facilitates the same thing you are trying to achieve here. Can't you use jaggery for your implementation? Thanks Regards Danushka Fernando Software Engineer WSO2 inc. http://wso2.com/ Mobile : +94716332729 On Wed, Sep 3, 2014 at 6:10 PM, Sohani Weerasinghe soh...@wso2.com wrote: Can you try the option available at [1] where it uses ScriptResources for ClientBundle instead of script tags. [1] https://plus.google.com/u/0/+RayCromwell/posts/g3TmFeao8kK Thanks, Sohani Sohani Weerasinghe Software Engineer WSO2, Inc: http://wso2.com Mobile : +94 716439774 Blog :http://christinetechtips.blogspot.com/ Twitter : https://twitter.com/sohanichristine On Wed, Sep 3, 2014 at 4:41 PM, Awanthika Senarath awanth...@wso2.com wrote: Hi all, I am trying to do $Subject. When the JavaScript method is in the head of html file itself I can call the method from module load as a native method using JSN [1]I. But when i refer to the js file from html page [2] and put the method in to the js file i get the following gwt error[3]. Has anyone ever attempted anything similar and achieved it successfully? [1] in java class public static native void gwtjsPlumbDemo() /*-{ $wnd.gwtjsplumbdemo(); }-*/; [2] in gwtjsplumbdemo.js file function gwtjsplumbdemo() { alert(Success!!!); } in html script type=text/javascript language=javascript src=gwtjsplumbdemo.js/script [2] [115:32:19.737 [ERROR] [gwtjsplumb] Unable to load module entry point class com.wso2.codenvy.client.GWTJsplumb (see associated exception for details) com.google.gwt.core.client.JavaScriptException: (TypeError) @com.wso2.codenvy.client.GWTJsplumb::gwtjsPlumbDemo()([]): Object doesn't support property or method 'gwtjsplumbdemo' at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.wso2.codenvy.client.GWTJsplumb.gwtjsPlumbDemo(GWTJsplumb.java) at com.wso2.codenvy.client.GWTJsplumb.onModuleLoad(GWTJsplumb.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:411) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Unknown Source) thanks and regards Awanthika Senarath Software Engineer, WSO2 Inc. Mobile: +94717681791 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Awanthika Senarath Software Engineer, WSO2 Inc. Mobile: +94717681791 -- Awanthika Senarath Software Engineer, WSO2 Inc. Mobile: +94717681791 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
[Dev] calling javascript methods in an external js file from gwt JSNI native mthods
Hi all, I am trying to do $Subject. When the JavaScript method is in the head of html file itself I can call the method from module load as a native method using JSN [1]I. But when i refer to the js file from html page [2] and put the method in to the js file i get the following gwt error[3]. Has anyone ever attempted anything similar and achieved it successfully? [1] in java class public static native void gwtjsPlumbDemo() /*-{ $wnd.gwtjsplumbdemo(); }-*/; [2] in gwtjsplumbdemo.js file function gwtjsplumbdemo() { alert(Success!!!); } in html script type=text/javascript language=javascript src=gwtjsplumbdemo.js/script [2] [115:32:19.737 [ERROR] [gwtjsplumb] Unable to load module entry point class com.wso2.codenvy.client.GWTJsplumb (see associated exception for details) com.google.gwt.core.client.JavaScriptException: (TypeError) @com.wso2.codenvy.client.GWTJsplumb::gwtjsPlumbDemo()([]): Object doesn't support property or method 'gwtjsplumbdemo' at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.wso2.codenvy.client.GWTJsplumb.gwtjsPlumbDemo(GWTJsplumb.java) at com.wso2.codenvy.client.GWTJsplumb.onModuleLoad(GWTJsplumb.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:411) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Unknown Source) thanks and regards Awanthika Senarath Software Engineer, WSO2 Inc. Mobile: +94717681791 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] calling javascript methods in an external js file from gwt JSNI native mthods
Can you try the option available at [1] where it uses ScriptResources for ClientBundle instead of script tags. [1] https://plus.google.com/u/0/+RayCromwell/posts/g3TmFeao8kK Thanks, Sohani Sohani Weerasinghe Software Engineer WSO2, Inc: http://wso2.com Mobile : +94 716439774 Blog :http://christinetechtips.blogspot.com/ Twitter : https://twitter.com/sohanichristine On Wed, Sep 3, 2014 at 4:41 PM, Awanthika Senarath awanth...@wso2.com wrote: Hi all, I am trying to do $Subject. When the JavaScript method is in the head of html file itself I can call the method from module load as a native method using JSN [1]I. But when i refer to the js file from html page [2] and put the method in to the js file i get the following gwt error[3]. Has anyone ever attempted anything similar and achieved it successfully? [1] in java class public static native void gwtjsPlumbDemo() /*-{ $wnd.gwtjsplumbdemo(); }-*/; [2] in gwtjsplumbdemo.js file function gwtjsplumbdemo() { alert(Success!!!); } in html script type=text/javascript language=javascript src=gwtjsplumbdemo.js/script [2] [115:32:19.737 [ERROR] [gwtjsplumb] Unable to load module entry point class com.wso2.codenvy.client.GWTJsplumb (see associated exception for details) com.google.gwt.core.client.JavaScriptException: (TypeError) @com.wso2.codenvy.client.GWTJsplumb::gwtjsPlumbDemo()([]): Object doesn't support property or method 'gwtjsplumbdemo' at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.wso2.codenvy.client.GWTJsplumb.gwtjsPlumbDemo(GWTJsplumb.java) at com.wso2.codenvy.client.GWTJsplumb.onModuleLoad(GWTJsplumb.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:411) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Unknown Source) thanks and regards Awanthika Senarath Software Engineer, WSO2 Inc. Mobile: +94717681791 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] calling javascript methods in an external js file from gwt JSNI native mthods
Hi When I read your description and code segments [2] what I understood was you are having a problem with referring to a separate js file from a html page. When I read the [1] and exception trace what I understood was when you referred to an external js file you are having some troubles calling the java method. However assuming latter is the case, may be changing the order of your js imports will help. BTW jaggery facilitates the same thing you are trying to achieve here. Can't you use jaggery for your implementation? Thanks Regards Danushka Fernando Software Engineer WSO2 inc. http://wso2.com/ Mobile : +94716332729 On Wed, Sep 3, 2014 at 6:10 PM, Sohani Weerasinghe soh...@wso2.com wrote: Can you try the option available at [1] where it uses ScriptResources for ClientBundle instead of script tags. [1] https://plus.google.com/u/0/+RayCromwell/posts/g3TmFeao8kK Thanks, Sohani Sohani Weerasinghe Software Engineer WSO2, Inc: http://wso2.com Mobile : +94 716439774 Blog :http://christinetechtips.blogspot.com/ Twitter : https://twitter.com/sohanichristine On Wed, Sep 3, 2014 at 4:41 PM, Awanthika Senarath awanth...@wso2.com wrote: Hi all, I am trying to do $Subject. When the JavaScript method is in the head of html file itself I can call the method from module load as a native method using JSN [1]I. But when i refer to the js file from html page [2] and put the method in to the js file i get the following gwt error[3]. Has anyone ever attempted anything similar and achieved it successfully? [1] in java class public static native void gwtjsPlumbDemo() /*-{ $wnd.gwtjsplumbdemo(); }-*/; [2] in gwtjsplumbdemo.js file function gwtjsplumbdemo() { alert(Success!!!); } in html script type=text/javascript language=javascript src=gwtjsplumbdemo.js/script [2] [115:32:19.737 [ERROR] [gwtjsplumb] Unable to load module entry point class com.wso2.codenvy.client.GWTJsplumb (see associated exception for details) com.google.gwt.core.client.JavaScriptException: (TypeError) @com.wso2.codenvy.client.GWTJsplumb::gwtjsPlumbDemo()([]): Object doesn't support property or method 'gwtjsplumbdemo' at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.wso2.codenvy.client.GWTJsplumb.gwtjsPlumbDemo(GWTJsplumb.java) at com.wso2.codenvy.client.GWTJsplumb.onModuleLoad(GWTJsplumb.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:411) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Unknown Source) thanks and regards Awanthika Senarath Software Engineer, WSO2 Inc. Mobile: +94717681791 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] calling javascript methods in an external js file from gwt JSNI native mthods
Hi Danushka, I don't think Jaggery is an option as we are using this to implement a jQuery, JavaScript and jsplumb based application in GWT. I am having the problem in calling the js page functions from the JSNI native Java methods. The js file is imported from html page. GWT compiles my Java code to JavaScript and calls the js page. But the error to my understanding states that the source js file is unknown in gwt context. thanks and regards Awanthika On Wed, Sep 3, 2014 at 9:01 PM, Danushka Fernando danush...@wso2.com wrote: Hi When I read your description and code segments [2] what I understood was you are having a problem with referring to a separate js file from a html page. When I read the [1] and exception trace what I understood was when you referred to an external js file you are having some troubles calling the java method. However assuming latter is the case, may be changing the order of your js imports will help. BTW jaggery facilitates the same thing you are trying to achieve here. Can't you use jaggery for your implementation? Thanks Regards Danushka Fernando Software Engineer WSO2 inc. http://wso2.com/ Mobile : +94716332729 On Wed, Sep 3, 2014 at 6:10 PM, Sohani Weerasinghe soh...@wso2.com wrote: Can you try the option available at [1] where it uses ScriptResources for ClientBundle instead of script tags. [1] https://plus.google.com/u/0/+RayCromwell/posts/g3TmFeao8kK Thanks, Sohani Sohani Weerasinghe Software Engineer WSO2, Inc: http://wso2.com Mobile : +94 716439774 Blog :http://christinetechtips.blogspot.com/ Twitter : https://twitter.com/sohanichristine On Wed, Sep 3, 2014 at 4:41 PM, Awanthika Senarath awanth...@wso2.com wrote: Hi all, I am trying to do $Subject. When the JavaScript method is in the head of html file itself I can call the method from module load as a native method using JSN [1]I. But when i refer to the js file from html page [2] and put the method in to the js file i get the following gwt error[3]. Has anyone ever attempted anything similar and achieved it successfully? [1] in java class public static native void gwtjsPlumbDemo() /*-{ $wnd.gwtjsplumbdemo(); }-*/; [2] in gwtjsplumbdemo.js file function gwtjsplumbdemo() { alert(Success!!!); } in html script type=text/javascript language=javascript src=gwtjsplumbdemo.js/script [2] [115:32:19.737 [ERROR] [gwtjsplumb] Unable to load module entry point class com.wso2.codenvy.client.GWTJsplumb (see associated exception for details) com.google.gwt.core.client.JavaScriptException: (TypeError) @com.wso2.codenvy.client.GWTJsplumb::gwtjsPlumbDemo()([]): Object doesn't support property or method 'gwtjsplumbdemo' at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.wso2.codenvy.client.GWTJsplumb.gwtjsPlumbDemo(GWTJsplumb.java) at com.wso2.codenvy.client.GWTJsplumb.onModuleLoad(GWTJsplumb.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:411) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Unknown Source) thanks and regards Awanthika Senarath Software Engineer, WSO2 Inc. Mobile: +94717681791 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev -- Awanthika Senarath Software Engineer, WSO2 Inc. Mobile: +94717681791 ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev