On 18 oct, 14:26, wangzx <[email protected]> wrote:
> Yes, the design is not the same as the editor framework:
> 1. It is an extension of the uibinder, using declaration style
> programming.
> 2. The data binding is synchronized when data changed or ui changed,
> no need for "flush" and "save" operation when the model supported.
This means:
- you're listening to events on each "bound" widget
- you're firing events to update your widgets when your "model"
changes
This has significant overhead, for actually minimal added value (with
editors, if you want to look at the "modified object", you just ask
for it –flush– and only then the values are actually "extracted" from
the UI fields and the object is modified; actually in many cases,
you'll give the object to the editor and "forget" about it, until you
need it back and then call flush()).
Note that the "firing of events to update the widgets" is there with
editors too, and supported by the RequestFactoryEditorDriver (but will
only update when RequestFactory fires an UPDATE event).
This also means you have to use widgets only, i.e. you cannot bind to
an HTML element (or it would drastically complexify the
"UiDataBinder"), whereas with editors you can actually create a simple
Editor that's backed by a DOM element without the Widget overhead;
e.g.:
class InputElementEditor implements LeafValueEditor<String> {
private final InputElement input;
public InputElementEditor(InputElement input) { this.input =
input; }
public String getValue() { return input.getValue(); }
public void setValue(String value) { input.setValue(value); }
}
class CheckboxEditor implements LeafValueEditor<Boolean> {
private final InputElement input;
public InputElementEditor(InputElement input) { this.input =
input; }
public Boolean getValue() { return input.isChecked(); }
public void setValue(Boolean value) { input.setChecked(value ==
null ? false : value.booleanValue()); }
}
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.