RequestFactory, frozen autobeans, and MVP

75 views
Skip to first unread message

Steve C

unread,
Nov 18, 2015, 1:14:27 PM11/18/15
to GWT Users
I'm trying to convert an app from using plain JSON to using RequestFactory.  The app has a view and presenter.  So, I use the RequestFactory to get Contact instances, and pass them on the view to edit.  But, the editing runs into an issue with the AutoBean being frozen.  Without MVP, I would just open a request, invoke edit and pass the bean, and be done.  But, it doesn't seem right to now do that in the view.  And, I have an issue with holding a request open just to enable editing the bean, when it's conceivable that the user will bail out and not end up saving their changes.

So, what would the best flow be for this situation?


Jens

unread,
Nov 18, 2015, 1:38:19 PM11/18/15
to GWT Users
Have you called requestFactoryEditorDriver.edit(lockedProxyFromServer, requestContextUsedForSaving) ?

If you use SimpleBeanEditorDriver you have to do

T editableProxy = requestContextUsedForSaving.edit(lockedProxyFromServer);
simpleBeanEditorDriver.edit(editableProxy);

If the user does not end up saving any changes then you simply do not call flush(). I think thats the normal workflow (never really used RequestFactory). As you use MVP I would add a factory method to the view to create the editor driver since you need to GWT.create() it and you normally want to avoid GWT.create() in presenters. 

-- J.
Reply all
Reply to author
Forward
0 new messages