I'm building an editor (similar to MS Visio) to draw a hierarchical finite state machine. Hence a need to connect rectangles (states) with lines (transitions) in my drawing area.

I will use a drag and drop approach, hence I will need to group items (says a state and its substates or, a state and its connected transition)?

How to ensure that items are permanently grouped?

How to create an attractor point on a item ?