[ovirt-devel] GWT/Frontent - Looking for convinient way to seperate the "data" from "presentation" in combo boxes
vszocs at redhat.com
Fri Jun 20 12:18:45 UTC 2014
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
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:
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.
----- Original Message -----
> From: "Lior Vernia" <lvernia at redhat.com>
> To: "Yair Zaslavsky" <yzaslavs at redhat.com>
> Cc: devel at 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 at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/devel
> Devel mailing list
> Devel at ovirt.org
More information about the Devel