Class AbstractGenericSVGHandler

    • Constructor Detail

      • AbstractGenericSVGHandler

        public AbstractGenericSVGHandler()
    • Method Detail

      • handleXML

        public void handleXML​(RendererContext context,
                              org.w3c.dom.Document doc,
                              java.lang.String ns)
                       throws java.lang.Exception

        Handle an external xml document inside a Foreign Object Area.

        This may throw an exception if for some reason it cannot be handled. The caller is expected to deal with this exception.

        The implementation may convert the XML document internally to another XML dialect (SVG, for example) and call renderXML() on the AbstractRenderer again (which can be retrieved through the RendererContext).

        Specified by:
        handleXML in interface XMLHandler
        Parameters:
        context - The RendererContext (contains the user agent)
        doc - A DOM containing the foreign object to be processed
        ns - The Namespace of the foreign object
        Throws:
        java.lang.Exception - If an error occurs during processing.
      • createGraphics2DImagePainter

        protected org.apache.xmlgraphics.java2d.Graphics2DImagePainter createGraphics2DImagePainter​(org.apache.batik.gvt.GraphicsNode root,
                                                                                                    org.apache.batik.bridge.BridgeContext ctx,
                                                                                                    java.awt.Dimension imageSize)
        Creates a graphics 2D image painter implementation
        Parameters:
        root - the batik graphics node root
        ctx - the batik bridge context
        imageSize - the image size
        Returns:
        a new graphics 2D image painter implementation
      • buildGraphicsNode

        protected org.apache.batik.gvt.GraphicsNode buildGraphicsNode​(FOUserAgent userAgent,
                                                                      org.apache.batik.bridge.BridgeContext ctx,
                                                                      org.w3c.dom.Document doc)
        Builds the GVT root.
        Parameters:
        userAgent - the user agent
        ctx - the batik bridge context
        doc - the document
        Returns:
        a built GVT root tree
      • getImageSize

        protected java.awt.Dimension getImageSize​(RendererContext.RendererContextWrapper wrappedContext)
        Returns the image size
        Parameters:
        wrappedContext - renderer context wrapper
        Returns:
        the image size
      • renderSVGDocument

        protected void renderSVGDocument​(RendererContext rendererContext,
                                         org.w3c.dom.Document doc)
                                  throws java.io.IOException
        Render the SVG document.
        Parameters:
        rendererContext - the renderer context
        doc - the SVG document
        Throws:
        java.io.IOException - In case of an I/O error while painting the image
      • getDocumentURI

        protected java.lang.String getDocumentURI​(org.w3c.dom.Document doc)
        Gets the document URI from a Document instance if possible.
        Parameters:
        doc - the Document
        Returns:
        the URI or null
      • updateRendererContext

        protected void updateRendererContext​(RendererContext context)
        Override this method to update the renderer context if it needs special settings for certain conditions.
        Parameters:
        context - the renderer context
      • getNamespace

        public java.lang.String getNamespace()
        Specified by:
        getNamespace in interface XMLHandler
        Returns:
        the XML namespace for the XML dialect this XMLHandler supports, null if all XML content is handled by this instance.