Search in sources :

Example 71 with AsyncCallback

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());
        }
    });
}
Also used : GetUsersResponse(com.willshex.blogwt.shared.api.user.call.GetUsersResponse) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetUsersRequest(com.willshex.blogwt.shared.api.user.call.GetUsersRequest)

Example 72 with AsyncCallback

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());
        }
    });
}
Also used : GetPostsRequest(com.willshex.blogwt.shared.api.blog.call.GetPostsRequest) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetPostsResponse(com.willshex.blogwt.shared.api.blog.call.GetPostsResponse)

Example 73 with AsyncCallback

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);
}
Also used : AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) Date(java.util.Date)

Example 74 with AsyncCallback

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);
}
Also used : AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) Date(java.util.Date)

Example 75 with AsyncCallback

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);
}
Also used : AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) Date(java.util.Date)

Aggregations

AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)85 Test (org.junit.Test)13 GetSchema (org.activityinfo.shared.command.GetSchema)9 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)8 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)8 FormDialogCallback (org.activityinfo.client.page.common.dialog.FormDialogCallback)7 SchemaDTO (org.activityinfo.legacy.shared.model.SchemaDTO)6 FormDialogCallback (org.activityinfo.ui.client.page.common.dialog.FormDialogCallback)6 CallbackGroup (com.google.gerrit.client.rpc.CallbackGroup)4 FormDialogTether (org.activityinfo.client.page.common.dialog.FormDialogTether)4 ProjectDTO (org.activityinfo.legacy.shared.model.ProjectDTO)4 VoidResult (org.activityinfo.shared.command.result.VoidResult)4 FormDialogTether (org.activityinfo.ui.client.page.common.dialog.FormDialogTether)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 Set (java.util.Set)3 GetActivityForm (org.activityinfo.legacy.shared.command.GetActivityForm)3 VoidResult (org.activityinfo.legacy.shared.command.result.VoidResult)3 CreateResult (org.activityinfo.shared.command.result.CreateResult)3 ProjectDTO (org.activityinfo.shared.dto.ProjectDTO)3