Re: GWT and SVG, the 125th... :-)

2014-03-01 Thread Magnus
Did anybody compare the two libraries, svg.js and snap.svg.js? Why would you prefer one over the other? Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: GWT and SVG, the 125th... :-)

2014-02-28 Thread Magnus
On Thursday, February 27, 2014 8:07:50 PM UTC+1, Jens wrote: Working example: This works! Thanks!!! Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an

Re: GWT and SVG, the 125th... :-)

2014-02-27 Thread Ümit Seren
In your GraphicsPanel.java try to use var draw = $wnd.SVG('drawing') instead of SVG On Thursday, February 27, 2014 6:25:07 AM UTC+1, Magnus wrote: Hi, ok, I used the GWT ScriptInjector, and now also the identifier SVG can be resolved. This brought me one step further, but now I get

Re: GWT and SVG, the 125th... :-)

2014-02-27 Thread Alberto Mancini
Hi, if I understand the js fragment you posted at the beginning of this thread var draw = SVG('drawing').size(300, 300) means create an object SVG using as a parent element the element with the id 'drawing' (cause 'drawing' is a string, you can pass an element instead, i checked the code) so

Re: GWT and SVG, the 125th... :-)

2014-02-27 Thread Jens
Working example: public class SvgEntryPoint implements EntryPoint { public class SvgWidget extends Widget { public SvgWidget() { setElement(Document.get().createDivElement()); // SVG library should draw inside the widget's container element drawExample(getElement());

Re: GWT and SVG, the 125th... :-)

2014-02-26 Thread Magnus
On Wednesday, February 26, 2014 8:52:32 AM UTC+1, Alain wrote: One solution could be to create a GWT widget based on a DIV element and call the JSNI in the onLoad method. I did something similar with a Google Map widget. Hello Alain, thank you! I understand that there is some DOM

Re: GWT and SVG, the 125th... :-)

2014-02-26 Thread Alain Ekambi
You basically create a GWT widget based on a div element. Once that widget is create you call your js code. Have a look at the onAttach method in the link I showed early on. So you call call myClientBundle.executeJSCode() inside the onAttach method of your widget. Hope that helps 2014-02-26

Re: GWT and SVG, the 125th... :-)

2014-02-26 Thread Magnus
Hi Alain, I understand that you fetch all the JS code with the method getJsObj() and pass it to the method setupMap. So I believe that setupMap will embed the JS code into the div element. But what exactly is going on there? (I do not know the Maps API): private native void

GWT and SVG, the 125th... :-)

2014-02-26 Thread Andrei
If this script is central to your application, you can simply include it in your host page. Then you can access it from your GWT code. If this script is used only under certain conditions, you can inject it when necessary using a ScriptInjector. Both approaches work well. -- You received

Re: GWT and SVG, the 125th... :-)

2014-02-26 Thread Magnus
Hi, I have a minimal example now, see below. I included the JS code as a ClientBundle and also called injectScript: public class SampleLoader { public void injectScript() { String raw = SampleAssetsBundle.instance.myScript().getText(); ScriptElement e =

Re: GWT and SVG, the 125th... :-)

2014-02-26 Thread Jens
But when call testSVG I get the following error: com.google.gwt.core.client.JavaScriptException: (ReferenceError) @wgp.client.lib.GraphicsPanel::test()([]): SVG is not defined You have added a script element to the browser's top window, but your GWT app runs inside an iframe. Inside that

Re: GWT and SVG, the 125th... :-)

2014-02-26 Thread Magnus
Hi, ok, I used the GWT ScriptInjector, and now also the identifier SVG can be resolved. This brought me one step further, but now I get another error message: [ERROR] [wgp] - Failed to load module 'wgp' from user agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)

Re: GWT and SVG, the 125th... :-)

2014-02-26 Thread Magnus
Hi, ok, I used the GWT ScriptInjector, and now also the identifier SVG can be resolved. This brought me one step further, but now I get another error message: [ERROR] [wgp] - Failed to load module 'wgp' from user agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like

Re: GWT and SVG, the 125th... :-)

2014-02-26 Thread Magnus
Hi, ok, I used the GWT ScriptInjector, and now also the identifier SVG can be resolved. This brought me one step further, but now I get another error message: [ERROR] [wgp] - Failed to load module 'wgp' from user agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)

GWT and SVG, the 125th... :-)

2014-02-25 Thread Magnus
Hi, I have been searching for SVG support in GWT for an long time. Now I have found something that seems to be exactly what I am looking for: http://svgjs.com/ - It's lightweight. - It supports importing SVG files. - The demo shows all the features I need (simple drawings, svg

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Alain Ekambi
Also have a look at http://snapsvg.io/ 2014-02-25 14:31 GMT+01:00 Magnus alpineblas...@gmail.com: Hi, I have been searching for SVG support in GWT for an long time. Now I have found something that seems to be exactly what I am looking for: http://svgjs.com/ - It's lightweight.

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Jens
Also have a look at http://snapsvg.io/ Oh that looks pretty cool. Worth a bookmark :) -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Magnus
Yes, it's cool! :-) But what about my question? :-) How to embed JS within GWT? Thanks Magnus -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread mark . erikson
There's two general approaches: 1) Write large JSNI methods that do all the interaction in Javascript 2) Use GWT's JavaScriptObject, subclass the library's objects, and write small JSNI methods that wrap individual methods of the JS object. There's supposed to be better JS interop coming in GWT

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Jens
Should cover the most: http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html Personally I use ClientBundle + (External)TextResource + ScriptInjector to inject the JS code into the browser. -- J. -- You received this message because you are subscribed to the Google Groups

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Magnus
Thanks, it covers most of the stuff relating to embed JS within Java code... But one important thing seems to be missing at the first sight: How to include a whole JS library into the GWT project and access its methods... Magnus -- You received this message because you are subscribed to the

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Jens
I have already said how to load it into the browser, so not sure what you mean. If you mean code completion in your IDE I have no idea how well Eclipse handles it. In IntelliJ it works pretty well. -- J. -- You received this message because you are subscribed to the Google Groups Google Web

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Magnus
Ok, this must be the method with ClientBundle. I missed this. It seems that you can also simply include it in the module xml: https://groups.google.com/forum/#!topic/google-web-toolkit/_7NnUCR4vD0 Magnus -- You received this message because you are subscribed to the Google Groups Google Web

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Magnus
Hi, including a script tag in the module xml did not work for me: The Cross-Site-Iframe linker does not support script tags in the gwt.xml files Using ClientBundle works. However, what is still missing is the connection between the JS objects and the GWT widgets. Consider the initial

Re: GWT and SVG, the 125th... :-)

2014-02-25 Thread Alain Ekambi
One solution could be to create a GWT widget based on a DIV element and call the JSNI in the onLoad method. I did something similar with a Google Map widget. Have a look at https://github.com/emitrom/Pilot/blob/master/Pilot/src/com/emitrom/pilot/maps/client/GMapWidget.java 2014-02-26 4:58