JGoLink copyObject() issue


I have overridden copyObject() method in JGoLink as follows:

public JGoObject copyObject(JGoCopyEnvironment env) {

WELink link = (WELink) super.copyObject(env);




// link.setFromPort((JGoPort) env.get(this.getFromPort()));

// link.setToPort((JGoPort) env.get(this.getToPort()));

WETextBox text = (WETextBox) link.getToLabel();


return link;


--------------------------------------------------------------- This method gets invoked when I call JGoDocument.copyFromCollection(). But the above method does not copy the "from port" and "to port" of the link.
Due to this I am unable to find the parent and child objects of the copied link from its "from port" and "to port" respectively.
Please help me with this. How can I find the parent and child objects of the copied JGoLinks?

Copying objects is a 2 pass process. When copying links, you need to make sure that both source and destination port objects have been copied before you can “hook up” the newly copied link.

The second pass of the copying process calls copyObjectDelayed(JGoCopyEnvironment env, JGoObject newobj). Take a look at the source code for this in JGoLink.java and you'll see how to get access to the newly created ports.