congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.jboss.windup.graph.renderer.dot
Code IndexAdd Tabnine to your IDE (free)

How to use org.jboss.windup.graph.renderer.dot

Best Java code snippets using org.jboss.windup.graph.renderer.dot (Showing top 20 results out of 315)

origin: org.jboss.windup/windup-grapher

@Override
public void writeGraph(OutputStream os) throws IOException {
  writeDot(os);
}

origin: org.jboss.windup/windup-grapher

public VizJSHtmlWriter(Graph graph) {
  this.writer = new DotWriter(graph, "G", "qualifiedName", DotGraphType.DIGRAPH, "8pt");
}
origin: org.jboss.windup.legacy.application/grapher

private void writeDot(OutputStream os) throws IOException {
  writeGraphTag(os);
}

origin: org.jboss.windup/windup-grapher

private void writeGraphTag(OutputStream os) throws IOException {
  String name = this.getDotSafeName(graphName);
  IOUtils.write(graphType.getName()+" "+name+"{" + DotConstants.NL, os);
  
  writeGraphNodes(os);
  writeGraphEdges(os);
  
  IOUtils.write("}", os);
}
origin: org.jboss.windup/windup-grapher

private void writeGraphEdge(String label, String source, String target, OutputStream os) throws IOException {
  final String startTag = getDotSafeName(source) + graphType.getEdge() + getDotSafeName(target);
  final String endTag = DotConstants.END_LINE;
  
  IOUtils.write(startTag, os);
  
  if(StringUtils.isNotBlank(label)) {
    writeOptions(os, new String[] {"label", label}, new String[]{"fontsize", fontSize});
  }
  
  IOUtils.write(endTag, os);
  
}

origin: org.jboss.windup/windup-grapher

private void writeGraphNode(String id, String label, OutputStream os) throws IOException {
  final String tag = DotConstants.INDENT + getDotSafeName(id) + "[label = \""+label+"\", fontsize = \""+fontSize+"\"]" + DotConstants.END_LINE;
  IOUtils.write(tag, os);
}

origin: org.jboss.windup.legacy.application/grapher

private void writeOptions(OutputStream os, String[]... options) throws IOException {
  Map<String, String> map = new HashMap<String, String>();
  for(String[] option : options) {
    String key = option[0];
    String value = option[1];
    map.put(key, value);
    
  }
  writeOptions(map, os);
}

origin: org.jboss.windup/windup-grapher

private void writeGraphEdges(OutputStream os) throws IOException {
  for(Edge edge : graph.getEdges()) {
    String label = edge.getLabel();
    String source = ""+edge.getVertex(Direction.IN).getId().hashCode();
    String target = ""+edge.getVertex(Direction.OUT).getId().hashCode();
    writeGraphEdge(label, source, target, os);
  }
}
origin: org.jboss.windup.legacy.application/grapher

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);
    
    if(StringUtils.isBlank(label)) {
      label = vertex.toString();
    }
    writeGraphNode(id, label, os);
  }
  
}
origin: org.jboss.windup.legacy.application/grapher

  @Override
  public void writeGraph(OutputStream os) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    super.writeGraph(baos);

    try {
      StringBuilder builder = new StringBuilder();
      builder.append(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("vizjs/viz.js")));
      builder.append("var result = new Viz(dotGraph);");
      
      String script = builder.toString();
      ScriptEngine engine =  new ScriptEngineManager().getEngineByName("JavaScript");
      Compilable compilingEngine = (Compilable) engine;
      CompiledScript cscript = compilingEngine.compile(script);

      //Bindings bindings = cscript.getEngine().createBindings();
      Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
      for(Map.Entry me : bindings.entrySet()) {
        System.out.printf("%s: %s\n",me.getKey(),String.valueOf(me.getValue()));
      }
      bindings.put("dotGraph", baos.toString());
      //cscript.eval();
      Object result = cscript.eval(bindings);
      LOG.info("Result:" +ReflectionToStringBuilder.toString(result));
    } catch (Exception e) {
      throw new IOException("Exception generating graph.", e);
    }
  }
}
origin: org.jboss.windup.legacy.application/grapher

