return div;
}
private NodeBuilder drawObjectForm(SomeModel o) {
final NodeBuilder form = $DIV().field("Object")
.text("Object ID: " + o.id).add($HIDDEN(ajaxName(o.id), o.id)).BR()
.text("Object name: ").add($INPUT().name(ajaxName(o.name)).value(o.name)).BR()
.text("Object email: ").add($INPUT().name(ajaxName(o.email)).value(o.email).validator(new InputValidator() {
public boolean isValid(Node n) {
return n.value.toString().indexOf("@") > 0;
}
public String getMessage() {
return "Realy bad email =)";
}
}))
;
form.add($BTN("Save", new CommonDelegate<Boolean, NodeBuilder>() {
public Boolean delegate(NodeBuilder n) {
if(!new ValidatorHelperBase().validate(form)) return false;
window.alert(helper.saveObject((SomeModel)(Object)form.node));
return false;
}