xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jake B" <otakuj...@gmail.com>
Subject using Batik with JSON
Date Sat, 18 Aug 2007 18:19:00 GMT
Hello, I'm trying to determine if Batik is an appropriate library to use in
order to fulfill my project's special requirements. I am trying to construct
a web application in which the users would interact with an SVG document
within their browser. Rather than construct this application as a rich or
fat client (i.e., deploying JSVGCanvas inside a Java applet), I need to
construct the interactive SVG front-end as a thin client. The only thing
that the users would need to download would be a basic SVG document, and a
minimal AJAX engine to pass UI events to the server, fetch updates from the
server, and update the page asyncronously. In order to manipulate the
client-side SVG DOM tree, I would like to use JSON, passing the client
javascript commands in the form of strings and then executing them using the
eval() function. Basically, I need to push all of the logic to the server,
and update the client-side SVG document by evaluating server-generated
javascript function calls asyncronously.

I believe that Batik's implementation of the SVG DOM would be superb for
modelling the state of the client-side SVG document. However, every time the
server-side model is changed programmatically, it would also need to
generate javascript to update the document on the client's side.
For example, if the user were to click and drag a rectangle down to a new
position, the client would use the AJAX engine to pass the user's mouse
input event to the server. The server would switch this event, and update
its model of the client's document, probably with a function call like '
rectangle.setAttributeNS(null, "y", "20");'. The server would then generate
javascript code to pass back to the client, probably with a function call
like 'rectangle.y = 20'. When the client's AJAX engine next pings the
server, it GETs this code, runs eval on it, and updates the contents on the

My question is, does anyone know of a way to tell Batik to generate
javascript that can be used to manipulate client-side SVG in the above
If this functionality does not exist yet, I'm willing to write it myself. If
anyone has any advice as to what would be the best way to build this
functionality onto the existing core modules, I would greatly appreciate it
if you would let me know.



View raw message