Class Embedder

  • Direct Known Subclasses:
    PDFEmbedder, PNGEmbedder, SVGEmbedder

    public abstract class Embedder
    extends Object
    An Embedder is responsible for converting a Graph object to HTML and binary output. Subclasses of this object handle conversion from a Graph object to various output formats (PNG, SVG etc). This class is used by the EmbeddedXMLGraph class. It's possible for customers to subclass this (or further subclass one of the existing subclasses) to create their own output formats.
    Since:
    2.4
    See Also:
    EmbeddedXMLGraph.doEmbed(), EmbedderFactory
    • Field Detail

      • ACTIONS

        public static final Collection<String> ACTIONS
        A list of the "actions" that can be applied to each rollover area. These include "title", "href", "target" and the "onNNN" attributes.
    • Constructor Detail

      • Embedder

        public Embedder()
    • Method Detail

      • getAttribute

        public String getAttribute​(String attribute)
        Get the specified non-standard attribute set on the or tag, or null if it doesn't exist
        See Also:
        getAttributes()
      • getGraph

        public Graph getGraph()
        Get the Graph this Embedder is operating on
      • getWidth

        public int getWidth()
        Get the requested width of the Graph
      • getHeight

        public int getHeight()
        Get the requested height of the Graph
      • getId

        public String getId()
        Get the ID for the object being created by this Embedder. The ID is unique on its page for this graph, and should be used if any other objects (like image maps or JavaScript) are to be created that relate to this Graph.
      • getForeignXML

        public String getForeignXML()
        Get any XML that was included in the Graph XML from a different namespace
      • getMIMEType

        public abstract String getMIMEType()
        Get the MIME type for the image that will be written by this Embedder to getImageOutputStream()
      • convert

        public abstract void convert()
                              throws IOException
        Convert the object returned by getGraph() to an appropriate binary form, write it to getImageOutputStream() and write the HTML required to embed it to getPageWriter(), referencing the image at 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.
        Throws:
        IOException