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.

Bug 133711 - add svg support
Summary: add svg support
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Graph (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Jiri Kovalsky
URL: http://wiki.netbeans.org/GraphLibrary...
Keywords: API_REVIEW_FAST
Depends on:
Blocks: 134005
  Show dependency tree
 
Reported: 2008-04-22 20:41 UTC by Kris Richards
Modified: 2016-04-17 18:13 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Visual Library SVG Support Plugin (29.11 KB, application/x-compressed)
2008-07-07 17:52 UTC, Kris Richards
Details
Visual Library SVG Support Plugin JavaDoc (56.63 KB, application/x-compressed)
2008-07-07 17:53 UTC, Kris Richards
Details
Batik 1.7.0 Library Wrapper Module (1.38 MB, application/x-compressed)
2008-07-07 17:55 UTC, Kris Richards
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kris Richards 2008-04-22 20:41:15 UTC
Add logic that allows users to export a scene to SVG format. This will require use of the "batik" library.
Comment 1 Kris Richards 2008-05-13 18:51:43 UTC
reassigning issue to myself in preparation for committing feature code.
Comment 2 Kris Richards 2008-06-13 14:19:41 UTC
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)

Comment 3 Kris Richards 2008-06-13 14:20:36 UTC
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.
Comment 4 yoshtec 2008-06-21 10:40:00 UTC
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.
Comment 5 Kris Richards 2008-07-07 17:52:56 UTC
Created attachment 64011 [details]
Visual Library SVG Support Plugin
Comment 6 Kris Richards 2008-07-07 17:53:59 UTC
Created attachment 64012 [details]
Visual Library SVG Support Plugin JavaDoc
Comment 7 Kris Richards 2008-07-07 17:55:13 UTC
Created attachment 64013 [details]
Batik 1.7.0 Library Wrapper Module
Comment 8 Jaroslav Tulach 2008-07-11 10:21:16 UTC
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?
Comment 9 Christian Lenz 2014-06-17 13:41:37 UTC
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
Comment 10 Christian Lenz 2014-08-04 10:51:44 UTC
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
Comment 11 Jaroslav Tulach 2014-11-05 12:05:04 UTC
Ideas are cheap, but is there anybody to do the coding? If so, reopen and continue with the API request.
Comment 12 Christian Lenz 2016-03-29 21:06:13 UTC
I implemented the preview button "yeah" but not more atm. Code is here: https://github.com/Chris2011/NbSvgPreview
Comment 13 Jaroslav Tulach 2016-04-17 03:59:48 UTC
Jirko, Geertjan, seems we have a possible code donation. Do you want to help Chris to turn into into product quality?
Comment 14 Christian Lenz 2016-04-17 18:13:10 UTC
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