Saturday, September 27, 2014

Re: How to effectively add Constants values into a ListBox in GWT?

You could store your keys separately in a list or use an "enum Country". Once you know all the keys you could use ConstantsWithLookup and fill your listbox using a for loop, e.g.

for(Country country : Country.values()) {
  listbox.addItem(myConstantsWithLookup.getString(country.name()));
}

Alternatively you could probably implement an annotation processor that generates the addItem() code based on the methods defined in your constants interface.

-- 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/d/optout.

No comments:

Post a Comment