net.kwfgrid.gwui.graphviz
Class LayoutBuilder

java.lang.Object
  extended by net.kwfgrid.gwui.graphviz.LayoutBuilder
All Implemented Interfaces:
DOTParserVisitor

public class LayoutBuilder
extends java.lang.Object
implements DOTParserVisitor

Very basic implementation of a layout builder. This is the counterpart of WorkflowGraph2DOTConverter and the LayoutBuilder does only support the features which are required for a dot file which has been generated with WorkflowGraph2DOTConverter and then attributed by graphviz' dot layouter.


Field Summary
static int DPI
          The screen resolution.
 
Constructor Summary
LayoutBuilder()
           
 
Method Summary
protected  java.lang.String edgeID(java.lang.String fromnodeid, java.lang.String tonodeid)
          Create an edge ID from two node ids.
 java.awt.Point[] getEdgeControlPoints(java.lang.String fromnodeid, java.lang.String tonodeid)
          Get the control points of an edge.
 java.awt.Point getEdgeLabelPosition(java.lang.String fromnodeid, java.lang.String tonodeid)
          Get the position of an edge's label.
 java.awt.Point getEdgePointOfArrowAtEnd(java.lang.String fromnodeid, java.lang.String tonodeid)
          Get the point of the arrow at the edge's tail.
 java.awt.Point getEdgePointOfArrowAtStart(java.lang.String fromnodeid, java.lang.String tonodeid)
          Get the point of the arrow at the edge's head.(null if the edge does not have an arrow at it's head.)
 java.awt.Rectangle getGraphBoundingBox()
          Get the bounding box of the graph.
 java.awt.Point getNodePosition(java.lang.String nodeid)
          Get the pixel position of a node.
 boolean hasEdgeArrowAtEnd(java.lang.String fromnodeid, java.lang.String tonodeid)
          Check if the edge has an arrow at it's tail.
 boolean hasEdgeArrowAtStart(java.lang.String fromnodeid, java.lang.String tonodeid)
          Check if the edge has an arrow at it's head.
 java.lang.Object visit(ASTa_list node, java.lang.Object data)
           
 java.lang.Object visit(ASTattr_list node, java.lang.Object data)
           
 java.lang.Object visit(ASTattr_stmt node, java.lang.Object data)
          Ignored.
 java.lang.Object visit(ASTcompass_pt node, java.lang.Object data)
           
 java.lang.Object visit(ASTedge_stmt node, java.lang.Object data)
           
 java.lang.Object visit(ASTedgeop node, java.lang.Object data)
           
 java.lang.Object visit(ASTedgeRHS node, java.lang.Object data)
           
 java.lang.Object visit(ASTgraph node, java.lang.Object data)
           
 java.lang.Object visit(ASTideq_stmt node, java.lang.Object data)
          Ignored.
 java.lang.Object visit(ASTnode_id node, java.lang.Object data)
           
 java.lang.Object visit(ASTnode_stmt node, java.lang.Object data)
           
 java.lang.Object visit(ASTport node, java.lang.Object data)
           
 java.lang.Object visit(ASTstmt_list node, java.lang.Object data)
          Ignored.
 java.lang.Object visit(ASTstmt node, java.lang.Object data)
          Ignored.
 java.lang.Object visit(ASTsubgraph node, java.lang.Object data)
           
 java.lang.Object visit(SimpleNode node, java.lang.Object data)
          Ignored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DPI

public static final int DPI
The screen resolution.

See Also:
Constant Field Values
Constructor Detail

LayoutBuilder

public LayoutBuilder()
Method Detail

edgeID

protected java.lang.String edgeID(java.lang.String fromnodeid,
                                  java.lang.String tonodeid)
Create an edge ID from two node ids.


visit

public java.lang.Object visit(SimpleNode node,
                              java.lang.Object data)
Ignored.

Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTgraph node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTstmt_list node,
                              java.lang.Object data)
Ignored.

Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTstmt node,
                              java.lang.Object data)
Ignored.

Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTideq_stmt node,
                              java.lang.Object data)
Ignored.

Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTattr_stmt node,
                              java.lang.Object data)
Ignored.

Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTnode_stmt node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTnode_id node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTport node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTcompass_pt node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTedge_stmt node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTsubgraph node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTedgeRHS node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTedgeop node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTattr_list node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

visit

public java.lang.Object visit(ASTa_list node,
                              java.lang.Object data)
Specified by:
visit in interface DOTParserVisitor
Returns:
null.

getNodePosition

public java.awt.Point getNodePosition(java.lang.String nodeid)
Get the pixel position of a node.


getGraphBoundingBox

public java.awt.Rectangle getGraphBoundingBox()
Get the bounding box of the graph.


getEdgeControlPoints

public java.awt.Point[] getEdgeControlPoints(java.lang.String fromnodeid,
                                             java.lang.String tonodeid)
Get the control points of an edge.

Parameters:
fromnodeid - The id of the from-node of the edge.
tonodeid - The id of the to-node of the edge.

getEdgePointOfArrowAtStart

public java.awt.Point getEdgePointOfArrowAtStart(java.lang.String fromnodeid,
                                                 java.lang.String tonodeid)
Get the point of the arrow at the edge's head.(null if the edge does not have an arrow at it's head.)

Parameters:
fromnodeid - The id of the from-node of the edge.
tonodeid - The id of the to-node of the edge.

getEdgePointOfArrowAtEnd

public java.awt.Point getEdgePointOfArrowAtEnd(java.lang.String fromnodeid,
                                               java.lang.String tonodeid)
Get the point of the arrow at the edge's tail. (null if the edge does not have an arrow at it's tail.)

Parameters:
fromnodeid - The id of the from-node of the edge.
tonodeid - The id of the to-node of the edge.

hasEdgeArrowAtStart

public boolean hasEdgeArrowAtStart(java.lang.String fromnodeid,
                                   java.lang.String tonodeid)
Check if the edge has an arrow at it's head.

Parameters:
fromnodeid - The id of the from-node of the edge.
tonodeid - The id of the to-node of the edge.

hasEdgeArrowAtEnd

public boolean hasEdgeArrowAtEnd(java.lang.String fromnodeid,
                                 java.lang.String tonodeid)
Check if the edge has an arrow at it's tail.

Parameters:
fromnodeid - The id of the from-node of the edge.
tonodeid - The id of the to-node of the edge.

getEdgeLabelPosition

public java.awt.Point getEdgeLabelPosition(java.lang.String fromnodeid,
                                           java.lang.String tonodeid)
Get the position of an edge's label.

Parameters:
fromnodeid - The id of the from-node of the edge.
tonodeid - The id of the to-node of the edge.


Copyright © 2005-2010 The K-Wf Grid Consortium. All Rights Reserved.