if (!(document.getImplementation() instanceof SVGDOMImplementation)) { DOMImplementation impl = (DOMImplementation) hints.get(KEY_DOM_IMPLEMENTATION); document = DOMUtilities.deepCloneDocument(document, impl);
/** * Clones an SVG DOM document. This is used for making SVG production thread-safe when the * SVG document is cached and re-used. * @param doc the SVG DOM to be cloned * @return the cloned SVG DOM */ public static Document cloneSVGDocument(Document doc) { Document clonedDoc = DOMUtilities.deepCloneDocument(doc, doc.getImplementation()); if (clonedDoc instanceof AbstractDocument) { ((AbstractDocument)clonedDoc).setDocumentURI(((AbstractDocument)doc).getDocumentURI()); } return clonedDoc; }
/** * Sets the Document to display. If the document does not use * Batik's SVG DOM Implemenation it will be cloned into that * implementation. In this case you should use 'getSVGDocument()' * to get the actual DOM that is attached to the rendering interface. * * Note that the preparation for rendering and the rendering itself * occur asynchronously so you need to register event handlers * if you want to know when the document is truly displayed. * * Notes for documents that you want to change in Java: * From this point on you may only modify the * the document in the UpdateManager thread @see #getUpdateManager. * In many cases you also need to tell Batik to treat the document * as a dynamic document by calling setDocumentState(ALWAYS_DYNAMIC). */ public void setDocument(Document doc) { if ((doc != null) && !(doc.getImplementation() instanceof SVGDOMImplementation)) { DOMImplementation impl; impl = SVGDOMImplementation.getDOMImplementation(); Document d = DOMUtilities.deepCloneDocument(doc, impl); doc = d; } setSVGDocument((SVGDocument)doc); }
/** * Sets the Document to display. If the document does not use * Batik's SVG DOM Implemenation it will be cloned into that * implementation. In this case you should use 'getSVGDocument()' * to get the actual DOM that is attached to the rendering interface. * * Note that the preparation for rendering and the rendering itself * occur asynchronously so you need to register event handlers * if you want to know when the document is truly displayed. * * Notes for documents that you want to change in Java: * From this point on you may only modify the * the document in the UpdateManager thread @see #getUpdateManager. * In many cases you also need to tell Batik to treat the document * as a dynamic document by calling setDocumentState(ALWAYS_DYNAMIC). */ public void setDocument(Document doc) { if ((doc != null) && !(doc.getImplementation() instanceof SVGDOMImplementation)) { DOMImplementation impl; impl = SVGDOMImplementation.getDOMImplementation(); Document d = DOMUtilities.deepCloneDocument(doc, impl); doc = d; } setSVGDocument((SVGDocument)doc); }
/** * Sets the Document to display. If the document does not use * Batik's SVG DOM Implemenation it will be cloned into that * implementation. In this case you should use 'getSVGDocument()' * to get the actual DOM that is attached to the rendering interface. * * Note that the preparation for rendering and the rendering itself * occur asynchronously so you need to register event handlers * if you want to know when the document is truly displayed. * * Notes for documents that you want to change in Java: * From this point on you may only modify the * the document in the UpdateManager thread @see #getUpdateManager. * In many cases you also need to tell Batik to treat the document * as a dynamic document by calling setDocumentState(ALWAYS_DYNAMIC). */ public void setDocument(Document doc) { if ((doc != null) && !(doc.getImplementation() instanceof SVGDOMImplementation)) { DOMImplementation impl; impl = SVGDOMImplementation.getDOMImplementation(); Document d = DOMUtilities.deepCloneDocument(doc, impl); doc = d; } setSVGDocument((SVGDocument)doc); }
DOMImplementation impl; impl = SVGDOMImplementation.getDOMImplementation(); Document d = DOMUtilities.deepCloneDocument(doc, impl); doc = (SVGDocument)d;
DOMImplementation impl; impl = SVGDOMImplementation.getDOMImplementation(); Document d = DOMUtilities.deepCloneDocument(doc, impl); doc = (SVGDocument)d;
DOMImplementation impl; impl = SVGDOMImplementation.getDOMImplementation(); Document d = DOMUtilities.deepCloneDocument(doc, impl); doc = (SVGDocument)d;
doc = (SVGDocument)DOMUtilities.deepCloneDocument(doc, impl);
doc = (SVGDocument)DOMUtilities.deepCloneDocument(doc, impl);
doc = (SVGDocument)DOMUtilities.deepCloneDocument(doc, impl);
/** {@inheritDoc} */ public void handleXML(RendererContext context, org.w3c.dom.Document doc, String ns) throws Exception { if (getNamespace().equals(ns)) { if (!(doc instanceof SVGDocument)) { DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); doc = DOMUtilities.deepCloneDocument(doc, impl); } SVGSVGElement svg = ((SVGDocument) doc).getRootElement(); SVGDocument targetDoc = (SVGDocument)context.getProperty(SVG_DOCUMENT); SVGElement currentPageG = (SVGElement)context.getProperty(SVG_PAGE_G); Element view = targetDoc.createElementNS(getNamespace(), "svg"); Node newsvg = targetDoc.importNode(svg, true); //view.setAttributeNS(null, "viewBox", "0 0 "); int xpos = ((Integer)context.getProperty(XPOS)).intValue(); int ypos = ((Integer)context.getProperty(YPOS)).intValue(); view.setAttributeNS(null, "x", "" + xpos / 1000f); view.setAttributeNS(null, "y", "" + ypos / 1000f); // this fixes a problem where the xmlns is repeated sometimes Element ele = (Element) newsvg; ele.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns", getNamespace()); if (ele.hasAttributeNS(null, "xmlns")) { ele.removeAttributeNS(null, "xmlns"); } view.appendChild(newsvg); currentPageG.appendChild(view); } }
impl = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION); document = DOMUtilities.deepCloneDocument(document, impl); if (uri != null) { ParsedURL url = new ParsedURL(uri);
impl = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION); document = DOMUtilities.deepCloneDocument(document, impl); if (uri != null) { ParsedURL url = new ParsedURL(uri);
document = DOMUtilities.deepCloneDocument(document, impl);