Results 1 to 8 of 8

Thread: How do I configure the ListLoader with RequestFactoryProxy in GXT 3 ?

  1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Netherlands
    Posts
    48
    Vote Rating
    2
      0  

    Question How do I configure the ListLoader with RequestFactoryProxy in GXT 3 ?

    I try to wire up a RequestFactoryProxy to a ListLoader and connect this to a ListStore (gxt3.0_dp2). How do I specify the ListLoader?

    I tried something like;

    Code:
    private final ListLoader<BaseListLoadConfig, BaseListLoadResult<ArticleProxy>> mListLoader = new ListLoader<BaseListLoadConfig, BaseListLoadResult<ArticleProxy>>(mRequestFactoryProxy);
    with mRequestFactoryProxy

    Code:
    private final RequestFactoryProxy<ArticleProxy, List<ArticleProxy>> mRequestFactoryProxy = new RequestFactoryProxy<ArticleProxy, List<ArticleProxy>>()
        {...}
    But this is not correct;


    [ERROR] cannot find symbol symbol : constructor ListLoader(com.sencha.gxt.ui.client.data.loader.RequestFactoryProxy<com.randb.pizzapalace.shared.proxy.ArticleProxy,java.util.List<com.randb.pizzapalace.shared.proxy.ArticleProxy>>)

    How do I configure the ListLoader with mRequestFactoryProxy?

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    Your generics do not match. One time you say it returns a List and one time you say it returns BaseListLoadResult. Basicly this is what your errormessage told you.

    You need to add a ListReader here that transforms your list to a listloadresult

    Code:
     final RequestFactoryProxy<BaseListLoadConfig, List<NamedProxy>> mRequestFactoryProxy = new RequestFactoryProxy<BaseListLoadConfig, List<NamedProxy>>() {
    
              @Override
              public void load(BaseListLoadConfig loadConfig, Receiver<? super List<NamedProxy>> receiver) {
    
    
              }
    
    
            };
    
    
            final ListLoader<BaseListLoadConfig, ListLoadResult<NamedProxy>> mListLoader = new ListLoader<BaseListLoadConfig, ListLoadResult<NamedProxy>>(
                mRequestFactoryProxy, new ListReader<NamedProxy>());
    I have not tested this code and this code may change for any future preview release.

  3. #3
    Sencha User
    Join Date
    May 2011
    Location
    Netherlands
    Posts
    48
    Vote Rating
    2
      0  

    Question Do I have to implement method load?

    Hello Sven,

    Thanks for your reply. I know the GXT3 code is still changing, but meanwhile I'll try to understand what's going on . Sure I did know the generics did not match, but the question was how to transform the proxy list into the listloadresult...

    (Meanwhile I updated to gxt-3.0.0-dp4). Your code compiles, but the whole picture is still not clear to me. Do I have to implement method load? Do I have to use a DataReader for the processing? I mean, somebody has to call my service method (listAll) and put the result into a list...

    Code:
             
    @Override
    public void load(BaseListLoadConfig loadConfig, Receiver<? superList<NamedProxy>> receiver) 
    {
      // what to do here?
    }
    An example would be great here

    Regards,

    Roland Beuker

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    An example would be great here
    I already gave you an example in your other thread. What needs to be done there is done in detailed way in the example i already gave you:

    http://www.sencha.com/examples-dev/#...factorybinding

    The only difference is that because using RequestFactoryProxy now you get the Receiver already passed in.
    Do I have to use a DataReader for the processing?
    You need to use a reader when your proxy returns something different than expected. Like here you return a List but require a ListLoadResult
    Do I have to implement method load?
    Yes, same as in the example, only that you already have the Receiver

  5. #5
    Sencha User
    Join Date
    May 2011
    Location
    Netherlands
    Posts
    48
    Vote Rating
    2
      0  

    Question

    Yes I have both examples , but in the old/detailed example (with DataProxy) the call getRootFolder() is called in the method which is now implemented in RequestFactoryProxy...

    In the new situation, do I have to place the call in the second load? Can I get an example of this, I'm lost here...

    Regards,

    Roland

  6. #6
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    but in the old/detailed example (with DataProxy) the call getRootFolder() is called in the method which is now implemented in RequestFactoryProxy...

    You will call that in the new load method. There you already have the receiver and so do not create a new one. However RequestFactoryProxy is just a helper class. You dont have to use that. You can still use the why how it is done in the examples.

  7. #7
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

    Default

    In your case it will be something like:


    Code:
    private final ArticleRequestFactory rf = GWT.create(ArticleRequestFactory.class);



    Code:
    final RequestFactoryProxy<BaseListLoadConfig, List<ArticleProxy>> mRequestFactoryProxy = new RequestFactoryProxy<BaseListLoadConfig, List<ArticleProxy>>() {
      @Override
      public void load(BaseListLoadConfig loadConfig, Receiver<? super List<ArticleProxy>> receiver) {
        rf.article().getArticles().fire(receiver);
      }
    };
    final ListLoader<BaseListLoadConfig, ListLoadResult<ArticleProxy>> mListLoader = new ListLoader<BaseListLoadConfig, ListLoadResult<ArticleProxy>>(mRequestFactoryProxy, new ListReader<ArticleProxy>());
    It is completly untested code and only written here on the forums. No code checking was done.

  8. #8
    Sencha User
    Join Date
    May 2011
    Location
    Netherlands
    Posts
    48
    Vote Rating
    2
      0  

    Default

    Thanks, indeed it is just a helper class...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •