开发者

GWT ListBox with HasValue and @UiTemplate

开发者 https://www.devze.com 2023-01-15 15:50 出处:网络
I am trying to use ListBox with HasValue interface implemented, I got code / idea from the following link and I made the my own list box class

I am trying to use ListBox with HasValue interface implemented, I got code / idea from the following link and I made the my own list box class

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

Now the problem is I am using @UiTemplate in my Views and I am finding it difficult to cast ListBox to this new ListBox.

My View class code:

// 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 listb开发者_JAVA技巧ox 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 ;
}


You cannot cast ListBox to SelectOneListBox ("this new ListBox"), because ListBox is not an implementation of SelectOneListBox. Unlsee you have reference to ListBox, but in fact you keep SelectOneListBox in it. However I doubt it, because then your code should work.

Show us some code if you want to help us help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号