0

我正在尝试使用已实现ListBoxHasValue接口,我从以下链接获得了代码/想法,并制作了自己的列表框类

http://turbomanage.wordpress.com/2010/04/01/selectonelistbox-for-use-with-gwtmvp/

现在的问题是我@UiTemplate在我的视图中使用,我发现很难转换ListBox到这个新的ListBox.

我的视图类代码:

// defines List Box , so it get attached with UiTemplate
 @UiField ListBox countryListBox ;

//-- this function should get the list box, i call this in presenter...
//-- now the problem is i do not know how i take this listbox back as selectOneListBox
 public HasSelectedValue <T> getCountry() {
        // TODO Auto-generated method stub
        //return desTextBox;
        SelectOneListBox<T> sel = new SelectOneListBox<T>(null);
        sel =(SelectOneListBox<T>) countryListBox;
        //return  (SelectOneListBox<T>) countryListBox;
        return sel;
        //return countryListBox ;
}
4

1 回答 1

0

您不能ListBox转换为SelectOneListBox("this new ListBox"),因为ListBox它不是SelectOneListBox. 除非您有参考ListBox,但实际上您保留SelectOneListBox在其中。但是我对此表示怀疑,因为那样您的代码应该可以工作。

如果您想帮助我们帮助您,请向我们展示一些代码。

于 2010-09-12T15:43:03.260 回答