use of com.willshex.blogwt.client.api.blog.event.GetPropertiesEventHandler.GetPropertiesFailure in project blogwt by billy1380.
the class PropertyController method fetchProperties.
private void fetchProperties() {
final GetPropertiesRequest input = ApiHelper.setAccessCode(new GetPropertiesRequest());
input.pager = pager;
input.session = SessionController.get().sessionForApiCall();
if (getPropertiesRequest != null) {
getPropertiesRequest.cancel();
}
getPropertiesRequest = ApiHelper.createBlogClient().getProperties(input, new AsyncCallback<GetPropertiesResponse>() {
@Override
public void onSuccess(GetPropertiesResponse output) {
getPropertiesRequest = null;
if (output.status == StatusType.StatusTypeSuccess) {
if (output.properties != null && output.properties.size() > 0) {
pager = output.pager;
JsonArray propertyArray = new JsonArray();
for (Property p : output.properties) {
propertyArray.add(p.toJson());
}
Window.get().setProperties(propertyArray.toString());
}
}
DefaultEventBus.get().fireEventFromSource(new GetPropertiesSuccess(input, output), PropertyController.this);
}
@Override
public void onFailure(Throwable caught) {
getPropertiesRequest = null;
DefaultEventBus.get().fireEventFromSource(new GetPropertiesFailure(input, caught), PropertyController.this);
}
});
}
Aggregations