Node with links


I am hoping to gather input as to what would be the best was to solve the following problem.
I would like to create an node that represents a distribution box. The box or node would always have at least one input port with a link always connected to it, and the link could be hanging or connected to another port depending on the state of the user’s session. The user could never delete the input port or link (this is easily prevented). The box or node could also have at least one or a number of output ports with a corresponding link that would be added by the user using the property grid, they will click on the node, go to the property grid and perform add/delete operations, adding a removing ports/link pair. Once they add the new link, they could connect it to whatever node in the diagram they desire or possibly not connect it until later.
My first thought is to derive a class from GoGroup as the GoLabeledLink class does and add the appropriate properties and methods to represent this type of node. Has anyone done this? Is there a sample that contains this? Is my approach ok?


Would you want to use a GoGeneralNode?
Do you really need to have one link connected to each port, with the other end disconnected? I don’t see any advantage in doing so, at the cost of a more cluttered and clumsy UI for the user.
Have you looked at the AutoLinkNode in the Demo1 sample? An instance of this node is labelled “magic” when you “Insert Lotsa Stuff”. It has a “star” port in the middle of the icon.


Yes, having one link connected to each port represents our data model and is a must. During a design session our users may leave their session incomplete for many reasons. Our designer must be able to save the users state so that upon return they can resume.
So, as I stated before, when the user first drags the item onto the design surface it must represent a node (distribution box) with at least one input port/link connected to it (user can change location of this port/link on the node). They can then add outgoing port/link items they would lilke to connected to other nodes. The outgoing links can be linked and relinked or deleted altogether. Also, when a node connected to one of the distribution box’s output links is deleted, the output link must remain.


OK, well, that’s fine. You can still use a GoGeneralNode–you just create and attach a link with each port.
Since the link doesn’t have two ports that would define its route (i.e. its stroke points), you’ll need to provide them explicitly yourself. One way of doing so is by temporarily using a GoPort at the other end of the link. You would position the port where you want the link to end, and then you replace the link’s port with null. You probably don’t even need to add that temporary port to the document.
You’ll note that the initialization of the GoPalette in the MovableLinkApp sample adds a couple of links to the palette, and explicitly sets their points, rather than using a temporary port and GoLink.CalculateStroke’s normal behavior as I just described above.