use of com.willshex.blogwt.client.api.download.event.GetGeneratedDownloadsEventHandler.GetGeneratedDownloadsSuccess in project blogwt by billy1380.
the class GeneratedDownloadController method fetchGeneratedDownloads.
private void fetchGeneratedDownloads() {
final GetGeneratedDownloadsRequest input = ApiHelper.setAccessCode(new GetGeneratedDownloadsRequest()).pager(pager);
input.session(SessionController.get().sessionForApiCall());
if (getGeneratedDownloadsRequest != null) {
getGeneratedDownloadsRequest.cancel();
}
getGeneratedDownloadsRequest = ApiHelper.createDownloadClient().getGeneratedDownloads(input, new AsyncCallback<GetGeneratedDownloadsResponse>() {
@Override
public void onSuccess(GetGeneratedDownloadsResponse output) {
getGeneratedDownloadsRequest = null;
if (output.status == StatusType.StatusTypeSuccess) {
if (output.downloads != null && output.downloads.size() > 0) {
pager = output.pager;
updateRowCount(input.pager.count == null ? 0 : input.pager.count.intValue(), input.pager.count == null || input.pager.count.intValue() == 0);
updateRowData(input.pager.start.intValue(), output.downloads);
} else {
updateRowCount(input.pager.start.intValue(), true);
updateRowData(input.pager.start.intValue(), Collections.<GeneratedDownload>emptyList());
}
}
DefaultEventBus.get().fireEventFromSource(new GetGeneratedDownloadsSuccess(input, output), GeneratedDownloadController.this);
}
@Override
public void onFailure(Throwable caught) {
getGeneratedDownloadsRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetGeneratedDownloadsFailure(input, caught), GeneratedDownloadController.this);
}
});
}
Aggregations