Preventing duplicate drops of nodes

Hi Walter,

Can we able to restrict the repetancy of the node.

For Example, If I add one node, the same node I shouldn’t be able to add. can we restrict.?

Thanks in Advance.

Regards,
Akhil

This sounds like a completely different topic – so I have started a new forum topic for that.

First, I hope you had searched in the forum and found: Prevent drop of duplicate nodes from Palette

Basically the answer is that is to establish a “ExternalObjectsDropped” DiagramEvent listener that looks at each of the dropped Nodes (e.subject is a collection of newly dropped Parts) and sees if there are any “duplicates” in the diagram or the model. Only you know how to identify whether a node is a “duplicate” or not. I suggest that you look at the properties on the node data object, but I cannot say which ones because that is completely specific to your app.

If it finds a duplicate you can either delete the newly dropped duplicate. You can delete all of the newly dropped nodes by calling e.diagram.commandHandler.deleteSelection().