Saturday, September 27, 2014

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

Found a simple solution, but not sure I am doing correctly:

In file

countryArray=England, America, Japan,...  


String[] countryArray();  

in Presenter or View

for(String s : myConstants.countryArray()){     countryListBox.addItem(s);  }  

On Saturday, September 27, 2014 10:37:31 PM UTC+10, Tom wrote:

Ok, say I have a Label and a ListBox in UiBinder

<g:Label ui:field="countryLabel" />  <g:ListBox ui:field='countryListBox' visibleItemCount='1' />  

In file

country=Country  england=England  america=America  japan=Japan  ....  

in Presenter or View


This is so easy for Label since we only need to set Text 1 time but it will be very time consuming if we do the ListBox

countryListBox.addItem(myConstants.england());  countryListBox.addItem(myConstants.america());  etc... there will have 200 countries out there  

So my question is, is there any quicker way to effectively add Constants values into a ListBox in GWT?

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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment