use of com.willshex.blogwt.client.api.user.event.GetUsersEventHandler.GetUsersFailure in project blogwt by billy1380.
the class UserController method fetchUsers.
private void fetchUsers() {
final GetUsersRequest input = ApiHelper.setAccessCode(new GetUsersRequest());
input.pager = pager;
input.session = SessionController.get().sessionForApiCall();
if (getUsersRequest != null) {
getUsersRequest.cancel();
}
getUsersRequest = ApiHelper.createUserClient().getUsers(input, new AsyncCallback<GetUsersResponse>() {
@Override
public void onSuccess(GetUsersResponse output) {
getUsersRequest = null;
if (output.status == StatusType.StatusTypeSuccess) {
if (output.users != null && output.users.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.users);
} else {
updateRowCount(input.pager.start.intValue(), true);
updateRowData(input.pager.start.intValue(), Collections.<User>emptyList());
}
}
DefaultEventBus.get().fireEventFromSource(new GetUsersSuccess(input, output), UserController.this);
}
@Override
public void onFailure(Throwable caught) {
getUsersRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetUsersFailure(input, caught), UserController.this);
}
});
}
Aggregations