The gwt-designer isn't like WPF or other binding options.
For a concrete example import the dynatablerf example into eclipse and
take a look at how the code works.
Say you have a bean
Person{
String firstName;
String lastName;
//getters setters ommitted for brevity
}
then you make a PersonEditor class
in your ui.xml file, you have a
<g:FlowPanel>
<g:TextBox ui:field="firstName">
<g:TextBox ui:field="lastName">
</g:FlowPanel>
Notice how those properties are the same name? That is important.
now your java file will look like
public class PersonEditor extends Composite implements Editor<Person>{
/*
ui binder boilerplate
*/
@UiField
TextBox firstName;
TextBox lastName;
public PersonEditor(){
//standard ui binder boilerplate
}
}
So far the only difference is that you've added the Editor<Person>
interface to your class
Now, somewhere else in your code you're going to want to be able to
get the values from this editor. Here is where the magic starts. I'm
not using the RequestFactory because one of the requirements of our
implementation is that the backend can be any implementation, not just
Java, so I'm using SimpleBeanEditorDriver.
interface Driver extends SimpleBeanEditorDriver<Person,
PersonEditor>{} //Here be dragons
I can't say I fully understand what is happening under the hood when
you do a GWT.create on this interface, but what that will give you is
access to two very important methods, edit and flush.
Driver driver = GWT.create(Driver.class);
PersonEditor editor = new PersonEditor();
driver.initialize(editor);
Person p = driver.flush();
p will now contain whatever text was entered into the first and last
name fields.
There is a lot more to the editor documentation, but this is a very
simple example of how to do databinding with Editors.
The basic gist is, you make a form with UI designer, assign ui:field
to the name of the properties of your java bean.
Then in the java file you
On Nov 6, 5:48 am, csaffi <[email protected]> wrote:
> Thank you Jeff, how could it help me with data binding of UI
> components?
--
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.