Public void documentChanged issues

My documentChanged() is no longer being notified of JGoDocumentEvent.INSERTED & JGoDocumentEvent.REMOVED. It was working before my undo/redo issues. For example in

public void newLink(JGoPort from, JGoPort to) I have

TransitionLink link = new TransitionLink(from, to, this);

int tranID = …

//if I include the line below the undo menu item is never updated if however I remove it it does



fireUpdate(JGoViewEvent.LINK_CREATED, 0, link);

getDocument().endTransaction(“New Transition”);


The link is created however documentChanged() never receives a JGoDocumentEvent.INSERTED hint. What would cause such a result?

JGoView.newLink is only supposed to end a transaction. If you start one too, then that’s a nested transaction, and the original one never finishes.
FYI, JGoView.startNewLink and startReLink are supposed to start a transaction, and not finish it either, of course.

Any idea why the hints that I mentioned would no longer be sent to documentChanged()?

No, that’s odd. I assume you have NOT turned on SuspendUpdates.
Perhaps the object is already part of the layer so that you shouldn’t get an INSERTED event. But it’s odd that you wouldn’t get both of them, if that were the problem.

Ok I finally realized that the issue began around the time that I switched to JGo5.1. I switched back to my previous version JGo5.03 and it now works.

I’m not familiar with the situation that you have.
I assume you have removed that call to startTransaction in your override of JGoView.newLink, since that’s definitely wrong.
If the user draws a new link, does it get created OK? Can the user perform an undo OK? Can the user then perform a redo OK? Are you saying that with 5.1 you aren’t getting any JGoDocumentEvent.INSERTED or REMOVED events? Or that you are but not for newly drawn links? Or what is it that you are trying to do?

Yes I removed my startTransaction when I override JGoView.newLink. Yes the user can perform all that you asked however in the JGoView.documentChanged I receive no JGoDocumentEvent.INSERTED or REMOVED events period for any event. Even when I delete a node. With 5.03 I get notified in 5.1 I do not.

I just modified to put up a message when a JGoObject is INSERTED or REMOVED (there’s already code for the INSERTED case).
It worked fine, during regular operations (both programmatic and interactive) and during undo and redo. Although there’s no guarantee that you’ll get a JGoDocumentEvent for every document change during an undo or a redo, since that depends on how JGoDocument.changeValue or JGoObject.changeValue is implemented for that particular property or state change.