Search in sources :

Example 1 with GraphRenderer

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;
}
Also used : FxViewer(org.graphstream.ui.fx_viewer.FxViewer) FxGraphRenderer(org.graphstream.ui.javafx.FxGraphRenderer) GraphRenderer(org.graphstream.ui.view.GraphRenderer) Layout(org.graphstream.ui.layout.Layout) FxGraphRenderer(org.graphstream.ui.javafx.FxGraphRenderer) DefaultApplication(org.graphstream.ui.fx_viewer.util.DefaultApplication) FxDefaultView(org.graphstream.ui.fx_viewer.FxDefaultView)

Aggregations

FxDefaultView (org.graphstream.ui.fx_viewer.FxDefaultView)1 FxViewer (org.graphstream.ui.fx_viewer.FxViewer)1 DefaultApplication (org.graphstream.ui.fx_viewer.util.DefaultApplication)1 FxGraphRenderer (org.graphstream.ui.javafx.FxGraphRenderer)1 Layout (org.graphstream.ui.layout.Layout)1 GraphRenderer (org.graphstream.ui.view.GraphRenderer)1