SVG Web library - integration with RAP [message #630718] |
Mon, 04 October 2010 12:50  |
Eclipse User |
|
|
|
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 #631991 is a reply to message #630740] |
Mon, 11 October 2010 03:29  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.07316 seconds