Tuesday, September 30, 2008

Generate User Interface Automatically: Metawidget v0.6

Version 0.6 of Metawidget, the tool that lets you generate user interfaces automatically, is now available. This release includes:
Special thanks to Rintcius Blok for his contributions to this release!

As always, the best place to start is the Reference Documentation:


Your continued feedback is invaluable to us. Please download it and let us know what you think.

Metawidget: Ready, Set, Action!

The new release of Metawidget furthers its philosophy of 'inspecting the existing back-end for as much information as possible' by going after actions.

So now, in addition to automatically generating and wiring up textboxes, checkboxes etc. based on the properties of your business model, it'll generate buttons based on the actions of your business model.

This support is all pluggable, of course. With this release we've included two plug-ins: one for JBoss jBPM and one for Swing AppFramework.

JBoss jBPM


If your back-end architecture uses JBoss jBPM to define pageflows...

<pageflow-definition name="newuser">
   <page name="contact">
      <transition name="prev" to="account" />
      <transition name="next" to="card" />
   </page>
</pageflow-definition>

...then you can now point a Metawidget at that pageflow...

<m:metawidget value="newuser.account"/>

...and it'll generate command buttons that are localized and wired up to the correct actions...


You can see this in action in the included DVD Store Example, which retrofits an existing Seam application to generate its input fields and command buttons automatically, reducing all that boilerplate code.

Swing AppFramework


If you're using the Swing AppFramework (JSR 296) to structure your Swing app...

@Action
public void save( ActionEvent event ) {
   mMetawidget.save();
}
...then you can now point a Metawidget at your business model, and it'll generate command buttons that are localized and wired up to the correct actions. You can see it in action in the included Car Demo.

You can further combine all this with the other pluggable inspectors, such as JexlInspector to easily and declaratively control your app's actions...

@UiAction
@UiJexlAttribute( name = HIDDEN, value = "${!this.readOnly}" )
public void edit() {
   ...
}

@UiAction
@UiJexlAttribute( name = HIDDEN, value = "${this.readOnly}" )
public void save() {
   ...
}

@UiAction
@UiJexlAttribute( name = HIDDEN, value = "${this.readOnly || this.newContact}" )
public void delete() {
   ...
}

@UiAction
@UiComesAfter( { "edit", "delete" } )
@UiJexlAttribute( name = "label", value = "Back", condition = "${this.readOnly}" )
public void cancel() {
   ...
}

This code is enough to generate:
  • an Edit button that, when clicked, disappears in favour of...

  • ...a Save button

  • a Delete button that only appears if it's not a new business object

  • a Cancel button, that says Back if the user has not edited anything yet

You can see it in action in the included Swing Address Book Example...


So now there are even more places Metawidget can inspect your existing back-end architecture and remove the need for you to write boilerplate code for your existing front-end framework!