Package org.faceless.graph2.tag
Class SVGEmbedder
- java.lang.Object
-
- org.faceless.graph2.tag.Embedder
-
- org.faceless.graph2.tag.SVGEmbedder
-
public class SVGEmbedder extends Embedder
This Embedder creates an SVG format Graph using theSVGOutput
class, and embeds it in the HTML using the <object> and/or <embed> tags. It handles rollovers in a similar way to thePNGEmbedder
class.- Since:
- 2.4
-
-
Constructor Summary
Constructors Constructor Description SVGEmbedder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
convert()
Convert the object returned byEmbedder.getGraph()
to an appropriate binary form, write it toEmbedder.getImageOutputStream()
and write the HTML required to embed it toEmbedder.getPageWriter()
, referencing the image atEmbedder.getImagePath()
.String
getMIMEType()
Get the MIME type for the image that will be written by this Embedder toEmbedder.getImageOutputStream()
SVGOutput
getSVGOutput()
Return theSVGOutput
created by this classvoid
setBrowserSniff(boolean sniff)
Set whether to "sniff" the browser using JavaScript.-
Methods inherited from class org.faceless.graph2.tag.Embedder
getAttribute, getAttributes, getForeignXML, getGraph, getHeight, getId, getResourceProvider, getWidth
-
-
-
-
Method Detail
-
setBrowserSniff
public void setBrowserSniff(boolean sniff)
Set whether to "sniff" the browser using JavaScript. The correct code to handle SVG documents cannot be created in a cross-browser fashion, so setting this flag will cause the browser to be identified with JavaScript on load and the tags modified then.- Since:
- 2.4.2
-
getMIMEType
public String getMIMEType()
Description copied from class:Embedder
Get the MIME type for the image that will be written by this Embedder toEmbedder.getImageOutputStream()
- Specified by:
getMIMEType
in classEmbedder
-
convert
public void convert() throws IOException
Description copied from class:Embedder
Convert the object returned byEmbedder.getGraph()
to an appropriate binary form, write it toEmbedder.getImageOutputStream()
and write the HTML required to embed it toEmbedder.getPageWriter()
, referencing the image atEmbedder.getImagePath()
. At it's very minimum it could look something like this:ImageOutput output = new ImageOutput(); getGraph().draw(output); output.writePNG(getImageOutputStream(), 0); getPageWriter().write("<img src='"+getImagePath()+"' />");
which is suitable for embedding an image with no mouse interaction.- Specified by:
convert
in classEmbedder
- Throws:
IOException
-
-