/** * 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 new document for the given XML string. * * @param xml * String that represents the XML data. * @return Returns a new XML document. * @deprecated Use <code>mxXmlUtils.parseXml</code> (Jan 2012) */ public static Document parseXml(String xml) { return mxXmlUtils.parseXml(xml); }
/** * Returns a new, empty DOM document. * * @return Returns a new DOM document. */ public static Document createDocument() { return mxXmlUtils.getDocumentBuilder().newDocument(); }
/** * 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); }
/** * Constructs a new stencil for the given Dia shape description. */ public mxStencilShape(String shapeXml) { this(mxXmlUtils.parseXml(shapeXml)); }
/** * Returns a new DOM document for the given URI. External entities and DTDs are ignored. * * @param uri * URI to parse into the document. * @return Returns a new DOM document for the given URI. */ public static Document loadDocument(String uri) { try { return mxXmlUtils.getDocumentBuilder().parse(uri); } catch (Exception e) { log.log(Level.SEVERE, "Failed to load the document from " + uri, e); } return null; }
@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); } } });
/** * Returns a new document for the given XML string. * * @param xml * String that represents the XML data. * @return Returns a new XML document. * @deprecated Use <code>mxXmlUtils.parseXml</code> (Jan 2012) */ public static Document parseXml(String xml) { return mxXmlUtils.parseXml(xml); }
/** * Returns a new document for the given XML string. External entities and DTDs are ignored. * * @param xml * String that represents the XML data. * @return Returns a new XML document. */ public static Document parseXml(String xml) { try { return getDocumentBuilder().parse(new InputSource(new StringReader(xml))); } catch (Exception e) { log.log(Level.SEVERE, "Failed to parse XML", e); } return null; }
@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); } } });
/** * Constructs a new stencil for the given Dia shape description. */ public mxStencilShape(String shapeXml) { this(mxXmlUtils.parseXml(shapeXml)); }
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" ); } }