This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
In GraphPinScene, when attachEdgeTargetAnchor or attachEdgeSourceAnchor is called, the oldTargetPin and oldSourcePin should be removed from the private HashMap pinInputEdges and pinOutputEdges respectively. I am writing a renamePin method for my implementation of GraphPinScene. It would seem natural to: 1) addPin newName 2) attachEdgeTargetAnchor(edge, oldName, newName0) for all Target Edges 3)attachEdgeSourcAnchor(edge, oldName, newName) for all Source Edges 4) remove oldName This doesn't work because upon removing, since the edges are still associated with the new pin there are problems. Temporary workaround. 1) addPin newName 2) removePin newName 3) attachEdgeTargetAnchor(edge, oldName, newName0) for all Target Edges 4) attachEdgeSourcAnchor(edge, oldName, newName) for all Source Edges
BTW: objects in GraphScene/GraphPinScene were meant to be unique identifiers of objects and originally have not been designed to be renamed. The problem is that the renaming (or I would say "replacing") does not have that easy semantics. Therefore the question is whether the semantics of the "replacePin" should be: 1) to replace particular pin in internal structures or 2) to replace particular pin in internal structures and all the attachPinWidget, attachEdgeSourceAnchor and attachEdgeTargetAnchor methods and therefore firing all. Maybe this option can be passed as an input argument of replacePin method. The easiest way is to implement the 2. case only. Probably it would be good to introduce replaceNode and replaceEdge methods as well. What is your opinion?