I'm particulary interested in the JDNC markup and would like to let JDNC users
access my own Swing Components while building applications through the markup.
I tried to achieve this and actually managed to do it but I had to hack it
because the current API doesn't seem to me really designed with extensibility
Do you plan to provide more extensibility facilities in the future?
For your information here are some examples of problems I encountered. I must
admit I did that just after few minutes playing with JDNC so I may have missed
something in which case I would be happy to know the recommended way to go for
- To provide your own vocabulary in addition to the one of JDNC you want to
subclass ElementTypes, unfortunately this is a final class, so you have to
duplicate everything. I think this class should not be final.
- To use your own vocabulary you have to modify
Application.getObjectRealizer() method to return your own vocabulary class. I
think the class name of the vocabulary should be customizable throught
resources or command line. Or at least by easing subclassing.
- While coding this I think I encountered some bugs in the sor.jar classes.
Example: I noticed that I was called something in
ComponentElement.getElementHandler(namespace, name) with as name parameter the
full name (NS prefix + localName) instead of the localName as the method code
expect (my markup is using my own namespace with a prefix not JDNC one of
course). (stack of the call comes from ObjectRealizerImpl.findElementType).
- Another point is that if you want your Component to be put in the same
components as for example table you have to sublcass all classes that register
handlers for table (RootPaneElement and so on...). Maybe there could be a
facility that allows to "register" the components from the outside without
having to subclass.
- Some appliers such as preferredSizeApplier explicitely cast the component
(in for example JNTable), if they were only relying on the JComponent
interface (which sounds me perfectly feasible) the appliers could be reused
for other components instead of re-coded.