|
fop 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.render.AbstractGenericSVGHandler
public abstract class AbstractGenericSVGHandler
Generic XML handler for SVG. Uses Apache Batik for SVG processing and simply paints to a Graphics2DAdapter and thus ultimatively to Graphics2D interface that is presented.
To use this class, subclass it and implement the missing methods (supportsRenderer, for example).
Field Summary |
---|
Fields inherited from interface org.apache.fop.render.XMLHandler |
---|
HANDLE_ALL |
Fields inherited from interface org.apache.fop.render.RendererContextConstants |
---|
FOREIGN_ATTRIBUTES, HANDLER_CONFIGURATION, HEIGHT, OUTPUT_STREAM, PAGE_VIEWPORT, WIDTH, XPOS, YPOS |
Constructor Summary | |
---|---|
AbstractGenericSVGHandler()
|
Method Summary | |
---|---|
protected org.apache.batik.gvt.GraphicsNode |
buildGraphicsNode(FOUserAgent userAgent,
org.apache.batik.bridge.BridgeContext ctx,
org.w3c.dom.Document doc)
Builds the GVT root. |
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 |
protected java.lang.String |
getDocumentURI(org.w3c.dom.Document doc)
Gets the document URI from a Document instance if possible. |
protected java.awt.Dimension |
getImageSize(RendererContext.RendererContextWrapper wrappedContext)
Returns the image size |
java.lang.String |
getNamespace()
|
void |
handleXML(RendererContext context,
org.w3c.dom.Document doc,
java.lang.String ns)
Handle an external xml document inside a Foreign Object Area. |
protected void |
renderSVGDocument(RendererContext rendererContext,
org.w3c.dom.Document doc)
Render the SVG document. |
protected void |
updateRendererContext(RendererContext context)
Override this method to update the renderer context if it needs special settings for certain conditions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.fop.render.XMLHandler |
---|
supportsRenderer |
Constructor Detail |
---|
public AbstractGenericSVGHandler()
Method Detail |
---|
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).
handleXML
in interface XMLHandler
context
- The RendererContext (contains the user agent)doc
- A DOM containing the foreign object to be
processedns
- The Namespace of the foreign object
java.lang.Exception
- If an error occurs during processing.protected org.apache.xmlgraphics.java2d.Graphics2DImagePainter createGraphics2DImagePainter(org.apache.batik.gvt.GraphicsNode root, org.apache.batik.bridge.BridgeContext ctx, java.awt.Dimension imageSize)
root
- the batik graphics node rootctx
- the batik bridge contextimageSize
- the image size
protected org.apache.batik.gvt.GraphicsNode buildGraphicsNode(FOUserAgent userAgent, org.apache.batik.bridge.BridgeContext ctx, org.w3c.dom.Document doc)
userAgent
- the user agentctx
- the batik bridge contextdoc
- the document
protected java.awt.Dimension getImageSize(RendererContext.RendererContextWrapper wrappedContext)
wrappedContext
- renderer context wrapper
protected void renderSVGDocument(RendererContext rendererContext, org.w3c.dom.Document doc) throws java.io.IOException
rendererContext
- the renderer contextdoc
- the SVG document
java.io.IOException
- In case of an I/O error while painting the imageprotected java.lang.String getDocumentURI(org.w3c.dom.Document doc)
doc
- the Document
protected void updateRendererContext(RendererContext context)
context
- the renderer contextpublic java.lang.String getNamespace()
getNamespace
in interface XMLHandler
|
fop 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |