public DagreD3JSHtmlWriter(Graph graph) { this.writer = new GraphlibWriter(graph, GraphvizType.DIGRAPH, GraphvizDirection.TOP_TO_BOTTOM, "g", "qualifiedName"); }
@Override public void writeGraph(OutputStream os) throws IOException { IOUtils.write(GraphvizConstants.METHOD_OPEN, os); final String tag = StringUtils.replaceEach(GraphvizConstants.CONSTRUCTOR_STATEMENT, new String[] {"%NAME", "%TYPE"} , new String[] {graphVariableName, type.getName()}); IOUtils.write(tag, os); writeGraphNodes(os); writeGraphEdges(os); IOUtils.write(GraphvizConstants.GRAPH_RENDERER, os); IOUtils.write(StringUtils.replace(GraphvizConstants.GRAPH_LAYOUT, "%DIRECTION", direction.getDirection()), os); IOUtils.write(StringUtils.replace(GraphvizConstants.GRAPH_RENDERER_RUN, "%NAME", graphVariableName), os); IOUtils.write(GraphvizConstants.METHOD_CLOSE, os); }
private void writeGraphEdges(OutputStream os) throws IOException { for(Edge edge : graph.getEdges()) { String id = ""+edge.getId().hashCode(); String source = ""+edge.getVertex(Direction.IN).getId().hashCode(); String target = ""+edge.getVertex(Direction.OUT).getId().hashCode(); String label = ""+edge.getLabel(); writeGraphEdge(id, source, target, label, os); } }
private void writeGraphNodes(OutputStream os) throws IOException { //iterate the nodes. for(Vertex vertex : graph.getVertices()) { String id = ""+vertex.getId().hashCode(); String label = vertex.getProperty(vertexLabelProperty); Set<String> clzSet = new HashSet<String>(); Boolean blacklist = (Boolean)vertex.getProperty("blacklist"); if(blacklist != null && blacklist) { clzSet.add("blacklisted"); } if(StringUtils.isBlank(label)) { label = vertex.toString(); } writeGraphNode(id, label, clzSet, os); } } }
@Override public void writeGraph(OutputStream os) throws IOException { IOUtils.write(GraphvizConstants.METHOD_OPEN, os); final String tag = StringUtils.replaceEach(GraphvizConstants.CONSTRUCTOR_STATEMENT, new String[] {"%NAME", "%TYPE"} , new String[] {graphVariableName, type.getName()}); IOUtils.write(tag, os); writeGraphNodes(os); writeGraphEdges(os); IOUtils.write(GraphvizConstants.GRAPH_RENDERER, os); IOUtils.write(StringUtils.replace(GraphvizConstants.GRAPH_LAYOUT, "%DIRECTION", direction.getDirection()), os); IOUtils.write(StringUtils.replace(GraphvizConstants.GRAPH_RENDERER_RUN, "%NAME", graphVariableName), os); IOUtils.write(GraphvizConstants.METHOD_CLOSE, os); }
private void writeGraphEdges(OutputStream os) throws IOException { for(Edge edge : graph.getEdges()) { String id = ""+edge.getId().hashCode(); String source = ""+edge.getVertex(Direction.IN).getId().hashCode(); String target = ""+edge.getVertex(Direction.OUT).getId().hashCode(); String label = ""+edge.getLabel(); writeGraphEdge(id, source, target, label, os); } }
private void writeGraphNodes(OutputStream os) throws IOException { //iterate the nodes. for(Vertex vertex : graph.getVertices()) { String id = ""+vertex.getId().hashCode(); String label = vertex.getProperty(vertexLabelProperty); Set<String> clzSet = new HashSet<String>(); Boolean blacklist = (Boolean)vertex.getProperty("blacklist"); if(blacklist != null && blacklist) { clzSet.add("blacklisted"); } if(StringUtils.isBlank(label)) { label = vertex.toString(); } writeGraphNode(id, label, clzSet, os); } } }
public DagreD3JSHtmlWriter(Graph graph) { this.writer = new GraphlibWriter(graph, GraphvizType.DIGRAPH, GraphvizDirection.TOP_TO_BOTTOM, "g", "qualifiedName"); }