Override JGoView.Link() methods


#1

I would like to override newLink(), noNewLink(). I extend JGoView and I override newLink(). I use super.newLink() and make system.out to print a message (code below). But it is never called. It calls the super.newLink() only. I have checked the flower sample with the ProcessView but I don’t figure what is missing. Any ideas? <?:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

public class JGoViewExtended extends JGoView implements JGoViewListener{

/** Creates a new instance of JGoViewExtended */
public JGoViewExtended() {
super();
initCommon();
}

public JGoViewExtended(JGoDocument document) {
super(document);
initCommon();
}

private void initCommon()
{
this.addViewListener(this); &nb sp;
}
protected void noRelink(JGoLink oldlink, JGoPort from, JGoPort to) {
super.noNewLink(from, to);
System.out.println(“noRelink”);
}

public void relink(JGoLink oldlink, JGoPort from, JGoPort to) {
super.noNewLink(from, to);
System.out.println(“relink”);
}

public void newlink(JGoPort from, JGoPort to) {
System.out.println(“newlink”);
super.noNewLink(from, to);
}

protected void noNewlink(JGoPort from, JGoPort to) {
super.noNewLink(from, to);
System.out.println(“noNewlink”);
}

public void viewChanged(JGoViewEvent e)
{
System.out.println(“View changed.”);
}


#2

Just some typos and careless copy-and-paste editing, I suspect.
The methods are called: newLink, noNewLink, reLink, and noReLink.
And you need to make sure you call the corresponding super method, not always super.noNewLink.
Also, on an unrelated point, it’s a little odd to have a view be its own listener, when you could just override fireUpdate instead. JGoView.fireUpdate handles a few events for its own purposes and then invokes all of its JGoViewListeners.