I need to implement a background rectangle between 2 nodes.
I thought of grouping the 2 nodes and implement a spotted rectangle in the group template.
I’m reluctnant to use groups, because i will have to add “fake” (group) nodes.
Any other idea ? Adornment ? Something else ?
Regards,
Tany
I would like to understand your notion of “fake”, because I believe you have some good ideas behind your imprecise and undeveloped ideas of what is “good” design for your app.
I believe you are saying that you do not want to add a not-real node to your model that would be a group. That design would also add membership information to each node that would be a member of that group. Is that also undesirable in your app? Or would that be natural, and only the additional group node be unnatural? Might you want to implement your desired background shape as an unmodeled Group? Or could it be implemented as an unmodeled simple Part?
What behaviors would you expect to implement? If the user moves certain nodes, would you expect that special background to adapt in size or location? What if relevant nodes were deleted – what should happen to that background? What if the relevant nodes were copied? What if only some of the relevant nodes were moved or deleted or copied? Or are you disabling certain behaviors by the user?
In general,
My code has a lots of use cases that iterate all diagram nodes.
Adding not-real group nodes requires code change in several points, to skip these nodes.
Thus, i prefer not to add group nodes or any other part if not neccesary.
If there’s no other option, i’ll manage.
Anyway, all opertions on nodes (move,copy,delete, resize) are disabled .
OK, so create either simple Parts or Groups that are not in the model but are added directly to the Diagram. You can do that in your “InitialLayoutCompleted” DiagramEvent listener.