RequestFactoryEditorDriver and multiple saves/persists

88 views
Skip to first unread message

Rob Whiteside

unread,
Mar 26, 2012, 6:15:59 PM3/26/12
to google-we...@googlegroups.com
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?

Thomas Broyer

unread,
Mar 27, 2012, 5:17:30 AM3/27/12
to google-we...@googlegroups.com
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.

Rob Whiteside

unread,
Mar 27, 2012, 2:18:22 PM3/27/12
to google-we...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages