edu.uci.eecs.doc.cascade.tree
Class SVGTreeWriter

java.lang.Object
  extended by edu.uci.eecs.doc.cascade.tree.AbstractTreeWriter
      extended by edu.uci.eecs.doc.cascade.tree.SVGTreeWriter
All Implemented Interfaces:
TreeWriter
Direct Known Subclasses:
SVGTreeWriter

public class SVGTreeWriter
extends AbstractTreeWriter

Exports a control flow tree to Scalable Vector Graphics (SVG) format.

Author:
Trevor Harmon

Nested Class Summary
protected static class SVGTreeWriter.Color
           
 
Field Summary
protected static SVGTreeWriter.Color BLACK_COLOR
           
protected  boolean colorized
           
protected static SVGTreeWriter.Color IFTHENELSE_END_COLOR
           
protected static SVGTreeWriter.Color IFTHENELSE_START_COLOR
           
protected static int INDENT_SIZE
           
protected static int LEFT_MARGIN
           
protected static int LEFT_TEXT_MARGIN
           
protected static SVGTreeWriter.Color LOOP_END_COLOR
           
protected static SVGTreeWriter.Color LOOP_START_COLOR
           
protected static SVGTreeWriter.Color PSEUDONODE_END_COLOR
           
protected static SVGTreeWriter.Color PSEUDONODE_START_COLOR
           
protected static int RECTANGLE_CORNER_RADIUS
           
protected static String RECTANGLE_STYLE
           
protected static int RECTANGLE_VERTICAL_SPACING
           
protected static int RECTANGLE_WIDTH
           
protected static SVGTreeWriter.Color RETURN_END_COLOR
           
protected static SVGTreeWriter.Color RETURN_START_COLOR
           
protected static SVGTreeWriter.Color STATEMENT_END_COLOR
           
protected static SVGTreeWriter.Color STATEMENT_START_COLOR
           
protected static SVGTreeWriter.Color TEXT_COLOR
           
protected static int TEXT_HEIGHT
           
protected static SVGTreeWriter.Color TEXT_NEXT_LINE_COLOR
           
protected static int TEXT_NEXT_LINE_INDENT
           
protected static String TEXT_NEXT_LINE_STYLE
           
protected static String TEXT_STYLE
           
protected static int TOP_MARGIN
           
protected static int TOP_TEXT_MARGIN
           
 
Fields inherited from class edu.uci.eecs.doc.cascade.tree.AbstractTreeWriter
showInstructions, trees
 
Constructor Summary
SVGTreeWriter(List<Tree> trees)
          Creates a new SVGTreeWriter object for the given control flow trees.
SVGTreeWriter(List<Tree> trees, boolean colorized)
          Creates a new SVGTreeWriter object for the given control flow trees.
SVGTreeWriter(Tree tree)
          Creates a new SVGTreeWriter object for the given control flow tree.
SVGTreeWriter(Tree tree, boolean colorized)
          Creates a new SVGTreeWriter object for the given control flow tree.
 
Method Summary
 org.w3c.dom.svg.SVGDocument getDocument()
          Returns an XML document interface representing the entire SVG tree.
 void write(Writer out)
          Exports the control flow tree to the specified output stream.
protected  int writeRect(Node node, int scope, int y, SVGTreeWriter.Color startColor, SVGTreeWriter.Color endColor, org.w3c.dom.svg.SVGDocument doc, Element root)
           
 
Methods inherited from class edu.uci.eecs.doc.cascade.tree.AbstractTreeWriter
setShowInstructions, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_MARGIN

protected static final int LEFT_MARGIN
See Also:
Constant Field Values

TOP_MARGIN

protected static final int TOP_MARGIN
See Also:
Constant Field Values

RECTANGLE_WIDTH

protected static final int RECTANGLE_WIDTH
See Also:
Constant Field Values

INDENT_SIZE

protected static final int INDENT_SIZE
See Also:
Constant Field Values

RECTANGLE_VERTICAL_SPACING

protected static final int RECTANGLE_VERTICAL_SPACING
See Also:
Constant Field Values

RECTANGLE_CORNER_RADIUS

protected static final int RECTANGLE_CORNER_RADIUS
See Also:
Constant Field Values

