use of org.graphstream.ui.fx_viewer.util.FxMouseManager in project gs-ui-javafx by graphstream.
the class DemoViewerFxEdgeSelection method main.
public static void main(String[] args) {
System.setProperty("org.graphstream.ui", "org.graphstream.ui.javafx.util.Display");
Graph graph = new MultiGraph("main graph");
viewPanel = (FxViewPanel) graph.display(true).getDefaultView();
FxViewer view = (FxViewer) viewPanel.getViewer();
view.getDefaultView().setMouseManager(new FxMouseManager(EnumSet.of(InteractiveElement.EDGE, InteractiveElement.NODE, InteractiveElement.SPRITE)));
ViewerPipe pipe = view.newViewerPipe();
// graph.setAttribute( "ui.quality" );
graph.setAttribute("ui.antialias");
pipe.addViewerListener(new DemoViewerFxEdgeSelection());
for (String nodeId : new String[] { "A", "B", "C" }) {
Node node = graph.addNode(nodeId);
node.setAttribute("ui.label", nodeId);
}
graph.addEdge("AB", "A", "B", true);
graph.addEdge("BC", "B", "C", true);
graph.addEdge("CA", "C", "A", true);
graph.setAttribute("ui.stylesheet", styleSheet);
float color = 0;
float dir = 0.01f;
while (loop) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
pipe.pump();
color += dir;
if (color > 1) {
color = 1;
dir = -dir;
} else if (color < 0) {
color = 0;
dir = -dir;
}
showSelection(graph);
}
}
Aggregations