Tuesday, March 27, 2012

Re: RequestFactoryEditorDriver and multiple saves/persists

Thomas, 

Perfect, thanks much for the reply (and may I say that your few blog posts about editors and RequestFactory have been very helpful!).

--Rob

On Tuesday, March 27, 2012 2:17:30 AM UTC-7, Thomas Broyer wrote:


On Tuesday, March 27, 2012 12:15:59 AM UTC+2, Rob Whiteside wrote:
Hi,

I'm using RequestFactoryEditorDriver to drive my editor.  In this case, the editor is displayed and the user may make some changes, hit save, make some more changes and hit save again.  All the while the same editor is shown.

When the user clicks the save button, I do a driver.flush().fire().  This works great to save the data to the server, the first time.  The second time the user clicks "save" I get an "IllegalStateException: A request is already in progress".  Now, I totally understand the issue, my question is what to do about it.  Is there an established/expected way to deal with this?  After a save, should I call "edit" on the driver again with a new requestContext?

Yes, absolutely. That also means you should make the editor read-only (or mask/hide it or whatever) while the request is in progress (between the time you call fire() and the time onSuccess is called back).
...except in case of violations, where the proxies are put back in an editable state (so you can fix the violations and fire() the RequestContext back again). In this case, make sure you don't queue your method invocations twice in the RequestContext, or they'll be called twice on the server when you fire() the RequestContext for the second time.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/ZCn2oLkK78YJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment