Search in sources :

Example 36 with AsyncCallback

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

the class PageController method getPage.

/**
 * @param page
 */
public void getPage(Page page, boolean includePosts) {
    final GetPageRequest input = ApiHelper.setAccessCode(new GetPageRequest());
    input.session = SessionController.get().sessionForApiCall();
    input.page = page;
    input.includePosts = Boolean.valueOf(includePosts);
    if (getPageRequest != null) {
        getPageRequest.cancel();
    }
    getPageRequest = ApiHelper.createPageClient().getPage(input, new AsyncCallback<GetPageResponse>() {

        @Override
        public void onSuccess(GetPageResponse output) {
            getPageRequest = null;
            if (output.status == StatusType.StatusTypeSuccess) {
            }
            DefaultEventBus.get().fireEventFromSource(new GetPageSuccess(input, output), PageController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            getPageRequest = null;
            DefaultEventBus.get().fireEventFromSource(new GetPageFailure(input, caught), PageController.this);
        }
    });
}
Also used : GetPageSuccess(com.willshex.blogwt.client.api.page.event.GetPageEventHandler.GetPageSuccess) GetPageResponse(com.willshex.blogwt.shared.api.page.call.GetPageResponse) GetPageFailure(com.willshex.blogwt.client.api.page.event.GetPageEventHandler.GetPageFailure) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetPageRequest(com.willshex.blogwt.shared.api.page.call.GetPageRequest)

Example 37 with AsyncCallback

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

the class PostController method fetchPosts.

private void fetchPosts() {
    final GetPostsRequest input = ApiHelper.setAccessCode(new GetPostsRequest());
    input.session = SessionController.get().sessionForApiCall();
    input.includePostContents = Boolean.FALSE;
    input.archiveEntry = archiveEntry;
    input.showAll = Boolean.valueOf(isAdminMode);
    if (SessionController.get().isValidSession()) {
        pager.sortBy = PostSortType.PostSortTypeCreated.toString();
    } else {
        pager.sortBy = PostSortType.PostSortTypePublished.toString();
    }
    input.pager = pager;
    input.tag = tag;
    if (getPostsRequest != null) {
        getPostsRequest.cancel();
    }
    getPostsRequest = ApiHelper.createBlogClient().getPosts(input, new AsyncCallback<GetPostsResponse>() {

        @Override
        public void onSuccess(GetPostsResponse output) {
            getPostsRequest = null;
            if (output.status == StatusType.StatusTypeSuccess) {
                if (output.posts != null && output.posts.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.posts);
                } else {
                    updateRowCount(input.pager.start.intValue(), true);
                    updateRowData(input.pager.start.intValue(), Collections.<Post>emptyList());
                }
            }
            DefaultEventBus.get().fireEventFromSource(new GetPostsSuccess(input, output), PostController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            getPostsRequest = null;
            DefaultEventBus.get().fireEventFromSource(new GetPostsFailure(input, caught), PostController.this);
        }
    });
}
Also used : GetPostsRequest(com.willshex.blogwt.shared.api.blog.call.GetPostsRequest) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetPostsSuccess(com.willshex.blogwt.client.api.blog.event.GetPostsEventHandler.GetPostsSuccess) GetPostsResponse(com.willshex.blogwt.shared.api.blog.call.GetPostsResponse) GetPostsFailure(com.willshex.blogwt.client.api.blog.event.GetPostsEventHandler.GetPostsFailure)

Example 38 with AsyncCallback

use of com.google.gwt.user.client.rpc.AsyncCallback 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);
        }
    });
}
Also used : JsonArray(com.google.gson.JsonArray) GetPropertiesRequest(com.willshex.blogwt.shared.api.blog.call.GetPropertiesRequest) GetPropertiesFailure(com.willshex.blogwt.client.api.blog.event.GetPropertiesEventHandler.GetPropertiesFailure) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetPropertiesSuccess(com.willshex.blogwt.client.api.blog.event.GetPropertiesEventHandler.GetPropertiesSuccess) GetPropertiesResponse(com.willshex.blogwt.shared.api.blog.call.GetPropertiesResponse) Property(com.willshex.blogwt.shared.api.datatype.Property)

