Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.ui.util.graph
Class OffscreenGraph

java.lang.Object
  extended by eu.esdihumboldt.hale.ui.util.graph.OffscreenGraph

public abstract class OffscreenGraph
extends Object

Renders a graph to an image.

Author:
Simon Templer

Constructor Summary
OffscreenGraph(int width, int height)
          Create an off-screen graph.
 
Method Summary
protected abstract  void configureViewer(org.eclipse.zest.core.viewers.GraphViewer viewer)
          Configure the viewer.
 void dispose()
          Dispose the off-screen graph shell.
 org.eclipse.zest.core.widgets.Graph getGraph()
           
 void resize(int width, int height)
          Resize the off-screen graph.
static void saveDot(org.eclipse.zest.core.widgets.Graph graph, OutputStream out)
          Save a graph in the dot format to an output stream.
static void saveImage(org.eclipse.draw2d.IFigure root, OutputStream out, String format)
          Save a figure as image to an output stream.
 void saveImage(OutputStream out, String format)
          Save the graph as image to an output stream.
static void saveSVG(org.eclipse.draw2d.IFigure root, OutputStream out)
          Save a figure as Scalable Vector Graphics to an output stream.
 void saveSVG(OutputStream out)
          Save the graph as Scalable Vector Graphics to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OffscreenGraph

public OffscreenGraph(int width,
                      int height)
Create an off-screen graph.

Parameters:
width - the graph width
height - the graph height
Method Detail

getGraph

public org.eclipse.zest.core.widgets.Graph getGraph()
Returns:
the graph

resize

public void resize(int width,
                   int height)
Resize the off-screen graph.

Parameters:
width - the graph width
height - the graph height

dispose

public void dispose()
Dispose the off-screen graph shell.

See Also:
Shell.dispose()

configureViewer

protected abstract void configureViewer(org.eclipse.zest.core.viewers.GraphViewer viewer)
Configure the viewer.

Parameters:
viewer - the graph viewer

saveImage

public void saveImage(OutputStream out,
                      String format)
               throws IOException
Save the graph as image to an output stream.

Parameters:
out - the output stream to write the image to (which is closed after writing)
format - the informal name of the image format, if null defaults to png
Throws:
IOException - if writing the image fails
See Also:
ImageIO.write(java.awt.image.RenderedImage, String, OutputStream)

saveSVG

public void saveSVG(OutputStream out)
             throws IOException,
                    TransformerFactoryConfigurationError,
                    TransformerException
Save the graph as Scalable Vector Graphics to an output stream.

Parameters:
out - the output stream to write the SVG DOM to (which is closed after writing)
Throws:
IOException - if writing to the output stream fails
TransformerFactoryConfigurationError - if creating the transformer fails
TransformerException - if writing the document fails

saveImage

public static void saveImage(org.eclipse.draw2d.IFigure root,
                             OutputStream out,
                             String format)
                      throws IOException
Save a figure as image to an output stream.

Parameters:
root - the figure to draw
out - the output stream to write the image to (which is closed after writing)
format - the informal name of the image format, if null defaults to png
Throws:
IOException - if writing the image fails
See Also:
ImageIO.write(java.awt.image.RenderedImage, String, OutputStream)

saveSVG

public static void saveSVG(org.eclipse.draw2d.IFigure root,
                           OutputStream out)
                    throws IOException,
                           TransformerFactoryConfigurationError,
                           TransformerException
Save a figure as Scalable Vector Graphics to an output stream.

Parameters:
root - the figure to draw
out - the output stream to write the SVG DOM to (which is closed after writing)
Throws:
IOException - if writing to the output stream fails
TransformerFactoryConfigurationError - if creating the transformer fails
TransformerException - if writing the document fails

saveDot

public static void saveDot(org.eclipse.zest.core.widgets.Graph graph,
                           OutputStream out)
                    throws IOException
Save a graph in the dot format to an output stream.

Parameters:
graph - the graph
out - the output stream (which is closed after writing)
Throws:
IOException - if writing to the output stream fails

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d