/** * Returns a string that represents the given node. * * @param node * Node to return the XML for. * @return Returns an XML string. * @deprecated Use <code>mxXmlUtils.getXml(Node)</code> (Jan 2012) */ public static String getXml(Node node) { return mxXmlUtils.getXml(node); }
/** * Returns a string that represents the given node. * * @param node * Node to return the XML for. * @return Returns an XML string. * @deprecated Use <code>mxXmlUtils.getXml(Node)</code> (Jan 2012) */ public static String getXml(Node node) { return mxXmlUtils.getXml(node); }
@Override public void windowClosing(final WindowEvent e) { final Document doc = mxCellRenderer.createSvgDocument(KaxVizFrame.this.graph, null, 1d, Color.WHITE, KaxVizFrame.this.graph.getGraphBounds()); try { mxUtils.writeFile(mxXmlUtils.getXml(doc), outFilename); } catch (final IOException ex) { LOGGER.error("Failed to save Visualization of kax-File.", ex); } } });
@Override public void windowClosing(final WindowEvent e) { final Document doc = mxCellRenderer.createSvgDocument(KaxVizFrame.this.graph, null, 1d, Color.WHITE, KaxVizFrame.this.graph.getGraphBounds()); try { mxUtils.writeFile(mxXmlUtils.getXml(doc), outFilename); } catch (final IOException ex) { LOG.error("Failed to save Visualization of kax-File.", ex); } } });
mxUtils.writeFile(mxXmlUtils.getXml(canvas.getDocument()), filename); mxUtils.writeFile(mxXmlUtils.getXml(mxCellRenderer.createVmlDocument(graph, null, 1, null, null).getDocumentElement()), filename); mxUtils.writeFile(mxXmlUtils.getXml(mxCellRenderer.createHtmlDocument(graph, null, 1, null, null).getDocumentElement()), filename); String xml = mxXmlUtils.getXml(codec.encode(graph.getModel())); mxUtils.writeFile(xml, filename);
mxUtils.writeFile(mxXmlUtils.getXml(canvas.getDocument()), filename); mxUtils.writeFile(mxXmlUtils.getXml(mxCellRenderer.createVmlDocument(graph, null, 1, null, null).getDocumentElement()), filename); mxUtils.writeFile(mxXmlUtils.getXml(mxCellRenderer.createHtmlDocument(graph, null, 1, null, null).getDocumentElement()), filename); String xml = mxXmlUtils.getXml(codec.encode(graph.getModel())); mxUtils.writeFile(xml, filename);
/** * Saves XML+PNG format. * @param frame */ protected void saveXmlPng(TrackSchemeFrame frame, String filename, Color bg) throws IOException { final mxGraphComponent graphComponent = trackScheme.getGUI().graphComponent; final mxGraph graph = trackScheme.getGraph(); // Creates the image for the PNG file BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, bg, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); // Creates the URL-encoded XML data mxCodec codec = new mxCodec(); String xml = URLEncoder.encode(mxXmlUtils.getXml(codec.encode(graph.getModel())), "UTF-8"); mxPngEncodeParam param = mxPngEncodeParam.getDefaultEncodeParam(image); param.setCompressedText(new String[] { "mxGraphModel", xml }); // Saves as a PNG file try (FileOutputStream outputStream = new FileOutputStream( new File( filename ) )) { mxPngImageEncoder encoder = new mxPngImageEncoder( outputStream, param ); if ( image != null ) encoder.encode( image ); else JOptionPane.showMessageDialog( graphComponent, "No Image Data" ); } }
/** * Saves XML+PNG format. * @param frame */ protected void saveXmlPng(TrackSchemeFrame frame, String filename, Color bg) throws IOException { final mxGraphComponent graphComponent = trackScheme.getGUI().graphComponent; final mxGraph graph = trackScheme.getGraph(); // Creates the image for the PNG file BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, bg, graphComponent.isAntiAlias(), null, graphComponent.getCanvas()); // Creates the URL-encoded XML data mxCodec codec = new mxCodec(); String xml = URLEncoder.encode(mxXmlUtils.getXml(codec.encode(graph.getModel())), "UTF-8"); mxPngEncodeParam param = mxPngEncodeParam.getDefaultEncodeParam(image); param.setCompressedText(new String[] { "mxGraphModel", xml }); // Saves as a PNG file try (FileOutputStream outputStream = new FileOutputStream( new File( filename ) )) { mxPngImageEncoder encoder = new mxPngImageEncoder( outputStream, param ); if ( image != null ) encoder.encode( image ); else JOptionPane.showMessageDialog( graphComponent, "No Image Data" ); } }