Example 39 with AsyncCallback

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

the class RoleController method fetchRoles.

private void fetchRoles() {
    final GetRolesRequest input = ApiHelper.setAccessCode(new GetRolesRequest());
    input.pager = pager;
    input.session = SessionController.get().sessionForApiCall();
    if (getRolesRequest != null) {
        getRolesRequest.cancel();
    }
    getRolesRequest = ApiHelper.createUserClient().getRoles(input, new AsyncCallback<GetRolesResponse>() {

        @Override
        public void onSuccess(GetRolesResponse output) {
            getRolesRequest = null;
            if (output.status == StatusType.StatusTypeSuccess) {
                if (output.roles != null && output.roles.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.roles);
                } else {
                    updateRowCount(input.pager.start.intValue(), true);
                    updateRowData(input.pager.start.intValue(), Collections.<Role>emptyList());
                }
            }
            DefaultEventBus.get().fireEventFromSource(new GetRolesSuccess(input, output), RoleController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            getRolesRequest = null;
            DefaultEventBus.get().fireEventFromSource(new GetRolesFailure(input, caught), RoleController.this);
        }
    });
}
Also used : GetRolesFailure(com.willshex.blogwt.client.api.user.event.GetRolesEventHandler.GetRolesFailure) GetRolesSuccess(com.willshex.blogwt.client.api.user.event.GetRolesEventHandler.GetRolesSuccess) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GetRolesRequest(com.willshex.blogwt.shared.api.user.call.GetRolesRequest) GetRolesResponse(com.willshex.blogwt.shared.api.user.call.GetRolesResponse)

Example 40 with AsyncCallback

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

the class SearchController method fetchSearchResults.

private void fetchSearchResults(String query) {
    final SearchAllRequest input = ApiHelper.setAccessCode(new SearchAllRequest());
    input.session = SessionController.get().sessionForApiCall();
    input.query = query;
    if (searchAllRequest != null) {
        searchAllRequest.cancel();
    }
    searchAllRequest = ApiHelper.createSearchClient().searchAll(input, new AsyncCallback<SearchAllResponse>() {

        @Override
        public void onSuccess(SearchAllResponse output) {
            searchAllRequest = null;
            if (output.status == StatusType.StatusTypeSuccess) {
                List<SearchResult> results = new ArrayList<SearchController.SearchResult>();
                if (output.posts != null) {
                    for (Post post : output.posts) {
                        results.add(new SearchResult(post));
                    }
                }
                if (output.pages != null) {
                    for (Page page : output.pages) {
                        results.add(new SearchResult(page));
                    }
                }
                if (output.users != null) {
                    for (User user : output.users) {
                        results.add(new SearchResult(user));
                    }
                }
                updateRowCount(results.size(), true);
                updateRowData(0, results);
            }
            DefaultEventBus.get().fireEventFromSource(new SearchAllSuccess(input, output), SearchController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            searchAllRequest = null;
            DefaultEventBus.get().fireEventFromSource(new SearchAllFailure(input, caught), SearchController.this);
        }
    });
}
Also used : SearchAllResponse(com.willshex.blogwt.shared.api.search.call.SearchAllResponse) SearchAllFailure(com.willshex.blogwt.client.api.search.event.SearchAllEventHandler.SearchAllFailure) SearchAllSuccess(com.willshex.blogwt.client.api.search.event.SearchAllEventHandler.SearchAllSuccess) User(com.willshex.blogwt.shared.api.datatype.User) Post(com.willshex.blogwt.shared.api.datatype.Post) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) ArrayList(java.util.ArrayList) Page(com.willshex.blogwt.shared.api.datatype.Page) SearchAllRequest(com.willshex.blogwt.shared.api.search.call.SearchAllRequest)

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