While working on the next part of my Bean tutorial, I noticed a few things about the API which IMHO are not too coherent.
If I look at the javadocs of the com.servoy.j2db.ui.IComponent (which exists since version 3.5), the header comment states that it is an:
Public API:
Interface to which form elements needs to conform, to be handled in the same way for swing(rich client) or wicket(webclient) UI.
There is also a comment about the getId() method, saying that it should return the
Public API:
wicket id, normally the UUID prefixed with ‘sv_’
This is fine, but the problem is that there is no way of instantiating a Wicket component from a bean unless you use the com.servoy.j2db.IServoyBeanFactory interface which is not public (in any version of the API).
No way for a bean which would not be at time a Swing bean (when place on a form in developer) and a Wicket bean when used in the web client to be made without the use of this interface.
So I would vote for this interface to be added to the public API (4.1+) otherwise it doesn’t make sense to have an IComponent interface which allows for form elements for Swing and Wicket, when you can’t create Wicket components.
And the com.servoy.j2db.dataui.IServoyAwareBean, being already there since (at least) 4.1.2 should reappear in the public API for 4.1.x, because it is an essential interface for building input beans in Servoy.
And finally, I would also vote for a few more interfaces and classes to be added… I’m not pushing here, just being rational.
I’m talking about these 2 interfaces:
- com.servoy.j2db.ui.IStylePropertyChanges
- com.servoy.j2db.ui.ISupportWebBounds
Because I doubt that without these interfaces, Servoy would recognize and use Wicket beans correctly and place them correctly on a form.
And also these 6 classes used in Wicket components like the TreeViewBean:
- com.servoy.j2db.util.ComponentFactoryHelper
- com.servoy.j2db.util.PersistHelper
- com.servoy.j2db.server.headlessclient.dataui.ChangesRecorder
- com.servoy.j2db.server.headlessclient.dataui.StyleAttributeModifierModel
- com.servoy.j2db.server.headlessclient.dataui.TemplateGenerator
- com.servoy.j2db.server.headlessclient.dataui.TooltipAttributeModifier
All these classes could certainly be created at long length by third party developers, but that would be reinventing the wheel, while these are here and made for some specific purposes already.
Making these interfaces and classes public would certainly assert your will to grant power to developers, and give them the possibility to build web components for the platform, which right now are very few, and help people build web compatible plugins and beans.
I hope that you will take this request into consideration, I can make a case for it if you want to.
I really think that it is essential for developers to have at their disposal the tools to build third party components that are best adapted for the platform, and the platform’s whole strength is to be smart and web client compatible, so let us build components that also fulfill this contract!
Thanks in advance,