JGraph X 0.15.0.3


com.mxgraph.reader
Class mxGraphViewImageReader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.mxgraph.reader.mxGraphViewReader
          extended by com.mxgraph.reader.mxGraphViewImageReader
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class mxGraphViewImageReader
extends mxGraphViewReader

A converter that renders display XML data onto a graphics canvas.


Field Summary
protected  boolean antiAlias
          Specifies if the image should be anti-aliased.
protected  Color background
          Specifies the background color.
protected  int border
          Specifies the border which is added to the size of the graph.
 
Fields inherited from class com.mxgraph.reader.mxGraphViewReader
canvas, scale
 
Constructor Summary
mxGraphViewImageReader()
          Constructs a new reader with a transparent background.
mxGraphViewImageReader(Color background)
          Constructs a new reader with the given background color.
mxGraphViewImageReader(Color background, int border)
          Constructs a new reader with a transparent background.
mxGraphViewImageReader(Color background, int border, boolean antiAlias)
          Constructs a new reader with a transparent background.
 
Method Summary
static BufferedImage convert(InputSource inputSource)
          Creates the image for the given display XML input source.
static BufferedImage convert(String filename)
          Creates the image for the given display XML file.
 mxICanvas createCanvas(Hashtable attrs)
          Returns the canvas to be used for rendering.
 Color getBackground()
           
 int getBorder()
           
 boolean isAntiAlias()
           
 void setAntiAlias(boolean antiAlias)
           
 void setBackground(Color background)
           
 void setBorder(int border)
           
 
Methods inherited from class com.mxgraph.reader.mxGraphViewReader
drawEdge, drawLabel, drawVertex, getCanvas, parseElement, parsePoints, startElement
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

background

protected Color background
Specifies the background color. Default is null.


antiAlias

protected boolean antiAlias
Specifies if the image should be anti-aliased. Default is true.


border

protected int border
Specifies the border which is added to the size of the graph. Default is 0.

Constructor Detail

mxGraphViewImageReader

public mxGraphViewImageReader()
Constructs a new reader with a transparent background.


mxGraphViewImageReader

public mxGraphViewImageReader(Color background)
Constructs a new reader with the given background color.


mxGraphViewImageReader

public mxGraphViewImageReader(Color background,
                              int border)
Constructs a new reader with a transparent background.


mxGraphViewImageReader

public mxGraphViewImageReader(Color background,
                              int border,
                              boolean antiAlias)
Constructs a new reader with a transparent background.

Method Detail

setBackground

public void setBackground(Color background)

getBackground

public Color getBackground()

setBorder

public void setBorder(int border)

getBorder

public int getBorder()

setAntiAlias

public void setAntiAlias(boolean antiAlias)

isAntiAlias

public boolean isAntiAlias()

createCanvas

public mxICanvas createCanvas(Hashtable attrs)
Description copied from class: mxGraphViewReader
Returns the canvas to be used for rendering.

Specified by:
createCanvas in class mxGraphViewReader
Parameters:
attrs - Specifies the attributes of the new canvas.
Returns:
Returns a new canvas.

convert

public static BufferedImage convert(String filename)
                             throws ParserConfigurationException,
                                    SAXException,
                                    IOException
Creates the image for the given display XML file. (Note: The XML file is an encoded mxGraphView, not mxGraphModel.)

Parameters:
filename - Filename of the display XML file.
Returns:
Returns an image representing the display XML file.
Throws:
ParserConfigurationException
SAXException
IOException

convert

public static BufferedImage convert(InputSource inputSource)
                             throws ParserConfigurationException,
                                    SAXException,
                                    IOException
Creates the image for the given display XML input source. (Note: The XML is an encoded mxGraphView, not mxGraphModel.)

Parameters:
inputSource - Input source that contains the display XML.
Returns:
Returns an image representing the display XML input source.
Throws:
ParserConfigurationException
SAXException
IOException

JGraph X 0.15.0.3


Copyright (c) 2008 Gaudenz Alder. All rights reserved.