1. #1
    Sencha User
    Join Date
    Jan 2011
    Location
    Lima, Peru
    Posts
    43
    Answers
    5
    Vote Rating
    4
    poseidonjm is on a distinguished road

      0  

    Default Answered: RequestFactory Grid Objectify

    Answered: RequestFactory Grid Objectify


    My GXT3 Grid doesn´t function with my code in RequestFactory-Objectify
    http://vivagwt.blogspot.com/2011/09/requestfactory-con-objectify.html
    I tried to adapt this code with the example
    http://sencha.com/examples-dev/#ExamplePlace:requestfactorygrid
    but I couldn´t, maybe because the example is using ValueProxy and I´m using EntityProxy
    The another example use EntityProxy
    http://sencha.com/examples-dev/#ExamplePlace:requestfactorybinding
    but I need paginate.
    My original code is here
    http://www.2shared.com/file/cDedheRb/ExampleRF.html
    My modified code with gxt3 is here
    http://www.2shared.com/file/8LILTHbB/ExampleRF.html
    I´m using Eclipse 3.7 with GPE, GWT 2.4.0, AppEngine 1.6.0, gxt-3.0.0-beta1.jar

    a piece of my code:
    Code:
    package com.examplerf.shared.service;
    
    import java.util.List;
    
    
    import com.examplerf.server.domain.Colaborador;
    import com.examplerf.server.locator.DaoServiceLocator;
    import com.examplerf.server.service.ColaboradorDao;
    import com.examplerf.shared.proxy.ColaboradorProxy;
    import com.google.web.bindery.requestfactory.shared.ProxyFor;
    import com.google.web.bindery.requestfactory.shared.Request;
    import com.google.web.bindery.requestfactory.shared.RequestContext;
    import com.google.web.bindery.requestfactory.shared.Service;
    import com.google.web.bindery.requestfactory.shared.ValueProxy;
    import com.sencha.gxt.data.shared.SortInfo;
    import com.sencha.gxt.data.shared.loader.PagingLoadResult;
    import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
    
    
    @Service(value = ColaboradorDao.class, locator = DaoServiceLocator.class)
    public interface ColaboradorService extends RequestContext {
        Request<List<ColaboradorProxy>> listAll();
        Request<ColaboradorProxy> fetch(Long id);
        Request<Void> save(ColaboradorProxy colaborador);
        Request<Void> remove(Long id);
        
        @ProxyFor(ColaboradorPagingLoadResultBean.class)
        public interface ColaboradorPagingLoadResultProxy extends ValueProxy, PagingLoadResult<ColaboradorProxy> {
            @Override
            public List<ColaboradorProxy> getData();
        }
        
        @SuppressWarnings("serial")
        public static class ColaboradorPagingLoadResultBean extends PagingLoadResultBean<Colaborador> {
            public ColaboradorPagingLoadResultBean(List<Colaborador> list, int totalLength, int offset) {
              super(list, totalLength, offset);
            }        
        }
        
        Request<ColaboradorPagingLoadResultProxy> listPaginate(int offset, int limit,
                List<? extends SortInfo> sortInfo);
        
        
    }
    my proxy:
    Code:
    package com.examplerf.shared.proxy;
    
    
    import com.examplerf.server.domain.Colaborador;
    import com.examplerf.server.locator.ObjectifyLocator;
    import com.google.web.bindery.requestfactory.shared.EntityProxy;
    import com.google.web.bindery.requestfactory.shared.ProxyFor;
    
    
    @ProxyFor(value = Colaborador.class, locator = ObjectifyLocator.class)
    public interface ColaboradorProxy extends EntityProxy {
    	String getNombres();
    	void setNombres(String nombres);
    	String getApellidos();
    	void setApellidos(String apellidos);
    	Integer getEdad();
    	void setEdad(Integer edad);	
    }
    please give me some advice.

  2. You are using a class, that is inside a package that is configured not to be used on clientside. Normally the server package is (and should be) not used on the client side.

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,644
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Before I try to download/configure/run the linked project, can you share what it is that isn't working? Are you getting errors when you run or compile, or is it just not showing the correct data?

    Is that your blog post? And are you sure that the problem is in GXT and not in Objectify, a third-party library?

  4. #3
    Sencha User
    Join Date
    Jan 2011
    Location
    Lima, Peru
    Posts
    43
    Answers
    5
    Vote Rating
    4
    poseidonjm is on a distinguished road

      0  

    Default


    I'm sorry
    I get the error when I tried to run in hosted mode

    [ERROR] [examplerf] - Line 32: No source code is available for type com.examplerf.server.domain.Colaborador; did you forget to inherit a required module?
    error.jpg

    And yes http://vivagwt.blogspot.com/ is my blog and objectify is ok,

  5. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Answers
    60
    Vote Rating
    130
    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


    You are using a class, that is inside a package that is configured not to be used on clientside. Normally the server package is (and should be) not used on the client side.

  6. #5
    Sencha User
    Join Date
    Jan 2011
    Location
    Lima, Peru
    Posts
    43
    Answers
    5
    Vote Rating
    4
    poseidonjm is on a distinguished road

      0  

    Default


    Hi sven, you're right
    Code:
    package com.examplerf.shared.service;
    
    import java.util.List;
    
    
    import com.examplerf.server.domain.Colaborador;
    import com.examplerf.server.locator.DaoServiceLocator;
    import com.examplerf.server.service.ColaboradorDao;
    import com.examplerf.shared.proxy.ColaboradorProxy;
    import com.google.web.bindery.requestfactory.shared.ProxyFor;
    import com.google.web.bindery.requestfactory.shared.Request;
    import com.google.web.bindery.requestfactory.shared.RequestContext;
    import com.google.web.bindery.requestfactory.shared.Service;
    import com.google.web.bindery.requestfactory.shared.ValueProxy;
    import com.sencha.gxt.data.shared.SortInfo;
    import com.sencha.gxt.data.shared.loader.PagingLoadResult;
    import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
    
    
    @Service(value = ColaboradorDao.class, locator = DaoServiceLocator.class)
    public interface ColaboradorService extends RequestContext {
    	Request<List<ColaboradorProxy>> listAll();
    	Request<ColaboradorProxy> fetch(Long id);
    	Request<Void> save(ColaboradorProxy colaborador);
    	Request<Void> remove(Long id);
    	
    	@ProxyFor(ColaboradorPagingLoadResultBean.class)
    	public interface ColaboradorPagingLoadResultProxy extends ValueProxy, PagingLoadResult<ColaboradorProxy> {
    	    @Override
    	    public List<ColaboradorProxy> getData();
    	}
    	
    	@SuppressWarnings("serial")
    	public static class ColaboradorPagingLoadResultBean extends PagingLoadResultBean<Colaborador> {
    	    public ColaboradorPagingLoadResultBean(List<Colaborador> list, int totalLength, int offset) {
    	      super(list, totalLength, offset);
    	    }	    
    	}
    	
    	Request<ColaboradorPagingLoadResultProxy> listPaginate(int offset, int limit,
    			List<? extends SortInfo> sortInfo);
    	
    	
    }
    Here ColaboradorPagingLoadResultBean is extend PagingLoadResultBean<Colaborador> and Colaborador is on server.
    But if i use RequestFactory with Objectify or JPA I need to create two files Colaborador the domain class in the server and the interface ColaboradorProxy in client.

    In the sample
    Code:
    /** * Ext GWT 3.0.0-beta1 - Ext for GWT
     * Copyright(c) 2007-2011, Sencha, Inc.
     * licensing@sencha.com
     *
     * http://sencha.com/license
     */
    package com.sencha.gxt.examples.resources.shared;
    
    
    import java.util.List;
    
    
    import com.google.web.bindery.requestfactory.shared.ProxyFor;
    import com.google.web.bindery.requestfactory.shared.Request;
    import com.google.web.bindery.requestfactory.shared.RequestContext;
    import com.google.web.bindery.requestfactory.shared.Service;
    import com.google.web.bindery.requestfactory.shared.ValueProxy;
    import com.sencha.gxt.data.shared.SortInfo;
    import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
    import com.sencha.gxt.data.shared.loader.PagingLoadResult;
    import com.sencha.gxt.examples.resources.client.model.Post;
    import com.sencha.gxt.examples.resources.server.PostService;
    import com.sencha.gxt.examples.resources.server.PostServiceLocator;
    
    
    @Service(value = PostService.class, locator = PostServiceLocator.class)
    public interface PostRequest extends RequestContext {
      @ProxyFor(PostPagingLoadResultBean.class)
      public interface PostPagingLoadResultProxy extends EntityProxy, PagingLoadResult<PostProxy> {
        @Override
        public List<PostProxy> getData();
      }
      
      public static class PostPagingLoadResultBean extends PagingLoadResultBean<Post> {
        public PostPagingLoadResultBean(List<Post> list, int totalLength, int offset) {
          super(list, totalLength, offset);
        }
      }
    
    
      Request<PostPagingLoadResultProxy> getPosts(int offset, int limit, List<? extends SortInfo> sortInfo);
    }
    Why Post ant PostProxy are in the client?
    What can I do? create a third class in the client?

  7. #6
    Sencha User
    Join Date
    Jan 2011
    Location
    Lima, Peru
    Posts
    43
    Answers
    5
    Vote Rating
    4
    poseidonjm is on a distinguished road

      0  

    Default


    I did it.
    I put ColaboradorPagingLoadResultBean in the server
    Code:
    package com.examplerf.server.domain;
    
    import java.util.List;
    
    
    import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
    
    
    @SuppressWarnings("serial")
    public class ColaboradorPagingLoadResultBean extends PagingLoadResultBean<Colaborador> {
        public ColaboradorPagingLoadResultBean(List<Colaborador> list, int totalLength, int offset) {
          super(list, totalLength, offset);
        }	    
    }
    and my class RequestContext looks like this
    Code:
    package com.examplerf.shared.service;
    
    import java.util.List;
    
    
    import com.examplerf.server.domain.ColaboradorPagingLoadResultBean;
    import com.examplerf.server.locator.DaoServiceLocator;
    import com.examplerf.server.service.ColaboradorDao;
    import com.examplerf.shared.proxy.ColaboradorProxy;
    import com.google.web.bindery.requestfactory.shared.ProxyFor;
    import com.google.web.bindery.requestfactory.shared.Request;
    import com.google.web.bindery.requestfactory.shared.RequestContext;
    import com.google.web.bindery.requestfactory.shared.Service;
    import com.google.web.bindery.requestfactory.shared.ValueProxy;
    import com.sencha.gxt.data.shared.SortInfo;
    import com.sencha.gxt.data.shared.loader.PagingLoadResult;
    
    
    @Service(value = ColaboradorDao.class, locator = DaoServiceLocator.class)
    public interface ColaboradorService extends RequestContext {
    	Request<List<ColaboradorProxy>> listAll();
    	Request<ColaboradorProxy> fetch(Long id);
    	Request<Void> save(ColaboradorProxy colaborador);
    	Request<Void> remove(Long id);
    		
    	@ProxyFor(value = ColaboradorPagingLoadResultBean.class)
    	public interface ColaboradorPagingLoadResultProxy extends ValueProxy, PagingLoadResult<ColaboradorProxy> {
    	    @Override
    	    public List<ColaboradorProxy> getData();
    	}
    	
    	Request<ColaboradorPagingLoadResultProxy> listPaginate(int offset, int limit,
    			List<? extends SortInfo> sortInfo);	
    }
    If somebody want to try here is my code
    http://www.2shared.com/file/BbDwiO9b/ExampleRF.html
    Still I'm not sure this is the right way

Thread Participants: 2

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