yext.svg.io
Class SVGGraph2DRenderer

java.lang.Object
  extended by y.view.DefaultGraph2DRenderer
      extended by yext.svg.io.SVGGraph2DRenderer
All Implemented Interfaces:
Graph2DRenderer, OrderRenderer
Direct Known Subclasses:
SVGDOMEnhancer

public class SVGGraph2DRenderer
extends DefaultGraph2DRenderer

A special Graph2DRenderer that can be subclassed to enhance the SVG output of SVGIOHandler.

See Also:
SVGIOHandler.setSVGGraph2DRenderer(SVGGraph2DRenderer)
 

Constructor Summary
SVGGraph2DRenderer()
          Creates a new instance of SVGGraph2DRenderer
 
Method Summary
protected  void addToSVGDefinition(Element element)
          Adds a DOM element to to the definition block of the SVG document.
protected  CDATASection createCDATASection(String content)
          Creates a character data section that can be added to the SVG document.
protected  Element createElement(String tag)
          Creates a DOM element with the given name that can be added to the SVG document.
protected  Document getSVGDocument()
          Returns the document that is used as factory for the nodes in the DOM tree of the SVG that is generated by the renderer's associated SVGIOHandler.
protected  SVGIOHandler getSVGIOHandler()
          Returns the SVGIOHandler this renderer is working with.
protected  Element getTopLevelGroup()
          Returns the top level group element of the SVG document to which graphical representation of nodes and edges will be added.
protected  void insertNodeAbove(Node toBeInsertedNode, Node refNode)
          Adds a DOM node to the SVG document.
protected  void insertNodeBelow(Node toBeInsertedNode, Node refNode)
          Adds a DOM node to the SVG document.
 void paint(Graphics2D gfx, EdgeRealizer r)
           
 void paint(Graphics2D gfx, NodeRealizer r)
           
 void paintSloppy(Graphics2D gfx, EdgeRealizer r)
           
 void paintSloppy(Graphics2D gfx, NodeRealizer r)
           
 void setSVGIOHandler(SVGIOHandler ioh)
          Sets the SVGIOHandler this renderer is working with.
protected  void setTopLevelGroup(Element element)
          Sets the top level group element of the SVG document to which graphical representation of nodes and edges will be added.
protected  void writeDocument(Node svgDocument, Writer writer)
           
 
Methods inherited from class y.view.DefaultGraph2DRenderer
beginLayerPainting, endLayerPainting, getBridgeCalculator, getBridgeCalculator, getClipEnlargementValue, getDrawEdgesFirst, getEdgeLock, getGlobalLock, getLayer, getLayer, getNodeLock, getPaintOrder, getSloppyPaintOrder, intersects, intersects, isDrawSelectionOnTop, isHierarchicSloppyPaintOrderEnabled, isLayeredPainting, isNestedEdgeDrawingOrderEnabled, isSloppyNestedEdgeDrawingOrderEnabled, isSynchronizationEnabled, paint, paintLayered, paintLayered, paintSloppy, paintSloppyLayered, paintSloppyLayered, prepareBridgeCalculator, setBridgeCalculator, setClipEnlargementValue, setDrawEdgesFirst, setDrawSelectionOnTop, setGlobalLock, setHierarchicSloppyPaintOrderEnabled, setLayeredPainting, setNestedEdgeDrawingOrderEnabled, setSloppyNestedEdgeDrawingOrderEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGGraph2DRenderer

public SVGGraph2DRenderer()
Creates a new instance of SVGGraph2DRenderer

Method Detail

setSVGIOHandler

public void setSVGIOHandler(SVGIOHandler ioh)
Sets the SVGIOHandler this renderer is working with. This method will be used by SVGIOHandler to make itself known to this class.


getSVGIOHandler

protected SVGIOHandler getSVGIOHandler()
Returns the SVGIOHandler this renderer is working with.


getSVGDocument

protected Document getSVGDocument()
Returns the document that is used as factory for the nodes in the DOM tree of the SVG that is generated by the renderer's associated SVGIOHandler.

Note: Adding nodes to this document will have no effect regarding the SVG that is generated by the renderer's associated SVGIOHandler.


getTopLevelGroup

protected Element getTopLevelGroup()
Returns the top level group element of the SVG document to which graphical representation of nodes and edges will be added.


setTopLevelGroup

protected void setTopLevelGroup(Element element)
Sets the top level group element of the SVG document to which graphical representation of nodes and edges will be added.


createElement

protected Element createElement(String tag)
Creates a DOM element with the given name that can be added to the SVG document.

To create a hyperlink element <a> one would use as argument the string "a".


createCDATASection

protected CDATASection createCDATASection(String content)
Creates a character data section that can be added to the SVG document. CDATA sections must be used to embed javascript functions in the SVG document.


insertNodeAbove

protected void insertNodeAbove(Node toBeInsertedNode,
                               Node refNode)
Adds a DOM node to the SVG document. The node will be inserted above refNode, i.e. the node becomes the parent of refNode and the former parent of refNode will become the parent of the to-be-inserted node.


insertNodeBelow

protected void insertNodeBelow(Node toBeInsertedNode,
                               Node refNode)
Adds a DOM node to the SVG document. The node will be inserted below refNode, i.e. refNode will become the parent of the inserted node and all children of refNode will become children of the to-be-inserted node.


addToSVGDefinition

protected void addToSVGDefinition(Element element)
Adds a DOM element to to the definition block of the SVG document. The definition block is the right place for javascript definitions and other global stuff.


writeDocument

protected void writeDocument(Node svgDocument,
                             Writer writer)
                      throws IOException
Throws:
IOException

paint

public void paint(Graphics2D gfx,
                  NodeRealizer r)
Overrides:
paint in class DefaultGraph2DRenderer

paintSloppy

public void paintSloppy(Graphics2D gfx,
                        NodeRealizer r)
Overrides:
paintSloppy in class DefaultGraph2DRenderer

paint

public void paint(Graphics2D gfx,
                  EdgeRealizer r)
Overrides:
paint in class DefaultGraph2DRenderer

paintSloppy

public void paintSloppy(Graphics2D gfx,
                        EdgeRealizer r)
Overrides:
paintSloppy in class DefaultGraph2DRenderer


© Copyright 2002-2015,
yWorks GmbH.
All rights reserved.