Saturday, February 22, 2014

Re: Why @UiFactory ListBox makeListBox1() apply for all UiBinder ListBoxes (ListBox1, ListBox2, ListBox3 etc?

Thaxnk you very much Jens, I put the " listbox1 = new ListBox(true);" after "initWidget(uiBinder.createAndBindUi(this));" & then i got an error, so i thought "@UiField(provided = true)" didn't work.

On Sunday, February 23, 2014 1:09:06 AM UTC+11, Jens wrote:
The name of a @UiFactory method is irrelevant, what matters is its return type. Thats why it gets called for all your ListBox variables.

What you actually need is @UiField(provided = true) for your listBox1.

@UiField(provided = true)
ListBox listbox1;

public class MyWidget() {
  listbox1 = new ListBox(true); // it is important to initialize the variable before calling uiBinder.createAndBindUi()
  initWidget(uiBinder.createAndBindUi(this));
}


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment