Search in sources :

Example 1 with GetPageFailure

use of com.willshex.blogwt.client.api.page.event.GetPageEventHandler.GetPageFailure 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)

Aggregations

AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 GetPageFailure (com.willshex.blogwt.client.api.page.event.GetPageEventHandler.GetPageFailure)1 GetPageSuccess (com.willshex.blogwt.client.api.page.event.GetPageEventHandler.GetPageSuccess)1 GetPageRequest (com.willshex.blogwt.shared.api.page.call.GetPageRequest)1 GetPageResponse (com.willshex.blogwt.shared.api.page.call.GetPageResponse)1