Search in sources :

Example 41 with AsyncCallback

use of com.google.gwt.user.client.rpc.AsyncCallback in project blogwt by billy1380.

the class UserController method getUser.

/**
 * @param user
 */
public void getUser(User user) {
    final GetUserDetailsRequest input = ApiHelper.setAccessCode(new GetUserDetailsRequest());
    input.session = SessionController.get().sessionForApiCall();
    input.user = user;
    if (getUserRequest != null) {
        getUserRequest.cancel();
    }
    getUserRequest = ApiHelper.createUserClient().getUserDetails(input, new AsyncCallback<GetUserDetailsResponse>() {

        @Override
        public void onSuccess(GetUserDetailsResponse output) {
            getUserRequest = null;
            if (output.status == StatusType.StatusTypeSuccess) {
            }
            DefaultEventBus.get().fireEventFromSource(new GetUserDetailsSuccess(input, output), UserController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            DefaultEventBus.get().fireEventFromSource(new GetUserDetailsFailure(input, caught), UserController.this);
        }
    });
}
Also used : GetUserDetailsRequest(com.willshex.blogwt.shared.api.user.call.GetUserDetailsRequest) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetUserDetailsResponse(com.willshex.blogwt.shared.api.user.call.GetUserDetailsResponse) GetUserDetailsSuccess(com.willshex.blogwt.client.api.user.event.GetUserDetailsEventHandler.GetUserDetailsSuccess) GetUserDetailsFailure(com.willshex.blogwt.client.api.user.event.GetUserDetailsEventHandler.GetUserDetailsFailure)

Example 42 with AsyncCallback

use of com.google.gwt.user.client.rpc.AsyncCallback in project blogwt by billy1380.

the class UserController method fetchUserRolesAndPremissions.

/**
 * @param user
 */
private void fetchUserRolesAndPremissions() {
    if (user != null) {
        if (getRolesAndPermissionsRequest != null) {
            getRolesAndPermissionsRequest.cancel();
            getRolesAndPermissionsRequest = null;
        }
        final GetRolesAndPermissionsRequest input = ApiHelper.setAccessCode(new GetRolesAndPermissionsRequest());
        input.session = SessionController.get().sessionForApiCall();
        input.user = user;
        getRolesAndPermissionsRequest = ApiHelper.createUserClient().getRolesAndPermissions(input, new AsyncCallback<GetRolesAndPermissionsResponse>() {

            @Override
            public void onSuccess(GetRolesAndPermissionsResponse output) {
                getRolesAndPermissionsRequest = null;
                if (output.status == StatusType.StatusTypeSuccess) {
                    if (output.roles != null) {
                        USER_ROLES_PROVIDER.updateRowData(0, output.roles);
                    } else {
                        USER_ROLES_PROVIDER.updateRowCount(0, true);
                    }
                    if (output.permissions != null) {
                        USER_PERMISSIONS_PROVIDER.updateRowData(0, output.permissions);
                    } else {
                        USER_PERMISSIONS_PROVIDER.updateRowCount(0, true);
                    }
                }
                DefaultEventBus.get().fireEventFromSource(new GetRolesAndPermissionsSuccess(input, output), UserController.this);
            }

            @Override
            public void onFailure(Throwable caught) {
                getRolesAndPermissionsRequest = null;
                DefaultEventBus.get().fireEventFromSource(new GetRolesAndPermissionsFailure(input, caught), UserController.this);
            }
        });
    }
}
Also used : GetRolesAndPermissionsRequest(com.willshex.blogwt.shared.api.user.call.GetRolesAndPermissionsRequest) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetRolesAndPermissionsSuccess(com.willshex.blogwt.client.api.user.event.GetRolesAndPermissionsEventHandler.GetRolesAndPermissionsSuccess) GetRolesAndPermissionsFailure(com.willshex.blogwt.client.api.user.event.GetRolesAndPermissionsEventHandler.GetRolesAndPermissionsFailure) GetRolesAndPermissionsResponse(com.willshex.blogwt.shared.api.user.call.GetRolesAndPermissionsResponse)

Example 43 with AsyncCallback

use of com.google.gwt.user.client.rpc.AsyncCallback in project blogwt by billy1380.

the class UserController method getEmailAvatar.

/**
 * @param email
 */
public void getEmailAvatar(String email) {
    final GetEmailAvatarRequest input = ApiHelper.setAccessCode(new GetEmailAvatarRequest());
    input.session = SessionController.get().sessionForApiCall();
    input.email = email;
    if (getEmailAvatarRequest != null) {
        getEmailAvatarRequest.cancel();
    }
    getEmailAvatarRequest = ApiHelper.createUserClient().getEmailAvatar(input, new AsyncCallback<GetEmailAvatarResponse>() {

        @Override
        public void onSuccess(GetEmailAvatarResponse output) {
            getEmailAvatarRequest = null;
            if (output.status == StatusType.StatusTypeSuccess) {
            }
            DefaultEventBus.get().fireEventFromSource(new GetEmailAvatarSuccess(input, output), UserController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            DefaultEventBus.get().fireEventFromSource(new GetEmailAvatarFailure(input, caught), UserController.this);
        }
    });
}
Also used : GetEmailAvatarResponse(com.willshex.blogwt.shared.api.user.call.GetEmailAvatarResponse) GetEmailAvatarRequest(com.willshex.blogwt.shared.api.user.call.GetEmailAvatarRequest) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetEmailAvatarFailure(com.willshex.blogwt.client.api.user.event.GetEmailAvatarEventHandler.GetEmailAvatarFailure) GetEmailAvatarSuccess(com.willshex.blogwt.client.api.user.event.GetEmailAvatarEventHandler.GetEmailAvatarSuccess)

Example 44 with AsyncCallback

use of com.google.gwt.user.client.rpc.AsyncCallback in project blogwt by billy1380.

the class PermissionOracle 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 GetPermissionsRequest input = ApiHelper.setAccessCode(new GetPermissionsRequest());
    input.session = SessionController.get().sessionForApiCall();
    input.query = request.getQuery();
    input.pager = PagerHelper.createDefaultPager();
    input.pager.count = Integer.valueOf(request.getLimit());
    if (getPermissionsRequest != null) {
        getPermissionsRequest.cancel();
    }
    getPermissionsRequest = ApiHelper.createUserClient().getPermissions(input, new AsyncCallback<GetPermissionsResponse>() {

        @Override
        public void onSuccess(GetPermissionsResponse output) {
            if (output.status == StatusType.StatusTypeSuccess && output.pager != null) {
                foundItems(request, callback, output.permissions);
            } else {
                foundItems(request, callback, Collections.<Permission>emptyList());
            }
        }

        @Override
        public void onFailure(Throwable caught) {
            GWT.log("Error getting permissions with query " + input.query, caught);
            foundItems(request, callback, Collections.<Permission>emptyList());
        }
    });
}
Also used : GetPermissionsRequest(com.willshex.blogwt.shared.api.user.call.GetPermissionsRequest) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetPermissionsResponse(com.willshex.blogwt.shared.api.user.call.GetPermissionsResponse)

Example 45 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)

Aggregations

AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)64 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)8 Test (org.junit.Test)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)5 ProjectDTO (org.activityinfo.legacy.shared.model.ProjectDTO)4 FormDialogTether (org.activityinfo.ui.client.page.common.dialog.FormDialogTether)4 ChangeInfo (com.google.gerrit.client.info.ChangeInfo)3 Date (java.util.Date)3 GetActivityForm (org.activityinfo.legacy.shared.command.GetActivityForm)3 VoidResult (org.activityinfo.legacy.shared.command.result.VoidResult)3 MaskingAsyncMonitor (org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor)3 FormDialogImpl (org.activityinfo.ui.client.page.common.dialog.FormDialogImpl)3 Operation (org.eclipse.che.api.promises.client.Operation)3 OperationException (org.eclipse.che.api.promises.client.OperationException)3 PromiseError (org.eclipse.che.api.promises.client.PromiseError)3 Path (org.eclipse.che.ide.resource.Path)3 EditInfo (com.google.gerrit.client.info.ChangeInfo.EditInfo)2 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)2