By Geertjan on Jul 18, 2013
Let's say you need to manage a centralized GUI-type designer from a node hierarchy. To really picture this concept, take a look at this screenshot, where on the left you see a node hierarchy and on the right a designer. When the user right-clicks the root node, new table-elements (whatever that may be in the context of your implementation of this scenario) are added to the designer. Existing tables can also be deleted, via the node hierarchy.
If you're creating some kind of wireframe-oriented application, i.e, you want to let the user quickly put together a layout of some kind, without drag-and-drop, but by continually expanding some kind of tree structure, i.e., node hierarchy, then this scenario is specifically made with you in mind.
And here's the structure of the application. It is extremely simple and elegant, the starting point is a domain module, providing a Table object and a Row object. When the user right-clicks the root node, a new Table can be created, which means that a Table object is added to the CentralLookup, i.e., a context-free implementation of the Lookup concept, with thanks to Wade and others. Similarly, a Row can be added by right-clicking the Table node, which is the entry point to adding a new Row to the CentralLookup. On the other end, i.e., in a different module, a LookupListener on the designer TopComponent detects additions/removals and behaves appropriately, i.e., adds/removes corresponding Visual Library widgets to/from a Visual Library Scene:
I will be developing this scenario further in the coming days. Interested? Here's where the source code is found: