AutoUI is a Java 5 annotations based data binging toolkit that automatically constructs user interface elements for instances of annotates java data object classes. This dramatically reduces user interface development time because developers are liberated of user interface development tasks, as these are automatically generated at runtime.
One of the main arguments for using data binding toolkits such as AutoUI is that the user interface is specified as data object class annotations:
- Each time you add a new attribute to a class, you add the respective AutoUI annotation.
- Each time you remove an attribute from a class, you also remove the respective annotation.
You get rid of all the double maintenance related to data object editor panels implemented as separated java classes.
Features
Editor Panel and Dialog
AutoUI can automatically construct an editor panel that will contain all the fields required to edit a decorated data object instance. This happens all at runtime, there is no code generation involved.
Plug-able Field Data Types
AutoUI supports all main Java data types (numbers, string, date, enumerations). If you need to support a custom data type, you can write your own editor and plug it into the framework.
Support for collections
The AutoUI editor panel supports collection fields in data objects. This means that is a class contains a collection of objects, the editor panel will be able to add and remove objects to the collection, as well as remove them.
Inheritance support
The AutoUI editor panel supports inheritance. This means that in a hierarchy you can decorate base classes and reuse these decorations in derived classes.
Embeded Objects supports
The AutoUI editor panel support embedded objects. This means that if a decorated class contains a field of another decorated type the editor panel will be able to edit it.
Example
The following example shows how to decorate a simple data object class:
@editable(uiName = "Project", orderBase = 0)
public class Project implements Comparable < Project > {
String pk;
/**
* name of the project
*/
@label(uiLabel = "Name: ")
@editor(gridwidth = GridBagConstraints.REMAINDER)
String name;
/**
* a description of the project
*/
@label(uiLabel = "Description: ")
@editor(gridwidth = GridBagConstraints.REMAINDER)
@string(variant = TextInputType.MULTI_LINE, cols = 20, rows = 5)
String description;
}
And this is how to an edit dialog can be created for an instance of this Project
AutoDialog < Project > autoDialog
= new AutoDialog < Project > (
jFrameInstance,
new Project(),
new HashMap(),
"Create new ");
autoDialog.setVisible(true);
if (!autoDialog.wasCanceled()) { // if the user pressed ok
try {
// fetch the instace of Project as is was edited by the user
Project project = autoDialog.getInstance();
}
}
