com.google.inject.grapher.graphviz
Class GraphvizRenderer

java.lang.Object
  extended by com.google.inject.grapher.graphviz.GraphvizRenderer
All Implemented Interfaces:
NodeAliasFactory<String>, Renderer

public class GraphvizRenderer
extends Object
implements Renderer, NodeAliasFactory<String>

Renderer implementation that writes out a Graphviz DOT file of the graph. Bound in GraphvizModule.

Specify the PrintWriter to output to with setOut(PrintWriter).

Author:
phopkins@gmail.com (Pete Hopkins)

Constructor Summary
GraphvizRenderer()
           
 
Method Summary
 void addEdge(GraphvizEdge edge)
           
 void addNode(GraphvizNode node)
           
protected  void finish()
           
protected  String getArrowString(List<ArrowType> arrows)
          Turns a List of ArrowTypes into a String that represents combining them.
protected  Map<String,String> getEdgeAttributes(GraphvizEdge edge)
           
protected  String getEdgeEndPoint(String nodeId, String portId, CompassPoint compassPoint)
           
protected  Map<String,String> getGraphAttributes()
           
protected  Map<String,String> getNodeAttributes(GraphvizNode node)
           
protected  String getNodeLabel(GraphvizNode node)
          Creates the "label" for a node.
protected  String htmlEscape(String str)
           
 void newAlias(String fromId, String toId)
          Makes edges that would point to fromId point to toId instead.
 void render()
           
protected  void renderEdge(GraphvizEdge edge)
           
protected  void renderNode(GraphvizNode node)
           
protected  String resolveAlias(String id)
           
 GraphvizRenderer setOut(PrintWriter out)
           
 GraphvizRenderer setRankdir(String rankdir)
           
protected  void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphvizRenderer

public GraphvizRenderer()
Method Detail

setOut

public GraphvizRenderer setOut(PrintWriter out)

setRankdir

public GraphvizRenderer setRankdir(String rankdir)

addNode

public void addNode(GraphvizNode node)

addEdge

public void addEdge(GraphvizEdge edge)

newAlias

public void newAlias(String fromId,
                     String toId)
Description copied from interface: NodeAliasFactory
Makes edges that would point to fromId point to toId instead.

Specified by:
newAlias in interface NodeAliasFactory<String>

resolveAlias

protected String resolveAlias(String id)

render

public void render()
Specified by:
render in interface Renderer

getGraphAttributes

protected Map<String,String> getGraphAttributes()

start

protected void start()

finish

protected void finish()

renderNode

protected void renderNode(GraphvizNode node)

getNodeAttributes

protected Map<String,String> getNodeAttributes(GraphvizNode node)

getNodeLabel

protected String getNodeLabel(GraphvizNode node)
Creates the "label" for a node. This is a string of HTML that defines a table with a heading at the top and (in the case of ImplementationNodes) rows for each of the member fields.


renderEdge

protected void renderEdge(GraphvizEdge edge)

getEdgeAttributes

protected Map<String,String> getEdgeAttributes(GraphvizEdge edge)

getArrowString

protected String getArrowString(List<ArrowType> arrows)
Turns a List of ArrowTypes into a String that represents combining them. With Graphviz, that just means concatenating them.


getEdgeEndPoint

protected String getEdgeEndPoint(String nodeId,
                                 String portId,
                                 CompassPoint compassPoint)

htmlEscape

protected String htmlEscape(String str)


Copyright © 2006-2011 Google, Inc.. All Rights Reserved.