mxGraphViewImageReader (JGraph X 2.1.0.7 API Specification)
Date: 2013-07-31

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph X 2.1.0.7
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mxgraph.reader
Class mxGraphViewImageReader

    java.lang.Object
      org.xml.sax.helpers.DefaultHandler
          com.mxgraph.reader.mxGraphViewReader
              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. This reader can only be used to generate images for encoded graph views.

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.
`protected mxRectangle` | `clip` Defines the clip to be drawn.
`protected boolean` | `cropping` Specifies the border which is added to the size of the graph.

Fields inherited from class com.mxgraph.reader.mxGraphViewReader
`canvas, htmlLabels, 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.
`mxGraphViewImageReader(Color background, int border, boolean antiAlias, boolean cropping)` Constructs a new reader with a transparent background.

Method Summary
`static BufferedImage` | `convert(InputSource inputSource, mxGraphViewImageReader viewReader)` Creates the image for the given display XML input source.
`static BufferedImage` | `convert(String filename, mxGraphViewImageReader viewReader)` Creates the image for the given display XML file.
`mxICanvas` | `createCanvas(Map<String,Object> attrs)` Returns the canvas to be used for rendering.
`protected mxGraphics2DCanvas` | `createGraphicsCanvas()` Hook that creates the graphics canvas.
`Color` | `getBackground()`
`int` | `getBorder()`
`mxRectangle` | `getClip()`
`boolean` | `isAntiAlias()`
`boolean` | `isCropping()` Specifies the optional clipping rectangle.
`void` | `setAntiAlias(boolean antiAlias)`
`void` | `setBackground(Color background)`
`void` | `setBorder(int border)`
`void` | `setClip(mxRectangle value)`
`void` | `setCropping(boolean value)`

Methods inherited from class com.mxgraph.reader.mxGraphViewReader
`getCanvas, isHtmlLabels, parseElement, parsePoints, parseState, setHtmlLabels, 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.

### cropping

    protected boolean cropping

  Specifies the border which is added to the size of the graph. Default is true.

### clip

    protected mxRectangle clip

  Defines the clip to be drawn. Default is null.

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.

### mxGraphViewImageReader

    public mxGraphViewImageReader(Color background,
                                  int border,
                                  boolean antiAlias,
                                  boolean cropping)

  Constructs a new reader with a transparent background.

Method Detail

### getBackground

    public Color getBackground()

### setBackground

    public void setBackground(Color background)

### getBorder

    public int getBorder()

### setBorder

    public void setBorder(int border)

### isAntiAlias

    public boolean isAntiAlias()

### setAntiAlias

    public void setAntiAlias(boolean antiAlias)

### isCropping

    public boolean isCropping()

  Specifies the optional clipping rectangle.

### setCropping

    public void setCropping(boolean value)

### getClip

    public mxRectangle getClip()

### setClip

    public void setClip(mxRectangle value)

### createCanvas

    public mxICanvas createCanvas(Map<String,Object> 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.

### createGraphicsCanvas

    protected mxGraphics2DCanvas createGraphicsCanvas()

  Hook that creates the graphics canvas.

### convert

    public static BufferedImage convert(String filename,
                                        mxGraphViewImageReader viewReader)
                                 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,
                                        mxGraphViewImageReader viewReader)
                                 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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph X 2.1.0.7
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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