MetaWidget – Convention over Configuration UI

I already know that I'm not going to do MetaWidget justice as I describe it. What the heck is it? According to the MetaWidget site, it is...

Metawidget takes your domain objects and automatically creates User Interface widgets for them, saving you handcoding your UIs and leaving you to concentrate on stitching together your application.

Think of a configurable form widget driven off of your beans through runtime inspection of properties, getters and setters, annotations, etc.

But wait, there's more. It automatically detects your backend at runtime and makes friends with Hibernate, Spring, Seam, Groovy, etc.

But that's not all you get. MetaWidget will work with JSF, Swing, GWT, Android, Struts, and on and on. I'm just scratching the surface here, including how it will work with IDE GUI Builders and such.

Definitely check out the MetaWidget tutorial.

Just a little taste of MetaWidget code from the tutorial:

public class Person {
	public String name;
	public int age;
	public boolean retired;
}

import javax.swing.*;
import org.metawidget.inspector.propertytype.*;
import org.metawidget.swing.*;

public class Main {
	public static void main( String[] args ) {
		Person person = new Person();

		SwingMetawidget metawidget = new SwingMetawidget();
		metawidget.setInspector( new PropertyTypeInspector());
		metawidget.setToInspect( person );

		JFrame frame = new JFrame("Metawidget Tutorial");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().add(metawidget);
		frame.setSize(400, 220);
		frame.setVisible(true);
	}
}

I have a couple of tedious GWT/Swing apps with lots of forms that are going to see and application of MetaWidget.