Hi Thomas,
Hi Ziru,
Ziru Zhu wrote:
I am currently using Batik to develop in our visualization part of project.
I hope you are finding it useful.
Sure. It adds lots of flexibilities to our project.
Our SVG doc contains some scripts providing some interactive functionalities such as rotation, zooming and so on. Also the doc should be dynamically updatable so that new data from the server side can be used to update the DOC contents.
Unfortunately, a NullPointer exception is thrown out when we activating the scripts by clicking the displaying portion while the update manager is substituing stale data. The problem is how to disable the scripting feature when UpdateMgr thread is changing the DOC.
It isn't 100% clear if by 'scripting' you mean ecma script or not. I would assume so, but since all ecma script is run in the UpdateMgr thread I don't see how your changes and the script could be running at the same time. Put another way the scripting features is 'disabled' when the UpdateMgr is working - to be more accurate scripting is 'delayed' - to be even more accurate the delivery of events that trigger scripting are delayed. The place I could see you getting into trouble would be if you have 'setTimeout' or getURL stuff going on in which case it is your responsability to ensure you notice when stuff leaves the DOM tree - you can always 'stop' the update manger thread if you are truely done but that will kill the document entirely.
Yes, I mean ECMA script.
I am a little vague on the "delay". Will the events be triggered during the update (but delayed processing after the update) or not? In my codes, the scripts are also changed in the UpdateMgr. Is it possible that the events are triggered before the update but be delivered to the changed scripts after the UpdateMgr deal with all these.
The events are dispatched in a seperate runnable that is added to the UpdateManager RunnableQueue whenever they occur. So if your update is running it they will be dispatched when your update completes.
What do you mean by 'changed scripts' I don't see how you can change the JavaScript functions on the fly? Do you mean you change what functions are registered to handle certain events in the DOM?
You may need to provide more information about the exact circumstance of the NPE (perhaps provide the stack trace - with line numbers?), or a reproducable test case before I can help you any more.
Second, I find that the SVG display will not work if I change (or add / remove) the svgRoot's attributes in the UpdateMgr. Is there any work around for this?
Once again can you be more specific? Standalone test case?
Well, I changed the ViewBox attributes of the SVGRoot element, because in our project, new data may need to readjust the whole view port of the image. I thought I did change the attributes, because when I dumped the dynamic DOM to a disk file, it could be displayed correctly on the screen by using JSVGCanvas. However, I failed to do that without dumping all these.
I recently fixed a bug related to this, what version of Batik are you currently using?
As to the standalone test case, I will try to pack the relevant part and send you a copy.
This is the best way to get a bug fixed...
Thanks.
Ziru
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]