Hi Frederik,
I don't know how big a deal it is for you but you can
fairly easily avoid having the svg canvas copy your
document by using the Batik DOM Implementation. The
easiest thing to do is use:
batik.dom.svg.SAXSVGDocumentFactory
You can provide any SAX2 Parser class to the constructor
(such as: "org.apache.xerces.parsers.SAXParser").
Frederik Santens wrote:
Ok it works. Indeed, the problem was that I used the parsed document and
not the svgcanvas' internal document.
From: Thomas DeWeese [mailto:[EMAIL PROTECTED]
Hi Frederik,
Can you provide the SVG file being manipulated?
Also where does 'doc' come from (in some cases the
canvas has to 'copy' the given document)? It's
generally best to use svgCanvas.getSVGDocument().
Are you sure that 'node' is the element you
expect it to be (I assume a rect)?
Frederik Santens wrote:
Instead of calling the javascript from updatemanager thread, I
manipulate the DOM tree of the svg now. Here is the code:
I'm just trying to move the position of a text field.
However the svgCanvas does not reflect the changes. What am I doing
wrong?
Frederik Santens wrote:
I had a javascript function named "alert" which just called
alert("Helloworld");
When I called my alert js function from within java
(Interpeter.evaluate("alert()")) I got this StackOverflowError. When I
changed the name of the function to 'displayMessage' it worked.
Probably something with reserved words.
Well just confusion about which 'alert' function to call, in JS
there is no function overloading so your 'alert' function called
itself.
Can I pass references to custom objects to the javascript too?
Yes, although you'll have to work at it a bit since you can't
easily reference your custom object from the string. The easiest
thing to do is use 'bind' to associate your custom object with
a global variable in JS, then have your function just use that
global var - Iky, I know. Also be careful as it is really easy to
introduce memory leaks this way.
You mentioned also in the previous reply that I don't need javascript
to do the dynamic updates of my rendered svg. Do you mean manipulating
the DOM tree via the updatemanager thread is the alternative way of doing
this or are there other ways?
This is what I mean. Once you are running in the Update manager
thread you can just manipulate the DOM tree using Java. What other
way did you have in mind?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]