Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gwt Listbox item reference to an Object

I have got a Listbox and i want to add some Items. There are only methods to add items as a String, but I want add a Item to the Listbox with a String and a reference to an Object. So that, if a item was selected in the Listbox, I get the Object reference too. Otherwise I have always to search with equal for the right Object.

Is there any option therefore?

like image 379
ph09 Avatar asked Dec 17 '22 12:12

ph09


2 Answers

Try ValueListBox instead of ListBox.

like image 77
Thomas Broyer Avatar answered Dec 19 '22 02:12

Thomas Broyer


You could store the object in a Map indexed by the value of the item, or in an array or List, at the index of the added item in the list box.

like image 40
JB Nizet Avatar answered Dec 19 '22 03:12

JB Nizet