Andreas Neumann wrote:

thomas is that code ok to be used in the Squiggle browser? I guess that quite a few developers would benefit from that feature.

Not quite, first you need to get the File reference (via a file Save dialog presumably), and secondly this code I think uses the XSLT processor (with default processing) to turn the DOM into XML. Currently Squiggle has no hard dependency on XSLT. I would probably just have it use one of our XML serializers (although they probably aren't as nice about handling namespaces).

   I will work on adding a 'save as' to the file menu in squiggle.
There are some complex cases that something this simple probably
won't get right but 99% of the time it will be just fine.

sorry, I am not a Java programmer - I can't tell if one needs anything more to provide a view of the complete modified DOM.

save the current state of the DOM to a new SVG file. Yes, there is the DOM viewer to see the current DOM, but in some cases, it would be useful to get the full modified DOM and to be able to save it to a file again.


Interesting.. we added this feature to our application's "debug menu"
and it has proven very useful. The implementation is easy, something
like:

        JSVGCanvas canvas = ...
        File file = ...

        canvas.getUpdateManager().getUpdateRunnableQueue().invokeAndWait(
            new Runnable() {
                public void run() {
                    try {
                        TransformerFactory.newInstance().newTransformer()
                          .transform(
                            new DOMSource(canvas.getSVGDocument()),
                            new StreamResult(file));
                    } catch (Throwable t) {
                        t.printStackTrace().
                    }
                }
            }
        );


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to