|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.graph2.tag.Embedder
public abstract class Embedder
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, Flash 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.
EmbeddedXMLGraph.doEmbed()
,
EmbedderFactory
Field Summary | |
---|---|
static Collection |
ACTIONS
A list of the "actions" that can be applied to each rollover area. |
Constructor Summary | |
---|---|
Embedder()
|
Method Summary | |
---|---|
abstract void |
convert()
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() . |
protected String |
getAction(String key,
String action)
Return the specified action for the specified key. |
protected Collection |
getActionKeys()
Return the list of keys that have actions associated with them. |
String |
getAttribute(String attribute)
Get the specified non-standard attribute set on the |
Collection |
getAttributes()
Get the list of non-standard attributes set on the |
protected Font |
getFont(String fontname)
Get the Font object matching the specified name, or null if it does not exist. |
protected Set |
getFonts()
Return the name of all the fonts specified as available for use with the Graph |
String |
getForeignXML()
Get any XML that was included in the Graph XML from a different namespace |
Graph |
getGraph()
Get the Graph this Embedder is operating on |
int |
getHeight()
Get the requested height of the Graph |
String |
getId()
Get the ID for the object being created by this Embedder. |
protected OutputStream |
getImageOutputStream()
Get the OutputStream object that the binary image file should be written to |
protected String |
getImagePath()
Get the path that should be specified in the HTML to reference the image. |
abstract String |
getMIMEType()
Get the MIME type for the image that will be written by this Embedder to getImageOutputStream() |
protected Map |
getPageResources()
Return the page resources - font names and URLs. |
protected Writer |
getPageWriter()
Get the Writer object that the HTML should be written to |
protected static Paint |
getPaint(String val)
Given a String representing a color (eg #F0F0F0 or "red") , convert it to a Paint object |
int |
getWidth()
Get the requested width of the Graph |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Collection ACTIONS
Constructor Detail |
---|
public Embedder()
Method Detail |
---|
public Collection getAttributes()
getAttribute(java.lang.String)
public String getAttribute(String attribute)
getAttributes()
protected Writer getPageWriter()
protected OutputStream getImageOutputStream()
protected String getImagePath()
getImageOutputStream()
, it should use code
like:
getPageWriter().write("<img src='"+getImagePath()+"' />");
protected Collection getActionKeys()
ACTIONS
protected String getAction(String key, String action)
key
- a named item that might be added to the graph - eg "graph.series.MySeries"action
- the action, eg "href", "title" or "onmouseover". One of ACTIONS
public Graph getGraph()
public int getWidth()
public int getHeight()
public String getId()
protected static Paint getPaint(String val)
protected final Map getPageResources()
protected Font getFont(String fontname)
null
if it does not exist.
fontname
- the name of the font.
null
protected Set getFonts()
public String getForeignXML()
public abstract String getMIMEType()
getImageOutputStream()
public abstract void convert() throws IOException
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.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |