|
Re: SVG Web library - integration with RAP [message #630740 is a reply to message #630718] |
Mon, 04 October 2010 18:15 |
|
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 #631991 is a reply to message #630740] |
Mon, 11 October 2010 07:29 |
Cristina Petra Messages: 14 Registered: July 2009 |
Junior Member |
|
|
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.02841 seconds