I’m using a metawidget.xml configured with the HibernateInspector. However, metawidget does
not seem to be picking up the length attribute.
I was expecting that the textbox would be limited to 5 characters.
<property name="code" type="string">
<column name="CODE" length="5" />
</property>
At present, HibernateInspector will recognize lengths of the form:
(so not the nested ‘column’ tag you used above. Do you need that?)
But yeah, beyond that SwingWidgetBuilder will ignore the maximum-length. This is because, as you surmised, Swing doesn’t really support maximum length textboxes by default. Metawidget tries not to mess too much with the API of the underlying toolkit, as we don’t want to become ‘yet another UI framework’.
However, Metawidget makes it very easy to add your own WidgetBuilder that can read the maximum-length attribute and used the ‘insertString’ technique you describe (or whatever other method you prefer. For example you may find a Swing widget library that offers this).
See here for an example how to implement your own WidgetBuilder: http://metawidget.org/doc/reference/en/html-single/index.html#section-architecture-widgetbuilders-implementing-your-own