How to make sure links are connected to both nodes

In my tree layout, i have changed node template. Due to this some links are not connected to its nodes. Is there a way to make sure that all links are connected to their nodes ?
~ Thanks

Could you explain what you mean by “In my tree layout, I have changed node template”? Do you mean that you have a custom TreeLayout subclass that changes the templates used by the nodes and links it just laid out?

If so, that’s not a situation that TreeLayout, or really most Layouts, would know how to handle. They want to arrange the nodes the way that they are. They might change the size of nodes, but that would be part of the design of the layout. Most layouts would not know about the unexpected change in size of any nodes due to a category/template change.

I suggest that you change the category of the nodes before the regular part of the TreeLayout operates. Although you might need to do so in a separate transaction, to give the nodes time to measure and arrange themselves so that the layout knows how big they actually are supposed to be.

No custom layout, Sorry to have said that way. I am using a TreeLayout. I have deployed the solution. Now the template change is causing links arrangement issue.

So everything looks good, and then in some command you change the category for some or all of the Nodes? That should automatically cause the links to be re-routed. And the different size nodes would cause the layout to be invalidated, resulting in a new layout. So everything should look good again.

But if you have disabled automatic layouts for some reason, you might need to call Diagram.layoutDiagram(true) in order to force a layout so that all the nodes are arranged and all the links are routed properly.

Thanks ! layoutDiagram should work