1

I have visualized relationships in my program with JGraphT's JGraphXAdapter.

Unfortunately, I need to allow user only visual modifications of the graph, i.e. moving/resizing nodes. But he still can edit something, despite the fact I disabled everything I found:

setLayout(new BorderLayout());
        add( 
            new mxGraphComponent(
                jgxAdapter = new JGraphXAdapter<Corpus, CorporaDirectory.CorporaGraphEdge>(
                    CorporaDirectory.getInstance().getCorporaGraphModel()
                ) {{
                    setCellsDeletable(false);
                    setCellsCloneable(false);
                    setCellsEditable(false);
                    setCellsDisconnectable(false);

                    setConnectableEdges(false);
                    setVertexLabelsMovable(false);
                    setSplitEnabled(false);

                }}
            ) 
        );

specifically user still can add new edges:

enter image description here

UDPATE

If I set setEnablled(false) to mxGraphComponent then I get totally frozen graph.

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385

1 Answers1

3

Try using mxGraphComponent.setConnectable(false), it should disable connection handler in the graph component.

tenorsax
  • 21,123
  • 9
  • 60
  • 107