Basically, what I'm trying to do is not allow creation of edges or vertex at all. Nothing should be editable, the user is only meant to be allowed to re-position Vertices, but never modify the actual graph.

Any help?

At the moment I have all these

    graph.setCellsEditable(false);
    graph.setAllowDanglingEdges(false);
    graph.setAllowLoops(false);
    graph.setCellsDeletable(false);
    graph.setCellsCloneable(false);
    graph.setCellsDisconnectable(false);
    graph.setDropEnabled(false);
    graph.setSplitEnabled(false);
    graph.setCellsBendable(false);

but it still allows adding Edges.

Thanks

asked 05 Feb '13, 12:34

AndyWill's gravatar image

AndyWill
313
accept rate: 0%

edited 08 Feb '13, 08:22


Try graph.setConnectable(false)

link

answered 05 Feb '13, 16:29

Gaudenz's gravatar image

Gaudenz
80.1k1310
accept rate: 39%

What example is your app based on?

link

answered 05 Feb '13, 14:44

Gaudenz's gravatar image

Gaudenz
80.1k1310
accept rate: 39%

It's based on the HelloWorld example, just to clarity, the only problem I have left right now is the graph editor/display allowing drag and drop from the center of a vertex to another vertex which adds a new edge between two vertices.

(05 Feb '13, 15:37) AndyWill

still allows adding of edges unfortunately.

may have something to do with mxCellMarker or mxConnectionHandler.

mxConnectionHandler: "Connection handler creates new connections between cells. This control is used to display the connector icon, while the preview is used to draw the line. mxEvent.CONNECT fires between begin- and endUpdate in mouseReleased. The cell property contains the inserted edge, the event and target properties contain the respective arguments that were passed to mouseReleased."

I'll try and find how its it relates to mxGraphComponent and see if I can replace them with overridden methods.

Any further help would be appreciated.

(06 Feb '13, 06:42) AndyWill

Is this Java? If so, please tag JGraphX, not mxGraph.

(07 Feb '13, 05:53) David

This answer worked. Thank you. It seemed that it was my mistake, I set .setConnectableEdges(false) to the graph model.. it had to be set in the graph component itself rather than the graph model. My apologies, this was just slightly confusing as all other interactions allowed/disallowed are declared in the graph model.

Thank you.

(08 Feb '13, 06:35) AndyWill

Gaudenz, can you change your comment into an answer and edit as appropriate to make it clearer if you so wish so I can sign it off as "the answer" :)

Again, much appreciated for the help

(08 Feb '13, 12:35) AndyWill
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×194
×79
×37
×13
×6

Asked: 05 Feb '13, 12:34

Seen: 3,962 times

Last updated: 08 Feb '13, 12:37