1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    10
    Vote Rating
    0
    ruperty is on a distinguished road

      0  

    Default 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:

    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";
                    }
    Regards,
    Rupert

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Code:
     AppSystemType st = (AppSystemType) type.getValue();
    The issue is in that line of your code.

    Code:
     AppSystemType st = (AppSystemType) ((BeanModel) type.getValue()).getBean();

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    10
    Vote Rating
    0
    ruperty is on a distinguished road

      0  

    Default


    Brill! Thanks very much.

Similar Threads

  1. Replies: 6
    Last Post: 6 Oct 2009, 9:28 AM
  2. Replies: 1
    Last Post: 3 Jun 2009, 8:15 AM
  3. SelectionChangedListener ClassCastException
    By micgala in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 12 Dec 2008, 3:38 AM
  4. [CLOSED] Combobox - ClassCastException
    By fother in forum Ext GWT: Bugs (1.x)
    Replies: 1
    Last Post: 25 Nov 2008, 9:32 AM

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."