Sunday, July 20, 2008

JEXL: An Expression Language (EL) for Swing?

In response to this forum posting, the next release of Metawidget (v0.6) adds support for Commons JEXL.

This lets environments that don't have an Expression Language (EL) of their own (environments like Swing, GWT etc) wire components together more easily. So, for example you can do:

class Person {
   public boolean retired;

   @JexlAttribute( name="hidden", value="${!this.retired}" )
   public Date retirementDate;

And the 'retirement date' field will only appear if the 'retired' checkbox is checked.

To enable JEXL support, you just need to add a JexlInspector into your CompositeInspector.