One Palette, Multiple Diagrams

Hi,

I have 2 Diagrams and one Palette. The Palette has all the functionality I need but I want to limit some of the adding functions on the Palette so they will only work with one of the Diagrams. For example, the palette has node functions for A, B, C, D, E. I also have Diagram1 and Diagram2. I want Diagram1 to only accept nodes of type A and B, Diagram2 to only accept nodes of type C and D with both accepting node types E.

Is there a way of limiting what can and cannot be accepted by Diagrams?

Also, what is the best way to handle node type that can be accepted by both Diagrams? Define for one and extend it somehow? Define it for both Diagram1 and Digram2 but with the same name?

Thanks,

Z

The easiest thing to do is implement an “ExternalObjectsDropped” DiagramEvent listener on both Diagram1 and Diagram2. If any of the Parts that were dropped (the Diagram.selection holds all of the newly created Parts) are not to your liking, you can either delete those particular Parts or you can delete all of them by calling Diagram.commandHandler.deleteSelection().

I’m assuming you have a way of identifying what “type” each Node is, perhaps by examining its Node.data.