New link can not be drawn


the new link can not be draw on the jgoview.
The scenerio is this: First when user draw a new link between two nodes, in myJGoView which extends JGoView, I overide newLink() method. The purpose is to pop up a dialog for user to enter the link label immediately when user tries to draw a new link. So in newLink(), the code will pop up a dialog that has two buttons: OK and Cancel. When user clicks on OK, the new link will be drawn. if user clicks on Cancel, the dialog disposes and the link will not be drawn. OK button works fine, it basically adds the link to JGoView’s document : doc.getFirstLayer().addObjectAtTail(link);
My problem is that after user click on Cancel button first time, then attemp to redraw the link between those previous two nodes, nothing happens. I found out The newLink() is not called by the myJGoView at all. I put a lot debuging code to detect the event in JGo_viewchanged, no specific event is happening.
When did I wrong?
Help me, if you need more info. I can email you some basic codes.
thanks. Li


In the cancelling case, did you call JGoView.doCancelMouse? That will call JGoView.noNewLink, which will perform a needed action: JGoDocument.endTransaction(false)


Yes, I did try this, but the same result. In newLink(), I did not call
fireUpdate(JGoViewEvent.LINK_CREATED, 0, link);
because I add the link to jgo directly from OK_actionPerformed. Is this the problem?
public void newLink(JGoPort from, JGoPort to)

if((from.getParent() instanceof WorkflowStateNode) &&

(to.getParent() instanceof WorkflowStateNode)){
TransitionLink link = new TransitionLink(from, to);

link.setArrowHeads(false, true); //set WorkflowTransition value for this new transition link.

TransitionEditDialog editTranDialog = new TransitionEditDialog(this.getFrame(), “INSERT NEW TRANSITION”, false, TransitionEditDialog.INSERTION, link);

the following two actionPerformed are in JDialog.
void btn_Cancel_actionPerformed(ActionEvent e) {
try {


this.dispose(); // Free system resources
} catch (Exception ex) {
void btn_OK_actionPerformed(ActionEvent e) {
//get the new value from the user and create a new WorkflowTransition
//and update the jGoview.
try {

//and the link to the jgodocument of this jgoview.
this.dispose(); // Free system resources
} catch (Exception ex) {