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
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
FieldsModifier and TypeFieldDescriptionprotected booleanSpecifies if the image should be anti-aliased.protected ColorSpecifies the background color.protected intSpecifies the border which is added to the size of the graph.protected mxRectangleDefines the clip to be drawn.protected booleanSpecifies the border which is added to the size of the graph.Fields inherited from class mxGraphViewReader
canvas, htmlLabels, scale -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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
Modifier and TypeMethodDescriptionstatic BufferedImageconvert(String filename, mxGraphViewImageReader viewReader) Creates the image for the given display XML file.static BufferedImageconvert(InputSource inputSource, mxGraphViewImageReader viewReader) Creates the image for the given display XML input source.createCanvas(Map<String, Object> attrs) Returns the canvas to be used for rendering.protected mxGraphics2DCanvasHook that creates the graphics canvas.intgetClip()booleanbooleanSpecifies the optional clipping rectangle.voidsetAntiAlias(boolean antiAlias) voidsetBackground(Color background) voidsetBorder(int border) voidsetClip(mxRectangle value) voidsetCropping(boolean value) Methods inherited from class mxGraphViewReader
getCanvas, isHtmlLabels, parseElement, parsePoints, parseState, setHtmlLabels, startElementMethods inherited from class DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Field Details
-
background
Specifies the background color. Default is null. -
antiAlias
protected boolean antiAliasSpecifies if the image should be anti-aliased. Default is true. -
border
protected int borderSpecifies the border which is added to the size of the graph. Default is 0. -
cropping
protected boolean croppingSpecifies the border which is added to the size of the graph. Default is true. -
clip
Defines the clip to be drawn. Default is null.
-
-
Constructor Details
-
mxGraphViewImageReader
public mxGraphViewImageReader()Constructs a new reader with a transparent background. -
mxGraphViewImageReader
Constructs a new reader with the given background color. -
mxGraphViewImageReader
Constructs a new reader with a transparent background. -
mxGraphViewImageReader
Constructs a new reader with a transparent background. -
mxGraphViewImageReader
Constructs a new reader with a transparent background.
-
-
Method Details
-
getBackground
-
setBackground
-
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
-
setClip
-
createCanvas
Description copied from class:mxGraphViewReaderReturns the canvas to be used for rendering.- Specified by:
createCanvasin classmxGraphViewReader- Parameters:
attrs- Specifies the attributes of the new canvas.- Returns:
- Returns a new canvas.
-
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:
ParserConfigurationExceptionSAXExceptionIOException
-
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:
ParserConfigurationExceptionSAXExceptionIOException
-