/** * Creates a new SVGDocumentFactory object. * @param parser The SAX2 parser classname. * @param dd Whether a document descriptor must be generated. */ public SAXSVGDocumentFactory(String parser, boolean dd) { super(SVGDOMImplementation.getDOMImplementation(), parser, dd); }
/** * Creates a new SVGDocumentFactory object. * @param parser The SAX2 parser classname. */ public SAXSVGDocumentFactory(String parser) { super(SVGDOMImplementation.getDOMImplementation(), parser); }
/** * Creates a new SVGDocumentFactory object. * @param parser The SAX2 parser classname. * @param dd Whether a document descriptor must be generated. */ public SAXSVGDocumentFactory(String parser, boolean dd) { super(SVGDOMImplementation.getDOMImplementation(), parser, dd); }
/** * Creates a new SVGDocumentFactory object. * @param parser The SAX2 parser classname. */ public SAXSVGDocumentFactory(String parser) { super(SVGDOMImplementation.getDOMImplementation(), parser); }
/** * Creates a new SVGDocumentFactory object. * @param parser The SAX2 parser classname. * @param dd Whether a document descriptor must be generated. */ public SAXSVGDocumentFactory(String parser, boolean dd) { super(SVGDOMImplementation.getDOMImplementation(), parser, dd); }
/** {@inheritDoc} */ public DOMImplementation getDOMImplementation() { return SVGDOMImplementation.getDOMImplementation(); }
/** * Creates a new SVGDocumentFactory object. * @param parser The SAX2 parser classname. */ public SAXSVGDocumentFactory(String parser) { super(SVGDOMImplementation.getDOMImplementation(), parser); }
/** * Create a new svg document with batik. * @param width the width of the root svg element * @param height the height of the root svg element * @return a new SVG Document */ public static Document createSVGDocument(float width, float height) { DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); Document doc = impl.createDocument(SVG_NS, "svg", null); Element svgRoot = doc.getDocumentElement(); svgRoot.setAttributeNS(null, "width", "" + width); svgRoot.setAttributeNS(null, "height", "" + height); return doc; }
public DOMImplementation getDOMImplementation(String ver) { if (ver == null || ver.length() == 0 || ver.equals("1.0") || ver.equals("1.1")) { return SVGDOMImplementation.getDOMImplementation(); } else if (ver.equals("1.2")) { return SVG12DOMImplementation.getDOMImplementation(); } throw new RuntimeException("Unsupport SVG version '" + ver + "'"); }
private DOMImplementation getDOMImplementation(String ver) { //TODO It would be great if Batik provided this method as static helper method. if (ver == null || ver.length() == 0 || ver.equals("1.0") || ver.equals("1.1")) { return SVGDOMImplementation.getDOMImplementation(); } else if (ver.equals("1.2")) { return SVG12DOMImplementation.getDOMImplementation(); } throw new RuntimeException("Unsupport SVG version '" + ver + "'"); }
public DOMImplementation getDOMImplementation(String ver) { if (ver == null || ver.length() == 0 || ver.equals("1.0") || ver.equals("1.1")) { return SVGDOMImplementation.getDOMImplementation(); } else if (ver.equals("1.2")) { return SVG12DOMImplementation.getDOMImplementation(); } throw new RuntimeException("Unsupport SVG version '" + ver + "'"); }
public DOMImplementation getDOMImplementation(String ver) { if (ver == null || ver.length() == 0 || ver.equals("1.0") || ver.equals("1.1")) { return SVGDOMImplementation.getDOMImplementation(); } else if (ver.equals("1.2")) { return SVG12DOMImplementation.getDOMImplementation(); } throw new RuntimeException("Unsupport SVG version '" + ver + "'"); }
/** Create an empty Document from a TranscoderOutput. * <ul> * <li>If the TranscoderOutput already contains an empty Document : returns this * Document</li> * <li>else create a new empty DOM Document</li> * </ul> */ protected Document createDocument(TranscoderOutput output) { // Use SVGGraphics2D to generate SVG content Document doc; if (output.getDocument() == null) { DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation(); doc = domImpl.createDocument(SVG_NAMESPACE_URI, SVG_SVG_TAG, null); } else { doc = output.getDocument(); } return doc; }
/** Create an empty Document from a TranscoderOutput. * <ul> * <li>If the TranscoderOutput already contains an empty Document : returns this * Document</li> * <li>else create a new empty DOM Document</li> * </ul> */ protected Document createDocument(TranscoderOutput output) { // Use SVGGraphics2D to generate SVG content Document doc; if (output.getDocument() == null) { DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation(); doc = domImpl.createDocument(SVG_NAMESPACE_URI, SVG_SVG_TAG, null); } else { doc = output.getDocument(); } return doc; }
/** * Constructs a new FOP-style transcoder. */ public AbstractFOPTranscoder() { hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, SVGConstants.SVG_NAMESPACE_URI); hints.put(KEY_DOCUMENT_ELEMENT, SVGConstants.SVG_SVG_TAG); hints.put(KEY_DOM_IMPLEMENTATION, SVGDOMImplementation.getDOMImplementation()); }
/** * 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); }
private static TranscodingHints createTranscodingHints(int width, int height) { TranscodingHints hints = new TranscodingHints(); hints.put(ImageTranscoder.KEY_DOM_IMPLEMENTATION, SVGDOMImplementation.getDOMImplementation()); hints.put(ImageTranscoder.KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, SVGConstants.SVG_NAMESPACE_URI); hints.put(ImageTranscoder.KEY_DOCUMENT_ELEMENT, "svg"); hints.put(ImageTranscoder.KEY_WIDTH, (float)width); hints.put(ImageTranscoder.KEY_HEIGHT, (float)height); return hints; }
protected SVGAbstractTranscoder() { userAgent = createUserAgent(); hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, SVGConstants.SVG_NAMESPACE_URI); hints.put(KEY_DOCUMENT_ELEMENT, SVGConstants.SVG_SVG_TAG); hints.put(KEY_DOM_IMPLEMENTATION, SVGDOMImplementation.getDOMImplementation()); hints.put(KEY_MEDIA, "screen"); hints.put(KEY_DEFAULT_FONT_FAMILY, DEFAULT_DEFAULT_FONT_FAMILY); hints.put(KEY_EXECUTE_ONLOAD, Boolean.FALSE); hints.put(KEY_ALLOWED_SCRIPT_TYPES, DEFAULT_ALLOWED_SCRIPT_TYPES); }
protected SVGAbstractTranscoder() { userAgent = createUserAgent(); hints.put(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, SVGConstants.SVG_NAMESPACE_URI); hints.put(KEY_DOCUMENT_ELEMENT, SVGConstants.SVG_SVG_TAG); hints.put(KEY_DOM_IMPLEMENTATION, SVGDOMImplementation.getDOMImplementation()); hints.put(KEY_MEDIA, "screen"); hints.put(KEY_DEFAULT_FONT_FAMILY, DEFAULT_DEFAULT_FONT_FAMILY); hints.put(KEY_EXECUTE_ONLOAD, Boolean.FALSE); hints.put(KEY_ALLOWED_SCRIPT_TYPES, DEFAULT_ALLOWED_SCRIPT_TYPES); }