Hi Yair, sorry for my late response.
As Lior mentioned, ListModelListBox accepts Renderer that is passed to
ValueListBox constructor. The purpose of a Renderer is to create user
presentable string for given item (T). The fact that getValue() returns
T rather than String is expected, as T is the type of item the list box
works with.
The reason why <select> tag for ListModelListBox has options with same
"data" and "presentation" strings, is because ValueListBox (parent of
ListModelListBox) uses this to add new item:
getListBox().addItem(renderer.render(value));
which is the same thing as you would do:
listBox.insertItem(renderValue, renderValue, INSERT_AT_END);
If we want to modify this behavior, we'll need to either hack or replace
ValueListBox backing implementation.
Vojtech
----- Original Message -----
From: "Lior Vernia" <lvernia(a)redhat.com>
To: "Yair Zaslavsky" <yzaslavs(a)redhat.com>
Cc: devel(a)ovirt.org
Sent: Sunday, June 15, 2014 8:16:35 AM
Subject: Re: [ovirt-devel] GWT/Frontent - Looking for convinient way to seperate the
"data" from "presentation" in
combo boxes
Hi Yair,
I think this is exactly what happens in our GUI in most list boxes.
The class ListModelListBox<T> renders the options for display using a
Renderer passed to its constructor, but getValue() returns the actual
selected item of type T rather than the String (and this in turn is what
is set as the selected item in the backing ListModel<T>).
Does this answer your question?
Yours, Lior.
On 14/06/14 11:20, Yair Zaslavsky wrote:
> HI all,
> If you look at this link -
>
>
http://www.w3schools.com/tags/tag_select.asp
>
> It shows a selection in which you have a differentiation between the
> displayable value, and the "data" value (which will be sent as the
> "selected value").
>
> How can I do the same in GWT? At ListModel for example I saw methods only
> to add items.
>
>
> Thanks,
> Yair
> _______________________________________________
> Devel mailing list
> Devel(a)ovirt.org
>
http://lists.ovirt.org/mailman/listinfo/devel
>
_______________________________________________
Devel mailing list
Devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel