Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » SVG Web library - integration with RAP
SVG Web library - integration with RAP [message #630718] Mon, 04 October 2010 12:50 Go to next message
Eclipse UserFriend
I was wondering if anyone tried (and succeed) to integrate the SVG Web library in a RAP application ( http://code.google.com/p/svgweb/ ).

We embed a lot of generated SVG files as objects in our RAP application, and we need now for our application to work in IE (which does not have native support for SVG - only IE9 which is still beta).

In order to use this library, I had to include some script in the html page's header (their instruction notes).
E.g. <script src="../svg.js" data-path=".."></script>
I did this using on-demand javascript, which I place in the HtmlResponseWriter, ( preWindowOpen() method of the ApplicationWorkbenchWindowAdvisor class).

The problem is that my on-demand script only gets executed when the DOM is already loaded (which is normal as I read), and the SVG Web library provides functionality by adding a DOM loaded listener - this means no functionality with my code so far.

I would be happy to get some guide lines or some ideas if possible.

Many thanks,
Cristina
Re: SVG Web library - integration with RAP [message #630740 is a reply to message #630718] Mon, 04 October 2010 14:15 Go to previous messageGo to next message
Eclipse UserFriend
Cristina,

RAP has an extension point for including javascript files (both inline and external). See the custom widget tutorial [1], specifically the section on "Registering the javascript files". There are examples of including javascript from the bundle (which gets inlined), and external javascript api such as google maps.

I'm not sure whether this will work with svgweb or not since they explicitly state you must have svgweb as the first script tag. An external script is the most likely to work since it actually adds the script tag to the head of the page. Also I don't think there is a way to add a data-path attribute using the RAP extension point, but you could always file an enhancement request for that.

I think the HtmlResponseWriter will be too late since the page is already loaded at that point, but I could be wrong.

If you get it working I'd be interested in hearing. I was actually just looking at using that library with RAP a few days ago, but never got to the point of testing.

Cole

[1] http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .rap.help/help/html/advanced/custom-widget.html
Re: SVG Web library - integration with RAP [message #630766 is a reply to message #630740] Mon, 04 October 2010 17:08 Go to previous messageGo to next message
Eclipse UserFriend
Cole,

Thank you for your help.
I will try out things in this direction and let you know about my progress.

Regards,
Cristina
Re: SVG Web library - integration with RAP [message #631991 is a reply to message #630740] Mon, 11 October 2010 03:29 Go to previous message
Eclipse UserFriend
I managed to integrate SVGWeb in my RAP application. Here is what did:

- Create an "svg" library related folder in which I place svg-uncompressed.js, svg.swf and svg.htc files.

- Add an "org.eclipse.equinox.http.registry.resources" extension point to register this folder

- Register the svg.js file as a local .js resource file. With this, the "DOMContentLoaded" listener will work just fine.

- I changed the library path by hand (pointing to my js file) in the svg-uncompressed.js file, as any script integrated in the html page (with the HtmlResponseWriter) will come too late.
You can use the same workaround regarding the meta-data related to forcing the flash on all browsers (change _forceFlash function from the svg.js file), or use url parameter as they explain (this I didn't try yet).

- I needed this library for dynamic svg files - therefore I must follow their instructions related this topic. Inner html they don't support yet (as I read), so if you have the same needs you must actually create objects, as they explain, and afterwards use their appendChild function. The library will handle the rest.

E.g. in a custom widget:
var myElem = this.getElement();
var obj = document.createElement('object', true);
obj.setAttribute('type', 'image/svg+xml');
...
window.svgweb.appendChild(obj, myElem);

Best Regards,
Cristina

Previous Topic:[ANN] RAP 1.4 M2 is available
Next Topic:How to show spinning wheel when rap app is loading
Goto Forum:
  


Current Time: Wed Jul 23 09:56:13 EDT 2025

Powered by FUDForum. Page generated in 0.07316 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top