Composite Nodes or Custom Ports?


I’m trying to design a custom GoObject in GoExpress. It will be a large rectangle with a number of smaller rectangles inside. Each smaller rectangles needs it’s own ports.

I have thought through two approaches, but can implement neither.

  1. Create a BigNode class, then add instances of SmallNode to it. I would expect GoGroup to allow you to add new elements, but at the moment I just can’t find how to add a GoObject to a GoGroup.

  2. Render everything with a background image, then construct custom ports. Unfortunately, I can’t find a way to add new ports to a node. Overriding .Ports requires you to return a GoNodePortEnumerator, which is sealed and doesn’t allow you to add your own GoPort objects.

Any ideas on approaches I can take?

By far the easiest approach is to use the full GoDiagram product. GoExpress is intended for use by customers who can use the built-in node classes without significant customization.

In Express, GoGroup doesn't implement the IGoCollection interface, so child objects cannot be added to nodes nor can one iterate over existing children. The full GoDiagram product supports this, so adding rectangle and ports, or anything else is easy.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Thanks! At the minute I'm knocking something together for a demo,  and if the demo is successful I'll talk to my boss about getting a full licence. 

For now, I’ve faked it by using a GoRectangle for the larger node, but I think in time we’ll want to be able to move the larger nodes around, and perhaps get ports on the larger nodes. The full product is probably the way to go.


Steve Cooper<hints id="hah_hints"></hints>