use of org.graphstream.ui.view.GraphRenderer in project gs-ui-javafx by graphstream.
the class Display method display.
@Override
public Viewer display(Graph graph, boolean autoLayout) {
FxViewer viewer = new FxViewer(graph, FxViewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
GraphRenderer renderer = new FxGraphRenderer();
FxDefaultView view = (FxDefaultView) viewer.addView(FxViewer.DEFAULT_VIEW_ID, renderer);
if (autoLayout) {
Layout layout = Layouts.newLayoutAlgorithm();
viewer.enableAutoLayout(layout);
}
if (!instanceJavaFX) {
instanceJavaFX = true;
DefaultApplication.init(view, graph);
new Thread(() -> {
try {
Application.launch(DefaultApplication.class);
} catch (Exception e) {
newDisplay(view);
}
}).start();
} else {
newDisplay(view);
}
return viewer;
}
Aggregations