Selective modification blocking

I have a Document/View setup where I would like to disable all editing except for repositioning the nodes. No linking, no re-linking, no removing, no adding and no external dragdrop.

Searched the forums but came up short of any goodlooking solutions. Any ideas?

Some functionality is easy to disable:
JGoView.setInternalMouseActions(DnDConstants.ACTION_MOVE);
JGoView.setDragDropEnabled(false);
For the rest, you could try overriding several JGoView methods to be no-ops and/or return false: JGoView.startNewLink, startReLink, startResizing, and startActionObject.
That should still allow various kinds of selection and for moving by dragging with autoscrolling.
Caution: I haven't actually tested this.

Thanks, that helped a lot.

I still haven’t figured out a good solution to disable editing of the text-boxes of nodes. Any ideas?

Edit: It has occured to me that I could iterate through all the JGoText-instances of the document and set them to be uneditable, but I don’t think that’s a maintainable solution. Any way of doing this by calling or overriding methods in my JGoView?

Yes, going through all of the Editable JGoText objects and call setEditable(false) is the most precise thing you could do.

The only predefined alternative is to call JGoLayer.setModifiable(false) or JGoDocument.setModifiable(false). But that of course would disable a lot of other kinds of user modification besides in-place text editing.

The right thing to do would be to override JGoText.doMouseClick to check your view for some boolean property that you define, such as isEditingEnabled(). If false, doMouseClick would just return false. (Same goes for doMouseDoubleClick too, I guess.)

But if you don’t want to replace all of your JGoText instances with those of a custom JGoText class that you define with this override, you might be able to override JGoView.setEditControl(JGoTextEdit) to be a no-op when your view’s isEditingEnabled() predicate is false.

I haven’t tried this to make sure there aren’t any undesirable side-effects.