use of de.strullerbaumann.visualee.ui.graph.entity.Graph in project visualee by Thomas-S-B.
the class GraphCreator method generateGraph.
public static Graph generateGraph(String fileName, String title, DependencyFilter filter, File outputdirectory) {
id = 0;
Graph graph = new Graph();
graph.setName(fileName);
File jsonFile = new File(outputdirectory.toString() + File.separatorChar + fileName + ".json");
graph.setJsonFile(jsonFile);
File htmlFile = new File(outputdirectory.toString() + File.separatorChar + fileName + ".html");
graph.setHtmlFile(htmlFile);
graph.setTitle(title);
GraphConfigurator.configGraph(graph);
JsonObjectBuilder builder = Json.createObjectBuilder();
// Nodes
JsonArrayBuilder nodesArray = buildJSONNodes(filter);
builder.add("nodes", nodesArray);
// Links
JsonArrayBuilder linksArray = buildJSONLinks(filter);
builder.add("links", linksArray);
JsonObject json = builder.build();
try (PrintStream ps = new PrintStream(graph.getJsonFile())) {
ps.println(json.toString());
} catch (FileNotFoundException ex) {
LogProvider.getInstance().error("Didn't found file " + graph.getJsonFile().getName(), ex);
}
return graph;
}
use of de.strullerbaumann.visualee.ui.graph.entity.Graph in project visualee by Thomas-S-B.
the class GraphCreator method generateGraphs.
public static void generateGraphs(File rootFolder, File outputdirectory, String graphTemplatePath) {
if (!outputdirectory.exists()) {
outputdirectory.mkdir();
}
// Load graph-Template, if not already done (Maven modules)
if (graphTemplate == null) {
graphTemplate = HTMLManager.loadHTMLTemplate(graphTemplatePath);
}
for (String graphName : GRAPHS.keySet()) {
Graph graph = GraphCreator.generateGraph(graphName, (String) GRAPHS.get(graphName).get(0) + rootFolder.getPath(), (DependencyFilter) GRAPHS.get(graphName).get(1), outputdirectory);
HTMLManager.generateHTML(graph, graphTemplate);
}
}
Aggregations