RECTANGLE_STYLE

protected static final String RECTANGLE_STYLE
See Also:
Constant Field Values

STATEMENT_START_COLOR

protected static final SVGTreeWriter.Color STATEMENT_START_COLOR

STATEMENT_END_COLOR

protected static final SVGTreeWriter.Color STATEMENT_END_COLOR

RETURN_START_COLOR

protected static final SVGTreeWriter.Color RETURN_START_COLOR

RETURN_END_COLOR

protected static final SVGTreeWriter.Color RETURN_END_COLOR

PSEUDONODE_START_COLOR

protected static final SVGTreeWriter.Color PSEUDONODE_START_COLOR

PSEUDONODE_END_COLOR

protected static final SVGTreeWriter.Color PSEUDONODE_END_COLOR

LOOP_START_COLOR

protected static final SVGTreeWriter.Color LOOP_START_COLOR

LOOP_END_COLOR

protected static final SVGTreeWriter.Color LOOP_END_COLOR

IFTHENELSE_START_COLOR

protected static final SVGTreeWriter.Color IFTHENELSE_START_COLOR

IFTHENELSE_END_COLOR

protected static final SVGTreeWriter.Color IFTHENELSE_END_COLOR

TEXT_COLOR

protected static final SVGTreeWriter.Color TEXT_COLOR

TEXT_STYLE

protected static final String TEXT_STYLE
See Also:
Constant Field Values

LEFT_TEXT_MARGIN

protected static final int LEFT_TEXT_MARGIN
See Also:
Constant Field Values

TOP_TEXT_MARGIN

protected static final int TOP_TEXT_MARGIN
See Also:
Constant Field Values

TEXT_HEIGHT

protected static final int TEXT_HEIGHT
See Also:
Constant Field Values

TEXT_NEXT_LINE_INDENT

protected static final int TEXT_NEXT_LINE_INDENT
See Also:
Constant Field Values

TEXT_NEXT_LINE_STYLE

protected static final String TEXT_NEXT_LINE_STYLE
See Also:
Constant Field Values

TEXT_NEXT_LINE_COLOR

protected static final SVGTreeWriter.Color TEXT_NEXT_LINE_COLOR

BLACK_COLOR

protected static final SVGTreeWriter.Color BLACK_COLOR

colorized

protected final boolean colorized
Constructor Detail

SVGTreeWriter

public SVGTreeWriter(Tree tree)
Creates a new SVGTreeWriter object for the given control flow tree. The control nodes will be adorned with color coding and drop shadows.

Parameters:
tree - the control flow tree to be exported

SVGTreeWriter

public SVGTreeWriter(Tree tree,
                     boolean colorized)
Creates a new SVGTreeWriter object for the given control flow tree.

Parameters:
tree - the control flow tree to be exported
colorized - if true, the control nodes are adorned with color coding and drop shadows; black and white otherwise

SVGTreeWriter

public SVGTreeWriter(List<Tree> trees)
Creates a new SVGTreeWriter object for the given control flow trees. The control nodes will be adorned with color coding and drop shadows.

Parameters:
trees - the control flow trees to be exported

SVGTreeWriter

public SVGTreeWriter(List<Tree> trees,
                     boolean colorized)
Creates a new SVGTreeWriter object for the given control flow trees.

Parameters:
trees - the control flow trees to be exported
colorized - if true, the control nodes are adorned with color coding and drop shadows; black and white otherwise
Method Detail

write

public void write(Writer out)
           throws IOException
Exports the control flow tree to the specified output stream.

Specified by:
write in interface TreeWriter
Specified by:
write in class AbstractTreeWriter
Parameters:
out - an output stream in which to save the tree
Throws:
IOException - if the tree cannot be written to the stream

getDocument

public org.w3c.dom.svg.SVGDocument getDocument()
Returns an XML document interface representing the entire SVG tree.

Returns:
a W3C Document Object Model document

writeRect

protected int writeRect(Node node,
                        int scope,
                        int y,
                        SVGTreeWriter.Color startColor,
                        SVGTreeWriter.Color endColor,
                        org.w3c.dom.svg.SVGDocument doc,
                        Element root)