This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Add logic that allows users to export a scene to SVG format. This will require use of the "batik" library.
reassigning issue to myself in preparation for committing feature code.
The following are comments made on an email thread concerning this issue ---------------------- Minor comments - my experience with API review is that it's best to go find and ask some engineers to be your reviewers. Also perhaps full review is probably more suitable for planned Kris' change, but that may be just my feeling. (Dafe Simonek) ---------------------- I do not like the idea of including yet another library for an extra feature in the graph library. The library is otherwise standalone. I'd rather see you create new module that has dependency on the visual library and batik libraries and provides the additional API for SVG support. That is the lowlevel advice. The higher level one is to have standard review. Then it is possible to argue in IZ and during a conf call about the best solution. (Jaroslav Tulach) ---------------------- I am adding an "export to SVG" feature to the Visual Library. The code that was submitted by the community makes use of two jars fromthe Batik library. I need to link with these jar files. Then you need a library wrapper module to hold them, and you need to add a dependency on this to whatever module implements the export feature. Be sure to read http://wiki.netbeans.org/DevFaqExternalLibrariesUpdated regarding the source tree conventions for the new JARs, and get an open-source review before including the new library wrapper module in the standard build. -------------------- Anyway the bigger problem is that the issue is silent about the need to add dependencies on new libraries. That information immediately changed the situation and attracted my attention. We do not want NetBeans Platform to have strong dependencies on too many external libraries. Enough troubles with javahelp. I would suggest to turn this review into standard one. Let Kris update the material with info about the libraries, possible find a way to make them "voluntary", let him find four reviewers to check that and call a conf call to get some conclusion.(Jaroslav Tulach) ------------------------ >We do not want NetBeans Platform to have strong dependencies on too many external libraries. Yes. With NB Platform going into the JDK (as well as in some of the Java licensees distros), this needs to be the focus. >I would suggest to turn this review into standard one Please. (Arseniy)
I will reopen this SVG api-review issue. Change it to a standard review. Add my patch/diffs. Contact reviewers directly and setup a conf call.
Exporting to SVG is really simple with batik: <code> DOMImplementation dom = SVGDOMImplementation.getDOMImplementation(); SVGDocument doc = (SVGDocument) dom.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", null); SVGGraphics2D generator = new SVGGraphics2D(doc); try { // some scene from the Visual Library scene.paint(generator); FileWriter file = new FileWriter("out.svg"); PrintWriter writer = new PrintWriter(file); generator.stream(writer); } catch (Exception e) { e.printStackTrace(); } </code> Works like a charm. Tried that yesterday after completing the Visual Database Explorer tutorial.
Created attachment 64011 [details] Visual Library SVG Support Plugin
Created attachment 64012 [details] Visual Library SVG Support Plugin JavaDoc
Created attachment 64013 [details] Batik 1.7.0 Library Wrapper Module
Y01 Add private constructor to SVGExporter Y02 The tests might test a bit more than just return value == false. Y03 Do not duplicate DOM W3C classes and their implementation. Can't Batik work with regular DOM parsers? Can you just add a dependency on libs.xerces instead of carying yet another XML parser with batik? Y04 Which clusters this shall be added into?
What about the idea? It's more than 6 years old oO. I have a HTML5 project in netbeans 8 with fonts which we created via icomoon and I have a font-preview and I only see the code and not the preview, no preview button. I thought there were a plugin or smth like that but I can't find it. This support would be very great. Voted for it. Regards Chris
I only see the view button, which opens the browser and shows me the SVG. There is a problem with refactoring a tag via ctrl + r, as I mentioned it here: https://netbeans.org/bugzilla/show_bug.cgi?id=142277 There are no breadcrumbs too, thought it will be handled as an XML file. Regards Chris
Ideas are cheap, but is there anybody to do the coding? If so, reopen and continue with the API request.
I implemented the preview button "yeah" but not more atm. Code is here: https://github.com/Chris2011/NbSvgPreview
Jirko, Geertjan, seems we have a possible code donation. Do you want to help Chris to turn into into product quality?
Atm it is really only a button to change from source to view which will display, atm, a white page. My intention is to show/render the SVG inside a html file/view to see the result in netbeans. I created a ticket, some months ago for this little behaviour: https://netbeans.org/bugzilla/show_bug.cgi?id=248110