private void writeGraphTag(OutputStream os) throws IOException {
  String name = this.getDotSafeName(graphName);
  IOUtils.write(graphType.getName()+" "+name+"{" + DotConstants.NL, os);
  
  writeGraphNodes(os);
  writeGraphEdges(os);
  
  IOUtils.write("}", os);
}
origin: org.jboss.windup.legacy.application/grapher

private void writeGraphEdge(String label, String source, String target, OutputStream os) throws IOException {
  final String startTag = getDotSafeName(source) + graphType.getEdge() + getDotSafeName(target);
  final String endTag = DotConstants.END_LINE;
  
  IOUtils.write(startTag, os);
  
  if(StringUtils.isNotBlank(label)) {
    writeOptions(os, new String[] {"label", label}, new String[]{"fontsize", fontSize});
  }
  
  IOUtils.write(endTag, os);
  
}

origin: org.jboss.windup.legacy.application/grapher

@Override
public void writeGraph(OutputStream os) throws IOException {
  writeDot(os);
}

origin: org.jboss.windup.legacy.application/grapher

public VizJSHtmlWriter(Graph graph) {
  this.writer = new DotWriter(graph, "G", "qualifiedName", DotGraphType.DIGRAPH, "8pt");
}
origin: org.jboss.windup/windup-grapher

private void writeDot(OutputStream os) throws IOException {
  writeGraphTag(os);
}

origin: org.jboss.windup.legacy.application/grapher

private void writeGraphNode(String id, String label, OutputStream os) throws IOException {
  final String tag = DotConstants.INDENT + getDotSafeName(id) + "[label = \""+label+"\", fontsize = \""+fontSize+"\"]" + DotConstants.END_LINE;
  IOUtils.write(tag, os);
}

origin: org.jboss.windup/windup-grapher

private void writeOptions(OutputStream os, String[]... options) throws IOException {
  Map<String, String> map = new HashMap<String, String>();
  for(String[] option : options) {
    String key = option[0];
    String value = option[1];
    map.put(key, value);
    
  }
  writeOptions(map, os);
}

origin: org.jboss.windup.legacy.application/grapher

private void writeGraphEdges(OutputStream os) throws IOException {
  for(Edge edge : graph.getEdges()) {
    String label = edge.getLabel();
    String source = ""+edge.getVertex(Direction.IN).getId().hashCode();
    String target = ""+edge.getVertex(Direction.OUT).getId().hashCode();
    writeGraphEdge(label, source, target, os);
  }
}
origin: org.jboss.windup/windup-grapher

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);
    
    if(StringUtils.isBlank(label)) {
      label = vertex.toString();
    }
    writeGraphNode(id, label, os);
  }
  
}
origin: org.jboss.windup/windup-grapher

  @Override
  public void writeGraph(OutputStream os) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    super.writeGraph(baos);

    try {
      StringBuilder builder = new StringBuilder();
      builder.append(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("vizjs/viz.js")));
      builder.append("var result = new Viz(dotGraph);");
      
      String script = builder.toString();
      ScriptEngine engine =  new ScriptEngineManager().getEngineByName("JavaScript");
      Compilable compilingEngine = (Compilable) engine;
      CompiledScript cscript = compilingEngine.compile(script);

      //Bindings bindings = cscript.getEngine().createBindings();
      Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
      for(Map.Entry me : bindings.entrySet()) {
        System.out.printf("%s: %s\n",me.getKey(),String.valueOf(me.getValue()));
      }
      bindings.put("dotGraph", baos.toString());
      //cscript.eval();
      Object result = cscript.eval(bindings);
      LOG.info("Result:" +ReflectionToStringBuilder.toString(result));
    } catch (Exception e) {
      throw new IOException("Exception generating graph.", e);
    }
  }
}
org.jboss.windup.graph.renderer.dot

Most used classes

  • DotConstants$DotGraphType
  • DotWriter
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now