use of com.sencha.gxt.widget.core.client.event.CloseEvent in project activityinfo by bedatadriven.
the class FormInputView method save.
public void save(CloseEvent.CloseHandler closeHandler) {
// If the view model is still loading, ignore this click
if (viewModel == null) {
return;
}
if (!viewModel.isValid()) {
MessageBox box = new MessageBox(I18N.CONSTANTS.error(), I18N.CONSTANTS.pleaseFillInAllRequiredFields());
box.setModal(true);
box.show();
return;
}
// Good to go...
RecordTransaction tx = viewModel.buildTransaction();
LOGGER.info("Submitting transaction: " + Json.stringify(tx));
formStore.updateRecords(tx).then(new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
MessageBox box = new MessageBox(I18N.CONSTANTS.serverError(), I18N.CONSTANTS.errorOnServer());
box.setModal(true);
box.show();
}
@Override
public void onSuccess(Void result) {
closeHandler.onClose(new CloseEvent(null));
}
});
}
Aggregations