I create a form for editing an EntityProxy(campaignProxy) with the Editor +
RequestFactory, everything is working/saved in Database (create/edit).
But when i am editing a existing an existing Entity, all the entity is send
(i seeing this behaviour in firebug), even i made any changes in my object.
PRE editorDriver.isDirty() = false
POST editorDriver.isDirty() = false
The editor confirm any changes but in my firebug, in the panel network i see
{"F":"****.CampaignRequestFactory","O":[{"T":"aHB9TlK6zvrYcCFpvMxkS6KFH4w
=","V":"NTEuMA==","P":{"flights":[{"T":"Y4M0dDfC34axdGshieWi$JsiuEQ=","S":"MjguMA=="},{"T":"Y4M0dDfC34axdGshieWi$JsiuEQ
=","S":"MzMuMA=="}]},"S":"MzIuMA==","O":"UPDATE"},{"T":"Y4M0dDfC34axdGshieWi$JsiuEQ=","V":"NDkuMA=="
,"P":{"flightDayparts":[{"T":"m7TMD_VGSQ1a8KEFeD5jh$efaYo=","S":"MjkuMA=="}]},"S":"MjguMA==","O":"UPDATE"
},{"T":"m7TMD_VGSQ1a8KEFeD5jh$efaYo=","V":"NDkuMA==","S":"MjkuMA==","O":"UPDATE"},{"T":"Y4M0dDfC34axdGshieWi$JsiuEQ
=","V":"NTAuMA==","P":{"flightDayparts":[{"T":"m7TMD_VGSQ1a8KEFeD5jh$efaYo=","S":"MzQuMA=="}]},"S":"MzMuMA
==","O":"UPDATE"},{"T":"m7TMD_VGSQ1a8KEFeD5jh$efaYo=","V":"NTAuMA==","S":"MzQuMA==","O":"UPDATE"}],"I"
:[{"P":[{"T":"aHB9TlK6zvrYcCFpvMxkS6KFH4w=","S":"MzIuMA=="}],"O":"o5CHhcaaGm_AeZ6uNN2pVB0XjYQ="}]}
In the documentation is write
On the client side, RequestFactory keeps track of objects that have been
modified and sends only changes to the server, which results in very
lightweight network payloads
Here my java code
{{{
public class CampaignPanelImpl extends Composite implements CampaignPanel {
@Override
public void loadData(CampaignProxy campaignProxy, RequestContext
requestContext) {
this.campaignProxyEdited = campaignProxy;
//create a requestContext if we are in edit mode
RequestContext request = requestContext == null ?
contextProvider.get() : requestContext;
editorDriver.initialize(eventBus, requestFactory,
listFlightsEditor);
editorDriver.edit(campaignProxyEdited, request);
listFlightsEditor.setFlightTitles(campaignProxy.getFlights());
}
@UiHandler("saveContinueButton")
void save(ClickEvent event) {
GWT.log("PRE editorDriver.isDirty() = "+editorDriver.isDirty());
CampaignRequestContext requestContext =
(CampaignRequestContext)editorDriver.flush();
GWT.log("POST editorDriver.isDirty() = "+editorDriver.isDirty());
if (editorDriver.hasErrors()) {
Window.alert("there is some errors. Cannot save");
return;
}
presenter.save(requestContext,campaignProxyEdited);
}
}
public class CampaignActivity extends AbstractActivity implements
CampaignView.Presenter {
....
private void edit(String campaingId) {
contextProvider.get().getCampaignById(new
Integer(campaingId)).with("flights", "flights.flightDayparts")
.fire(new Receiver<CampaignProxy>() {
@Override
public void onSuccess(CampaignProxy campaignProxy) {
editCampaignFlightsView.loadData(campaignProxy,
null);
}
});
}
.....
@Override
public void save(CampaignRequestContext request, CampaignProxy
campaignProxy) {
request.save(campaignProxy).fire(new Receiver<Void>() {
@Override
public void onSuccess(Void response) {
navigationController.next();
}
public void onFailure(ServerFailure error) {
Window.alert(error.getMessage());
}
});
....
}
}}}
Any Guess, whats wrong. thanks
--
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/-/wa4mmnyG8uIJ.
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.