Introduction
Gwt 2.1 introduces a great new editor framework. Guit adds now features to make it easy to work with it.
Details
How it works:
- Annotate your "editor" presenter with @GwtEditor
- Add a new field to your presenter of the type of your driver with the name "driver"
Thats it!
You can also specify another base Driver on the annotation:
@GwtEditor(pojo=Person.class, base=RequestFactoryEditorDriver.class)
Example:
public class Person {
private Long id;
private String name;
private Date birthday;
private String address;
public Person() {
}
public String getAddress() {
return address;
}
public Date getBirthday() {
return birthday;
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public void setAddress(String address) {
this.address = address;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
}
@GwtPresenter
@GwtEditor(pojo=Person.class, paths={"nombre=name"})
public class PersonForm extends PersonFormPresenter {
SimpleBeanEditorDriver<Person, ?> driver;
}
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:d="urn:import:com.google.gwt.user.datepicker.client">
<g:HTMLPanel>
Id
<g:LongBox ui:field="id"></g:LongBox>
Name
<g:TextBox ui:field="nombre"></g:TextBox>
Birthday
<d:DateBox ui:field="birthday"></d:DateBox>
Address
<g:TextBox ui:field="address"></g:TextBox>
</g:HTMLPanel>
</ui:UiBinder>