use of com.willshex.blogwt.shared.api.page.call.SubmitFormResponse in project blogwt by billy1380.
the class PageService method submitForm.
public Request submitForm(SubmitFormRequest input, AsyncSuccess<SubmitFormRequest, SubmitFormResponse> onSuccess, AsyncFailure<SubmitFormRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(PageMethodSubmitForm, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
SubmitFormResponse outputParameter = new SubmitFormResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(PageService.this, PageMethodSubmitForm, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(PageService.this, PageMethodSubmitForm, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(PageService.this, PageMethodSubmitForm, input, exception);
}
});
onCallStart(PageService.this, PageMethodSubmitForm, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(PageService.this, PageMethodSubmitForm, input, exception);
}
return handle;
}
use of com.willshex.blogwt.shared.api.page.call.SubmitFormResponse in project blogwt by billy1380.
the class FormController method submitForm.
public void submitForm(Form form) {
final SubmitFormRequest input = ApiHelper.setAccessCode(new SubmitFormRequest());
input.form = form;
ApiHelper.createPageClient().submitForm(input, new AsyncCallback<SubmitFormResponse>() {
@Override
public void onSuccess(SubmitFormResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
}
DefaultEventBus.get().fireEventFromSource(new SubmitFormEventHandler.SubmitFormSuccess(input, output), FormController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new SubmitFormEventHandler.SubmitFormFailure(input, caught), FormController.this);
}
});
}
Aggregations