View Javadoc

1   package org.kuali.maven.plugins.graph.dot;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import org.kuali.maven.plugins.graph.pojo.Direction;
7   import org.kuali.maven.plugins.graph.pojo.Edge;
8   import org.kuali.maven.plugins.graph.pojo.Graph;
9   import org.kuali.maven.plugins.graph.pojo.GraphDecorator;
10  import org.kuali.maven.plugins.graph.pojo.GraphNode;
11  
12  public class GraphHelper {
13  
14      public Graph getGraph(String title) {
15          return getGraph(title, Direction.DEFAULT_DIRECTION, new ArrayList<GraphNode>(), new ArrayList<Edge>());
16      }
17  
18      public Graph getGraph(String title, List<GraphNode> nodes) {
19          return getGraph(title, Direction.DEFAULT_DIRECTION, nodes, new ArrayList<Edge>());
20      }
21  
22      public Graph getGraph(String title, Direction direction, List<GraphNode> nodes, List<Edge> edges) {
23          GraphDecorator decorator = new GraphDecorator();
24          decorator.setRankdir(direction.name());
25          decorator.setLabel(title);
26          Graph graph = new Graph();
27          graph.setGraphDecorator(decorator);
28          graph.setNodes(nodes);
29          graph.setEdges(edges);
30          return graph;
31      }
32  
33  }