1

I need to disable connection of actual vertex if edges of vertex >= 2

if(graph.getModel().getEdgeCount(cell)>=2){ graphComp.setConnectable(false); // but for actual cell, not for all vertexes }

How can I do that?

Frodo Baggins
  • 8,290
  • 6
  • 45
  • 55
Katka
  • 11
  • 1

1 Answers1

1

Instead of mxGraphComponent.setConnectable(false) you can disable the connection for one Cell by calling mxCell.setConnectable(false).

If you want it to be enabled again when the edgecount goes down again you can use:

int maxEdgeCount = 2;

cell.setConnectable(cell.getEdgeCount < maxEdgeCount);
F. Lumnitz
  • 688
  • 4
  • 11
  • I had the same problem where using "setConnectable" on the graph had no effect. Setting it on the cell worked. Thanks – Matt Scott Dec 18 '19 at 13:23