use of com.google.gwt.user.client.rpc.AsyncCallback in project blogwt by billy1380.
the class UserOracle method lookup.
/* (non-Javadoc)
*
* @see
* com.willshex.blogwt.client.oracle.SuggestOracle#lookup(com.google.gwt
* .user.client.ui.SuggestOracle.Request,
* com.google.gwt.user.client.ui.SuggestOracle.Callback) */
@Override
protected void lookup(final Request request, final Callback callback) {
final GetUsersRequest input = ApiHelper.setAccessCode(new GetUsersRequest());
input.session = SessionController.get().sessionForApiCall();
input.query = request.getQuery();
input.pager = PagerHelper.createDefaultPager();
input.pager.count = Integer.valueOf(request.getLimit());
if (getUsersRequest != null) {
getUsersRequest.cancel();
}
clearSelected();
getUsersRequest = ApiHelper.createUserClient().getUsers(input, new AsyncCallback<GetUsersResponse>() {
@Override
public void onSuccess(GetUsersResponse output) {
if (output.status == StatusType.StatusTypeSuccess && output.pager != null) {
foundItems(request, callback, output.users);
} else {
foundItems(request, callback, Collections.<User>emptyList());
}
}
@Override
public void onFailure(Throwable caught) {
GWT.log("Error getting users with query " + input.query, caught);
foundItems(request, callback, Collections.<User>emptyList());
}
});
}
use of com.google.gwt.user.client.rpc.AsyncCallback in project blogwt by billy1380.
the class PostOracle method lookup.
/* (non-Javadoc)
*
* @see
* com.willshex.blogwt.client.oracle.SuggestOracle#lookup(com.google.gwt
* .user.client.ui.SuggestOracle.Request,
* com.google.gwt.user.client.ui.SuggestOracle.Callback) */
@Override
protected void lookup(final Request request, final Callback callback) {
final GetPostsRequest input = ApiHelper.setAccessCode(new GetPostsRequest());
input.session = SessionController.get().sessionForApiCall();
input.includePostContents = Boolean.FALSE;
input.query = request.getQuery();
input.pager = PagerHelper.createDefaultPager();
input.pager.count = Integer.valueOf(request.getLimit());
input.showAll = Boolean.TRUE;
if (getPostsRequest != null) {
getPostsRequest.cancel();
}
getPostsRequest = ApiHelper.createBlogClient().getPosts(input, new AsyncCallback<GetPostsResponse>() {
@Override
public void onSuccess(GetPostsResponse output) {
if (output.status == StatusType.StatusTypeSuccess && output.pager != null) {
foundItems(request, callback, output.posts);
} else {
foundItems(request, callback, Collections.<Post>emptyList());
}
}
@Override
public void onFailure(Throwable caught) {
GWT.log("Error getting posts with query " + input.query, caught);
foundItems(request, callback, Collections.<Post>emptyList());
}
});
}
use of com.google.gwt.user.client.rpc.AsyncCallback in project goldenorb by jzachr.
the class OrbTrackerStatus method refreshJobsInProgress.
private void refreshJobsInProgress() {
// initialize service
if (dataService == null) {
dataService = GWT.create(OrbTrackerMemberDataService.class);
}
// set up callback
AsyncCallback<String[]> callback = new AsyncCallback<String[]>() {
@SuppressWarnings("deprecation")
public void onFailure(Throwable caught) {
// If error occurred while getting updates
String details = caught.getMessage();
if (caught instanceof WatcherException) {
details = ((WatcherException) caught).getErrorMessage();
} else if (caught instanceof ZooKeeperConnectionException) {
details = ((ZooKeeperConnectionException) caught).getErrorMessage();
} else if (caught instanceof NodeDoesNotExistException) {
details = ((NodeDoesNotExistException) caught).getErrorMessage();
}
errorLabelJIP.setText(details);
errorLabelJIP.setVisible(true);
lastUpdatedLabel.setText("Last Updated : " + DateTimeFormat.getMediumDateTimeFormat().format(new Date()));
clearTables(jobsInProgressPanel);
}
@SuppressWarnings("deprecation")
public void onSuccess(String[] result) {
updateJobTable(result, jobsInProgressPanel);
lastUpdatedLabel.setText("Last Updated : " + DateTimeFormat.getMediumDateTimeFormat().format(new Date()));
errorLabelJIP.setVisible(false);
}
};
dataService.getJobsInProgress(callback);
}
use of com.google.gwt.user.client.rpc.AsyncCallback in project goldenorb by jzachr.
the class OrbTrackerStatus method refreshJobsInQueue.
private void refreshJobsInQueue() {
// initialize service
if (dataService == null) {
dataService = GWT.create(OrbTrackerMemberDataService.class);
}
// set up callback
AsyncCallback<String[]> callback = new AsyncCallback<String[]>() {
@SuppressWarnings("deprecation")
public void onFailure(Throwable caught) {
// If error occurred while getting updates
String details = caught.getMessage();
if (caught instanceof WatcherException) {
details = ((WatcherException) caught).getErrorMessage();
} else if (caught instanceof ZooKeeperConnectionException) {
details = ((ZooKeeperConnectionException) caught).getErrorMessage();
} else if (caught instanceof NodeDoesNotExistException) {
details = ((NodeDoesNotExistException) caught).getErrorMessage();
}
errorLabelJQ.setText(details);
errorLabelJQ.setVisible(true);
lastUpdatedLabel.setText("Last Updated : " + DateTimeFormat.getMediumDateTimeFormat().format(new Date()));
clearTables(jobsInQueuePanel);
}
@SuppressWarnings("deprecation")
public void onSuccess(String[] result) {
updateJobTable(result, jobsInQueuePanel);
lastUpdatedLabel.setText("Last Updated : " + DateTimeFormat.getMediumDateTimeFormat().format(new Date()));
errorLabelJQ.setVisible(false);
}
};
dataService.getJobsInQueue(callback);
}
use of com.google.gwt.user.client.rpc.AsyncCallback in project goldenorb by jzachr.
the class OrbTrackerStatus method refreshWatchDataList.
private void refreshWatchDataList() {
// initialize service
if (dataService == null) {
dataService = GWT.create(OrbTrackerMemberDataService.class);
}
// set up callback
AsyncCallback<OrbTrackerMemberData[]> callback = new AsyncCallback<OrbTrackerMemberData[]>() {
@SuppressWarnings("deprecation")
public void onFailure(Throwable caught) {
// If error occurred while getting updates
String details = caught.getMessage();
if (caught instanceof WatcherException) {
details = ((WatcherException) caught).getErrorMessage();
} else if (caught instanceof ZooKeeperConnectionException) {
details = ((ZooKeeperConnectionException) caught).getErrorMessage();
} else if (caught instanceof NodeDoesNotExistException) {
details = ((NodeDoesNotExistException) caught).getErrorMessage();
}
errorLabelOTM.setText(details);
errorLabelOTM.setVisible(true);
lastUpdatedLabel.setText("Last Updated : " + DateTimeFormat.getMediumDateTimeFormat().format(new Date()));
clearTables(orbTrackerFlexTable);
}
@SuppressWarnings("deprecation")
public void onSuccess(OrbTrackerMemberData[] result) {
updateTable(result);
lastUpdatedLabel.setText("Last Updated : " + DateTimeFormat.getMediumDateTimeFormat().format(new Date()));
errorLabelOTM.setVisible(false);
}
};
// Make the call to the OrbTrackerMemberData service.
dataService.getOrbTrackerMemberData(callback);
}
Aggregations