Oh I totally missed that one. With a call to persist it works. Don't know why I dont got this. Seems logical to tell the RequestContext what to do when driver.flush().fire(..) is called.
Now as editor + persisting works I realize that after driver.flush().fire() successfully finished the object I passed in to the editor and to ctx.persist(selectedExampleProxy) is frozen again and still has the old values and not the new values from the ui editor. Is this intended? I thought calling flush() would save the UI values to the object. So am I forced to listen for EntityProxyChange events and fetch the just persisted object again over the wire just to have the updated values? Seems a bit overhead and also impractically to me. Wouldn't it be better to write changes to the object passed into the editor once the flush().fire() call succeeds as well as firing the change event (as a result of the change event most event listeners will probably do a requestFactory.find(event.getEntityProxyId()) to fetch the updated entity. So the just edited entity could also be cached somehow to prevent additional requests over the wire)? On 11 Nov., 13:29, Thomas Broyer <[email protected]> wrote: > On 10 nov, 17:38, Jack <[email protected]> wrote: > > > > > > > > > > > Hi, > > > We start integrating RequestFactory and Editors into our app. But we > > constantly get an "AssertionError: addInvocation() should have > > failed". From GWT source code it seems that this error will occur when > > calling more then one request method defined in a service method stub > > before calling fire(). But I am pretty sure that our code won't do > > that. > > > We have a custom list widget that has to show some EntityProxy > > objects, so we load them via > > > requestFactory.exampleProxyRequest().findAll().with("someproperty").fire(ne > > w > > Receiver<List<ExampleProxy>() { ... }) > > > and put the result into our list (this list is not an editor, its just > > for selecting an item). > > When a list item becomes selected we want to edit the selected item in > > a different view/presenter so we pass it to that presenter and do: > > > interface DataBindingManager extends > > RequestFactoryEditorDriver<ExampleProxy, > > ExampleProxyPresenter.Display> {} > > > ... > > > this.dataBindingManager = GWT.create(DataBindingManager.class); > > this.dataBindingManager.initialize(this.requestFactory, > > this.getDisplay()); //requestFactory is a singleton through gin > > this.dataBindingManager.edit(selectedExampleProxy, > > this.requestFactory.exampleProxyRequest()); > > > Now the display gets populated with all data and after we edited some > > data and want to save this data we do: > > > RequestContext ctx = this.dataBindingManager.flush(); > > ctx.fire(new Receiver<Void>() { ... }); > > > The call to fire causes the AssertionError: addInvocation() should > > have failed in > > AbstractRequestContext.makePayload(AbstractRequestContext.java:441). > > > Any ideas? Am I doing something wrong? That error really drives me > > nuts. > > I don't see a RequestFactory "method call" in the snippets of code > above, such as ctx.persist(selectedExampleProxy). > > Have a look at the Expenses sample, what it does is basically: > ExampleProxyRequest ctx = requestFactory.exampleProxyRequest(); > dataBindingManager.edit(selectedExampleProxy, ctx); > ctx.persist(selectedExampleProxy); > > so that when you driver.flush().fire(...), the persist() method will > be called/sent to the server to persist your object. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
