use of com.willshex.blogwt.client.api.page.event.GetPagesEventHandler.GetPagesSuccess in project blogwt by billy1380.
the class PageController method fetchPages.
private void fetchPages() {
final GetPagesRequest input = ApiHelper.setAccessCode(new GetPagesRequest());
input.pager = pager;
input.session = SessionController.get().sessionForApiCall();
input.includePosts = Boolean.FALSE;
if (getPagesRequest != null) {
getPagesRequest.cancel();
}
getPagesRequest = ApiHelper.createPageClient().getPages(input, new AsyncCallback<GetPagesResponse>() {
@Override
public void onSuccess(GetPagesResponse output) {
getPagesRequest = null;
if (output.status == StatusType.StatusTypeSuccess) {
if (output.pages != null && output.pages.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.pages);
} else {
updateRowCount(input.pager.start.intValue(), true);
updateRowData(input.pager.start.intValue(), Collections.<Page>emptyList());
}
}
DefaultEventBus.get().fireEventFromSource(new GetPagesSuccess(input, output), PageController.this);
}
@Override
public void onFailure(Throwable caught) {
getPagesRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetPagesFailure(input, caught), PageController.this);
}
});
}
Aggregations