Results 1 to 3 of 3

Thread: RPCProxy and gwt-dispatch

  1. #1
    Sencha User
    Join Date
    Oct 2009
    Posts
    40

    Default RPCProxy and gwt-dispatch

    Hi!I'm trying to do a little something in GXT and I want to use List from
    GXT and RPCProxy.
    Let's say I have a bean class of Foo. I have an action called
    ListFooAction and result associated with it - ListFooResult.
    ListFooAction is empty, since I want to list all my Foo's, and
    ListFooResult contains a list of all Foo objects - List<Foo>.
    Now what I'd like to do, is to load my foo objects using gwt-dispatch
    inside RPCProxy load method. After looking into GXT list examples, I
    assume my RPCProxy should be like this: RPCProxy<List<Foo>>. I have to
    provide implementation for abstract method - load:

    Code:
    @Override
    protected void load(Object loadConfig,  AsyncCallback<List<Foo>> callback) {
    
        }
    };
    Now I'd like to execute my ListFooAction using DispatchAsync inside that
    method to load all my Foo objects. Doing so, I would have an
    AsyncCallback<ListFooResult>. But RPCProxy load method has
    AsyncCallback<List<Foo>>, and I have List<Foo> inside my FooResult. How
    can I "transfer" list from my result to the callback from the load
    method? Is this possible? Or maybe there is better approach to achieve
    what I'm trying to do?
    Regards
    Baczek00

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Mountain View
    Posts
    3

    Default

    did you fix it?

  3. #3
    Sencha User
    Join Date
    Oct 2009
    Posts
    40

    Default

    Quote Originally Posted by twoSeven View Post
    did you fix it?
    Yes. Here is a sample of my code:

    Code:
     public PagingLoader<PagingLoadConfig, PagingLoadResult<BaseModelData>> getLoaderOfflineModelData(final Boolean commitTrasactionAfterOK, final DBAction action, final NaviSoftFormOperation formParent, final String sSQL, final String nameGrid) {
            RpcProxy<PagingLoadConfig, PagingLoadResult<BaseModelData>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<BaseModelData>>() {
                @Override
                public void load(final PagingLoadConfig loadConfig, final AsyncCallback<PagingLoadResult<BaseModelData>> callback) {
                    AsyncCallback<PrimaryKeyResult> callbackPK = new AsyncCallback<PrimaryKeyResult>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            throw new UnsupportedOperationException("Not supported yet.");
                        }
    
                        @Override
                        public void onSuccess(PrimaryKeyResult result) {
                            primaryKey = result.getListPrimaryKey();
                            dispatch.getDispatchAsync().execute(new LoaderData(commitTrasactionAfterOK, action, sSQL, formParent.getClass().getName(), nameGrid, loadConfig), new AsyncCallback<LoaderDataResult>() {
    
                                @Override
                                public void onFailure(Throwable caught) {
                                    callback.onFailure(caught);
                                }
    
                                @Override
                                public void onSuccess(LoaderDataResult result) {
                                    callback.onSuccess(result.getPagingLoader());
                                }
                            });
                        }
                    };
                }
            };
            loaderPaging = new PagingLoader<PagingLoadConfig, PagingLoadResult<BaseModelData>>(proxy);
            return loaderPaging;
        }
    Regards
    Baczek00

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
  •