On Thu, Sep 29, 2011 at 9:26 PM, Thomas Seven <[email protected]> wrote:
>
> Update: It only works if I flush() the EditorDriver and then fire() the
> resulting context.
>

Oops, I was mistaken, you cannot have two mutable versions of the same
proxy at once, so you cannot simply not fire() the context to discard
it as I said. !
Seems like there should be a way to discard a context and any
accumulated changes in that case.. I don't see a way to do this in the
docs..

It sounds like your actually persist()'ing the object and then
remove()'ing it in a subsequent request. Not a big deal, but it is
possible to do it in just one request. Its a matter of keeping around
the RequestContext you pass to your editor driver, and deciding which
service method to invoke on it later. Say its called 'editContext' and
you start your editing like:

editor.edit(proxy, editContext);

Later you can either persist:

editor.flush(); // flush() returns the RequestContext passed into
edit(), for convenience, but we are keeping it around anyway.
editContext.persist().using(proxy)
editContext.fire();

Or remove:

// No need to call flush(), we don't care about any changes.
editContext.remove().using(proxy)
editContext.fire();


I think in a few of the docs/examples, the persist() method is queued
at the same time as starting the editing, but it can be delayed until
later, when you know you are actually going to persist it. Again, its
just a matter of keeping around the 'editContext' and deciding which
method to call on it once you know.

PS. Your persist()/remove() calls might look like 'persist(proxy)',
instead of 'persist().using(proxy)'

-- 
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.

Reply via email to