Skip to main content

Proposal: implicit content element handlers

No replies
Joined: 2004-12-15

> If you want to go beyond this, for example, to embed
> as a child element of an existing JDNC element,
> say , and expect the root pane instance to
> do something special with your instance of Foo, you
> do not have to modify JXRootPane, but you still need
> to register an element assimilator with
> RootPaneElement that knows how to process a child
> FooElement inside a parent RootPaneElement.

It would be nice if you didn't have to explicitly register each content element with each container element.

How about a mechanism where in a each element you provide only one method to assimilate elements which realize objects that implement a certain interface.
In such a way that i.e. if RootPaneElement has a method
assimilate(java.awt.Component c),
RootPaneElement's handlerMap will automatically be filled with all the handlers needed to assimilate SplitPaneElement, TableElement, TreeTableElement and so on.
This could be done when the object realizer is set up with the vocabulary by looking (with reflection) for special methods in all Elements and adding the respective handlerMap entries for all child elements that realize elements that implement that interface.

As a consequence new and old container elements would work with new and old content component elements, new/old views would work with new/old datamodels without anyone of them knowing any other personally.

What do you think?