Metawidget 0.5, runtime form generator, released


News: Metawidget 0.5, runtime form generator, released

  1. Metawidget 0.5 has been released. Metawidget is an Open Source 'smart UI widget' that populates itself at runtime with labels, textboxes, date pickers, etc. to match the underlying properties of a given business object. The project comes with native versions for Android, Java Server Faces, JSP, Spring, Struts, Swing and (as of this release) Google Web Toolkit. Out of the box, it can discover properties from JavaBeans, Hibernate configuration files, Hibernate Validator annotations, JPA annotations and (as of this release) GroovyBeans. Metawidget doesn't try to 'own' the entire User Interface, it creates widgets for embedding into your existing UI - giving you the best of both worlds between automatic UI generation whilst still retaining flexibility over look and feel, choice of third-party components etc. The new GWT version continues Metawidget's tradition of using reflection and inspecting existing business object annotations (such as JPA, Hibernate Validator etc). This is despite the fact that JavaScript supports neither reflection nor annotations! It also provides pluggable layouts and automatic two-way data binding, which are cumbersome to code by hand in GWT. The new Groovy support allows Metawidget to inspect GroovyBean properties, and in particular the annotations defined on GroovyBean properties, to help make accurate widget choices. For example, if your GroovyBean property uses a Hibernate Validator annotation @Max, Metawidget will limit the upper bound of the spinner or slider widget it creates. Additional blog entries can be found on Metawidget can be downloaded from
  2. Looks like a good addition specially to GWT, for me. GWT needs binding/validation frameworks. I'll have to go check the docs to see if you have fine grained control on the form generation (like rendering some fields in some screens only, etc).
  3. Fine grained form generation[ Go to top ]

    Hi Miguel. Yes, Metawidget offers several options for fine grained control over your form generation. On a per screen basis (like you asked) you can 'stub out' fields using stub widgets (for GWT, org.metawidget.gwt.client.ui.Stub). You can also use pluggable layouts (org.metawidget.gwt.client.ui.layout.FlexTableLayout, org.metawidget.gwt.client.ui.layout.FlowLayout etc) and facet widgets (org.metawidget.gwt.client.ui.Facet). On a per field basis, you can use a wealth of annotations and/or subclass GwtMetawidget at designated 'hook methods' (eg. GwtMetawidget.buildActiveWidget). Please see the included Reference Guide, and in particular addressbook-gwt.war, for a concrete example of all of the above. Look forward to hearing how you go, Richard.
  4. GWT needs binding/validation frameworks
    There are some GWT databinding frameworks out there. IIRC there was a port of JFace databinding to GWT [1], there's ZenBinding (shameless plug) [2], and I recall I saw some other ones out there on GoogleCode. [1] [2]
  5. Hi Pierre. To clarify, Metawidget is not trying to be a data binding framework. It provides a simple bidirectional binding implementation (org.metawidget.gwt.client.binding.simple.SimpleBinding), but this is pluggable because I'd like to plug in 'proper' binding support (either an 'official' implementation in a future version of GWT, or ZenBinding, etc). It'd be great if you could look at whether you could write an implementation of org.metawidget.gwt.client.binding.Binding that uses ZenBinding. Regards, Richard.
  6. dynamic properties of object[ Go to top ]

    Interesting. Does it cover the scenario where my object contains a list of properties (name-value pairs) stored in a collection? cheers romen
  7. Romen. Thanks for the great question. I have written a blog entry for you with some working code: and-namevalue-pairs.html But the short answer is yes: Metawidget can read properties from almost any source. It can even combine properties from multiple sources using its 'CompositeInspector'.
  8. Sorry that link got mangled. It's meant to point here.