I’m trying to override JGoView.reLink() so that I can “intercept” relink operations and make some server calls to update things there. If everything is fine I’ll call super.reLink(), otherwise I’ll call noReLink().
The problem I’m having is that the “oldlink” paramter that I get in reLink() does not seem to allow me to get to the original parent Node that I’m re-linking from. In this case I’m using GeneralNodes and I’m changing the “from” part of the link. When I look at oldlink.getFromPort() I’d expect it to be an instance of GeneralNodePort. But its not - its just a plain old JGoPort.
Is this supposed to work, or is there a different way to get the “old node” and the “new node” when a re-link happens?
Well, I think the intention is that JGoView.reLink is called to actually do the relinking, not to let you decide to do something else. If maybe the application shouldn’t permit a particular relinking operation, then you should override the JGoView.validLink predicate (or JGoPort.validLink) to avoid misleading the user into thinking something is OK when it’s not.
But to answer your question, the original port is available as the second argument to JGoView.startReLink.