Hybrid View
-
31 Oct 2010 5:25 AM #1
ClassCastException with combobox
ClassCastException with combobox
Hello,
I'm getting my knickers in a twist with getting data from a form combobox field.
The combobox is loaded with data from a remote source and displays properly. However, when I want to access the selected value I am getting this exception,
java.lang.ClassCastException: uk.co.moonsit.eai.console.data.BeanModel_uk_co_moonsit_eai_console_data_AppSystemType cannot be cast to uk.co.moonsit.eai.console.data.AppSystemType
Any idea what I am doing wrong?
Here's the code:
Regards,Code:this.btnAdd = new Button("Add"); this.btnAdd.addSelectionListener(new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { log("Add system"); Field name = (Field) frmpnlAddSystem.getItem(0); String n = (String) name.getValue(); log(n); Field type = (Field) frmpnlAddSystem.getItem(1); String t = null; try { AppSystemType st = (AppSystemType) type.getValue(); t = st.getType(); log(t); } catch (ClassCastException e) { log(e.toString()); t = "error"; }
Rupert
-
31 Oct 2010 5:33 AM #2
The issue is in that line of your code.Code:AppSystemType st = (AppSystemType) type.getValue();
Code:AppSystemType st = (AppSystemType) ((BeanModel) type.getValue()).getBean();
-
31 Oct 2010 7:00 AM #3
Similar Threads
-
[2.0.3] ClassCastException selectionChanged ComboBox with BeanModel
By edcon in forum Ext GWT: DiscussionReplies: 6Last Post: 6 Oct 2009, 9:28 AM -
[CLOSED] [2.0 M2] ClassCastException using ComboBox and Binding
By Ezor in forum Ext GWT: Bugs (2.x)Replies: 1Last Post: 3 Jun 2009, 8:15 AM -
SelectionChangedListener ClassCastException
By micgala in forum Ext GWT: Help & Discussion (1.x)Replies: 0Last Post: 12 Dec 2008, 3:38 AM -
[CLOSED] Combobox - ClassCastException
By fother in forum Ext GWT: Bugs (1.x)Replies: 1Last Post: 25 Nov 2008, 9:32 AM


Reply With Quote