JGraph X 1.2.0.8


com.mxgraph.reader
Class mxGraphViewReader

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

public abstract class mxGraphViewReader
extends DefaultHandler

An abstract converter that renders display XML data onto a canvas.


Field Summary
protected  mxICanvas canvas
          Holds the canvas to be used for rendering the graph.
protected  boolean htmlLabels
          Specifies if labels should be rendered as HTML markup.
protected  double scale
          Holds the global scale of the graph.
 
Constructor Summary
mxGraphViewReader()
           
 
Method Summary
abstract  mxICanvas createCanvas(Map<String,Object> attrs)
          Returns the canvas to be used for rendering.
 void drawEdge(Map<String,Object> attrs)
          Draws the specified edge using the canvas.
 void drawLabel(boolean isEdge, Map<String,Object> attrs)
          Draws the specified label using the canvas.
 void drawVertex(Map<String,Object> attrs)
          Draws the specified vertex using the canvas.
 mxICanvas getCanvas()
          Returns the canvas that is used for rendering the graph.
 boolean isHtmlLabels()
          Returns the htmlLabels switch.
 void parseElement(String tagName, Map<String,Object> attrs)
          Parses the given element and paints it onto the canvas.
static List<mxPoint> parsePoints(String pts)
          Parses the list of points into an object-oriented representation.
 void setHtmlLabels(boolean value)
          Sets the htmlLabels switch.
 void startElement(String uri, String localName, String qName, Attributes atts)
           
 
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

canvas

protected mxICanvas canvas
Holds the canvas to be used for rendering the graph.


scale

protected double scale
Holds the global scale of the graph. This is set just before createCanvas is called.


htmlLabels

protected boolean htmlLabels
Specifies if labels should be rendered as HTML markup.

Constructor Detail

mxGraphViewReader

public mxGraphViewReader()
Method Detail

setHtmlLabels

public void setHtmlLabels(boolean value)
Sets the htmlLabels switch.


isHtmlLabels

public boolean isHtmlLabels()
Returns the htmlLabels switch.


createCanvas

public abstract mxICanvas createCanvas(Map<String,Object> attrs)
Returns the canvas to be used for rendering.

Parameters:
attrs - Specifies the attributes of the new canvas.
Returns:
Returns a new canvas.

getCanvas

public mxICanvas getCanvas()
Returns the canvas that is used for rendering the graph.

Returns:
Returns the canvas.

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException

parseElement

public void parseElement(String tagName,
                         Map<String,Object> attrs)
Parses the given element and paints it onto the canvas.

Parameters:
tagName - Name of the node to be parsed.
attrs - Attributes of the node to be parsed.

drawVertex

public void drawVertex(Map<String,Object> attrs)
Draws the specified vertex using the canvas.

Parameters:
attrs - Specifies the attributes of the vertex.

drawEdge

public void drawEdge(Map<String,Object> attrs)
Draws the specified edge using the canvas.

Parameters:
attrs - Specifies the attribute of the edge.

drawLabel

public void drawLabel(boolean isEdge,
                      Map<String,Object> attrs)
Draws the specified label using the canvas.

Parameters:
attrs - Specifies the attributes of the label.

parsePoints

public static List<mxPoint> parsePoints(String pts)
Parses the list of points into an object-oriented representation.

Parameters:
pts - String containing a list of points.
Returns:
Returns the points as a list of mxPoints.

JGraph X 1.2.0.8


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