1. #1
    Ext User
    Join Date
    Jun 2008
    Posts
    365
    Vote Rating
    0
    sdc is on a distinguished road

      0  

    Default [FIXED] List.add(List) in BeanModelReader

    [FIXED] List.add(List) in BeanModelReader


    In last SVN build, lines 38-47 :
    Code:
          ListLoadResult result = (ListLoadResult) data;
          List beans = result.getData();
          if (beans.size() > 0) {
            BeanModelFactory factory = BeanModelLookup.get().getFactory(beans.get(0).getClass());
            if (factory == null) {
              throw new RuntimeException("No BeanModelFactory found for " + beans.get(0).getClass());
            }
            List converted = factory.createModel(beans);
            beans.clear();
            beans.add(converted);
    If you do that, the loader try to convert a list to a ModelData (ClassCastException). You should do instead (last line) or :
    Code:
    beans.addAll(converted);
    You can reproduce the issue with the explorer demo by replacing the ExplorerService.getCustomers return type from List<Customer> to ListLoadResult<Customer>

  2. #2
    Ext User
    Join Date
    Jun 2008
    Posts
    365
    Vote Rating
    0
    sdc is on a distinguished road

      0  

    Default


    By the way, I see you have :

    In ExplorerServiceAsync :
    Code:
    public void getCustomers(AsyncCallback<ListLoadResult<Customer>> callback);
    In ExplorerService :
    Code:
    public List<Customer> getCustomers();
    Can you shortly explain me how does it work (how is List implicitly converted to ListLoadResult) ? Is it with deferred binding ? GWT serialization mechanism ?

  3. #3
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    Code:
    beans.add(converted);
    Yes, that is a bug and has been fixed.

    Can you shortly explain me how does it work (how is List implicitly
    converted to ListLoadResult) ? Is it with deferred binding ? GWT
    serialization mechanism ?
    The List is never converted to ListLoadResult by GWT. It looks like the GWT code does not enforce the type of data in the callback. From a GXT perspective, the reason this works is that the result is never assigned to ListLoadResult. The data proxy simply passes the data to the reader which checks the type of the data, which is List and then creates a new BaseListLoadResult instance.

  4. #4
    Ext User
    Join Date
    Jun 2008
    Posts
    365
    Vote Rating
    0
    sdc is on a distinguished road

      0  

    Default


    Thanks.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar