I would like to generate static graph use GraphStream. Is there any suggestion solutions?
I read input data from DGS file (generated from other model). Because the number of nodes is not fix every time and I don't want to manually specify each position of each node. Currently I can use the autolayout function to place the nodes and the result is OK, but the problem is: each node can be moved if you click the node and drag it. Is there any way to generate the graph use autolayout, and the node is un-draggable at the same time?
Thanks in advance!
In order to prevent user interaction with the default viewer, you need to specify a new MouseManager
, in the default View
, that actually does nothing.
Since you cannot set a null
MouseManager
(it would spawn the default one), you need to create a new class that basically does nothing and give it to the View
.
A dirty way of doing it:
graph.display()
.getDefaultView()
.setMouseManager(new MouseManager(){
@Override
public void mouseClicked(MouseEvent e) {}
@Override
public void mousePressed(MouseEvent e) {}
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseEntered(MouseEvent e) {}
@Override
public void mouseExited(MouseEvent e) {}
@Override
public void mouseDragged(MouseEvent e) {}
@Override
public void mouseMoved(MouseEvent e) {}
@Override
public void init(GraphicGraph graph, View view) {}
@Override
public void release() {}
});