Thanks Jeff, to summary, I have to create my own ListBox implementing
HasValue<String>:
class MyListBox extends ListBox implements HasValue<String> {
public String getValue() {
int index = getSelectedIndex();
return getValue(index);
}
}
and then get the selected value of the ListBox in the presenter:
class PhoneEditorPresenter {
interface Display {
// returns the instance of MyListBox
HasValue<String> getContactTypeList();
}
void doSave() {
String type = getContactTypeList().getValue();
}
}
On Sun, Aug 9, 2009 at 10:56 PM, Jeff Chimene <[email protected]> wrote:
>
> On Sun, Aug 9, 2009 at 5:43 AM, hezjing<[email protected]> wrote:
> > Hi
> > I'm trying to following the MVP implementation shown by Ray Ryan:
> > class PhoneEditorPresenter {
> > interface Display {
> > HasValue<String> getNumberField();
> > }
> > void doSave() {
> > String number = getNumberField().getValue();
> > }
> > }
> >
> >
> > Everything seems OK until I have a ListBox now, the ListBox does not
> > implements HasValue<T>
> > May I know which interface (e.g. Has*) I should use to retrieve the
> selected
> > value of a ListBox?
>
> I think the answer is to create your own class that extends ListBox to
> implement a HasValue method.
>
> But I could be wrong.
> >
> > --
> >
> > Hez
> >
> > >
> >
>
> >
>
--
Hez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---