It really works! I'm very happy. Thank you a lot! I hope you have great success in what you do! You helped me so much with this!

1 Mar 2011, 4:05 AM

mxhn

Today, I've tried a new thing that would make it much easier to map the server beans directly to GXT components like the TreePanel. I'm trying to use TreeLoader and TreeBeanModelReader to directly map the returned beans from server. This is the code:

The issue is that the returned list cities doesn't contain instances of CityProxy but instances of CityProxyAutoBean_com_google_gwt_requestfactory_shared_impl_EntityProxyCategory_com_google_gwt_requestfactory_shared_impl_ValueProxyCategory_com_google_gwt_requestfactory_shared_impl_BaseProxyCategory extends com.google.gwt.autobean.shared.impl.AbstractAutoBean<com.tion.shared.CityProxy>.

All these instances are not implementing BeanModelTag. TreeBeanModelReader tries to do this:

and it returns NULL because beans.get(0).getClass() doesn't implement BeanModelTag.

Is there any way to make this work?

Thank you!

1 Mar 2011, 11:37 PM

mxhn

Any ideas?

7 Mar 2011, 5:22 AM

mxhn

I think all this is going down the "reinvent the wheel" road because GXT 3.0 will include full RequestFactory support.

@Stigrv, you said you converted your development webapplication from using GWT-RPC to using RequestFactory but did you redesign all GXT's classes like(BaseTreeLoader, BaseLoader, TreeStore) which still use GWT-RPC implementations or you just have something that works partially and you're still waiting for GXT 3.0 to be released?

I want to know this because I feel like this is no more a trivial change in GXT's code but a full implementation that is going to be released by them. So maybe it would be better to use GWT-RPC and then to switch to RequestFactory when GXT 3.0 gets released.

What was your motivation to switch to RequestFactory so early? How much time did you invest in getting GXT to be compatible with RequestFactory?

Thank you!

7 Mar 2011, 10:37 AM

stigrv

Sorry I didn't see your message earlier.

For the proxy that fails to be converted using the BeanModelFactory, you'll need to tag the proxy with BeanModelTag in order for the factory to know about and be able to convert it.

Loaders and stores are untouched, and are wired to RF instead of GWT-RPC in the presenter/activity layer.

For my motivation in switching to RF this early, this was mainly as an attempt to prepare our application for GXT3, mainly to reduce the work needed when it is released. It has to be noted that the application we are making is still in its early phase, and it is therefore not guaranteed that we've found all problems yet. With that being said, the only change I've done is the custom implementation of the generator. This generator solved the problem with empty beans that occured after converting the application into using RF instead og GWT-RPC.

It should also be noted that it took me over a week to convert our current codebase from GWT-RPC into RF and the rest of the GWT Bindings framework. Now that we are implementing more of the views needed, this was well spent time, as it will save us the work of doing this later, and therefore reducing duplicate work.

7 Mar 2011, 11:33 PM

mxhn

Thank you for helping me understand your motivation. It makes sense! I also feel this is the best option at the moment instead of going back to RPC and then, in a few months time, having to upgrade again. But I must admit I also had the feeling of not "reinventing the wheel" and I thought there were many changes to get RequestFactory integrated. I'm glad you and Colin Alworth made me feel more confident about this and go for RequestFactory. I appreciate you guys helped me!

Regarding the changes needed, I also found the need to override the TreeBeanModelReader(I'm using TreePanel mostly at this moment). I think in case I'll add components like grids, I'd have to also override BeanModelReader as well.

This is because GXT tries to get the BeanModel factory by using BeanModelFactory factory = BeanModelLookup.get().getFactory(beans.get(0).getClass()); and this returns NULL. GWT's RequestFactory generator takes the proxy interfaces(that include the ones tagged with BeanModelTag) and generates an AutoBean implementation but which isn't tagged directly with BeanModelTag. This implementation is not found by TreeBeanModelReader which returns an assertion error for such beans. Please see the whole issue here.

If this is a change that you already thought about and have an alternative fix or perhaps if you missed it, I'd be glad to know your thoughts about it.

23 Jul 2011, 4:25 PM

Algiano

Hi guys,

I'm also trying to implement this solution and I'm getting the following error. Any ideas?

Code:

[ERROR] [] - Line 16: No source code is available for type com.extjs.gxt.ui.rebind.core.BeanModelGenerator; did you forget to inherit a required module?
[ERROR] [] - Line 19: No source code is available for type com.google.gwt.core.ext.typeinfo.JClassType; did you forget to inherit a required module?
[ERROR] [] - Line 19: No source code is available for type com.google.gwt.core.ext.typeinfo.JMethod; did you forget to inherit a required module?

com.google.web.bindery.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$StandardPayloadDialect.processPayload(AbstractRequestContext.java:299)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$4.onTransportSuccess(AbstractRequestContext.java:951)
at com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:136)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.AssertionError: No BeanModelFactory found for class com.ronin.kioos.mapdesigner.client.connectivity.proxy.MallProxyAutoBean_com_google_web_bindery_requestfactory_shared_impl_EntityProxyCategory_com_google_web_bindery_requestfactory_shared_impl_ValueProxyCategory_com_google_web_bindery_requestfactory_shared_impl_BaseProxyCategory$1
at com.extjs.gxt.ui.client.data.BeanModelReader.read(BeanModelReader.java:48)
at com.extjs.gxt.ui.client.data.BeanModelReader.read(BeanModelReader.java:1)
at com.extjs.gxt.ui.client.data.MemoryProxy.load(MemoryProxy.java:48)
at com.extjs.gxt.ui.client.data.BaseLoader.loadData(BaseLoader.java:134)
at com.extjs.gxt.ui.client.data.BaseLoader.load(BaseLoader.java:98)
at com.extjs.gxt.ui.client.data.BaseLoader.load(BaseLoader.java:92)
at com.ronin.kioos.mapdesigner.client.views.MapCanvas$1.onSuccess(MapCanvas.java:201)
at com.ronin.kioos.mapdesigner.client.views.MapCanvas$1.onSuccess(MapCanvas.java:1)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequest.onSuccess(AbstractRequest.java:123)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$StandardPayloadDialect.processPayload(AbstractRequestContext.java:266)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$4.onTransportSuccess(AbstractRequestContext.java:951)
at com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:136)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)