I already hava a solution to generate a SVG.
But now I need a solution to group the SVG elements which represents a
node or link (using the SVG element ). This groups should also
have a id, for example the name of the node or link.
How can I realize this functionality?
Thanks for help.
Here is my code to generate the SVG:
//create workflow
JGoDocument oJGoDocument = …;
// convert JGoDocument to svg string
SVGGoView svgView = new SVGGoView();
svgView.setDocument(oJGoDocument);
…
//create SVG
ByteArrayOutputStream oSVGBuffer = new ByteArrayOutputStream();
svgView.generateSVG(oSVGBuffer);
//get the SVG as String
String svg = oSVGBuffer.toString();
To add a group element with additional attributes around any node or link class, just create a subclass of that node or link and override SVGWriteObject as follows:
No, SVGGoView doesn’t give you that kind of control over the SVG generation.
But if you use DefaultDocument and call setGenerateJGoXML(false) you'll end up just generating SVG elements without all the additional JGo stuff and you'll have much more control over the SVG generation.
No, the element is grouping all the children of the JGoLabeledLink. But the MidLabel of a JGoLabeledLink isn’t a child of the JGoLabeledLink. Instead it’s a totally separate JGoObject that gets repositioned as the JGoLabeledlink changes position.