带有 HasValue 和 @UiTemplate 的 GWT 列表框

发布于 2024-09-18 14:33:12 字数 1075 浏览 2 评论 0原文

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

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

现在的问题是我在视图中使用 @UiTemplate 并且我发现很难将 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 ;
}

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 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 ;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假扮的天使 2024-09-25 14:33:12

您无法将 ListBox 转换为 SelectOneListBox (“这个新的 ListBox”),因为 ListBox 不是 SelectOneListBox 的实现代码>SelectOneListBox。除非您引用了 ListBox,但实际上您将 SelectOneListBox 保留在其中。不过我对此表示怀疑,因为那样你的代码应该可以工作。

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文