Example usage for com.google.gwt.user.client.rpc AsyncCallback AsyncCallback

List of usage examples for com.google.gwt.user.client.rpc AsyncCallback AsyncCallback

Introduction

In this page you can find the example usage for com.google.gwt.user.client.rpc AsyncCallback AsyncCallback.

Prototype

AsyncCallback

Source Link

Usage

From source file:accelerator.client.Main.java

License:Open Source License

public void onModuleLoad() {
    clientFactory = GWT.create(ClientFactory.class);

    // ?//from w  w w.  j ava2s .com
    GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable e) {
            GWT.log("", e);
            clientFactory.getLogService().writeLog(e.toString(), new AsyncCallback<Void>() {
                public void onFailure(Throwable caught) {
                    // ???
                }

                public void onSuccess(Void result) {
                    // ???
                }
            });
        }
    });

    // 
    clientFactory.getLoginService().login(GWT.getHostPageBaseURL(), new AsyncCallback<LoginInfo>() {
        public void onFailure(Throwable caught) {
        }

        public void onSuccess(LoginInfo result) {
            if (result.isLoggedIn()) {
                loadMain(result);
            } else {
                loadLogin(result);
            }
        }
    });
}

From source file:accelerator.client.presenter.InboxPresenter.java

License:Open Source License

@Override
public void loadTaskList() {
    service.getInboxTaskList(new AsyncCallback<List<Task>>() {
        public void onFailure(Throwable caught) {
            showError(caught);/*from   w w w  . j av  a 2s .c  om*/
        }

        public void onSuccess(List<Task> result) {
            getTaskList().clear();
            getTaskList().addAll(result);
            getView().setTaskList(getTaskList());
        }
    });
}

From source file:accelerator.client.presenter.MainMenuPresenter.java

License:Open Source License

public void createProject(Project input) {
    projectService.createProject(input, new AsyncCallback<Project>() {
        public void onFailure(Throwable caught) {
            showError(caught);//  w w  w  .  j  a va2 s. co m
        }

        public void onSuccess(Project result) {
            showStatus(" \"" + result.getName() + "\" ?????");

            projectList.add(result);
            view.setProjectList(projectList);

            eventBus.fireEvent(new ProjectChangeEvent(result));
            eventBus.fireEvent(new UpdateProjectListEvent(projectList));
        }
    });
}

From source file:accelerator.client.presenter.MainMenuPresenter.java

License:Open Source License

public void createTag(Tag input) {
    tagService.createTag(input, new AsyncCallback<Tag>() {
        public void onFailure(Throwable caught) {
            showError(caught);/*  w  w w . ja va  2 s.  c om*/
        }

        public void onSuccess(Tag result) {
            showStatus(" \"" + result.getName() + "\" ?????");

            tagList.add(result);
            view.setTagList(tagList);

            eventBus.fireEvent(new TagChangeEvent(result));
            eventBus.fireEvent(new UpdateTagListEvent(tagList));
        }
    });
}

From source file:accelerator.client.presenter.MainMenuPresenter.java

License:Open Source License

public void updateProject(Project input) {
    projectService.updateProject(input, new AsyncCallback<Project>() {
        public void onFailure(Throwable caught) {
            showError(caught);/*from  w w w. j  a  v a2s.co m*/
        }

        public void onSuccess(Project result) {
            showStatus(" \"" + result.getName() + "\" ????");

            // 
            int index = projectList.indexOf(result);
            projectList.set(index, result);
            view.setProjectList(projectList);

            eventBus.fireEvent(new ProjectChangeEvent(result));
            eventBus.fireEvent(new UpdateProjectListEvent(projectList));
        }
    });
}

From source file:accelerator.client.presenter.MainMenuPresenter.java

License:Open Source License

public void updateTag(Tag input) {
    tagService.updateTag(input, new AsyncCallback<Tag>() {
        public void onFailure(Throwable caught) {
            showError(caught);//from w  ww .j  av  a2  s  . c  o m
        }

        public void onSuccess(Tag result) {
            showStatus(" \"" + result.getName() + "\" ????");

            // key ????????
            int index = tagList.indexOf(result);
            tagList.set(index, result);
            view.setTagList(tagList);

            eventBus.fireEvent(new TagChangeEvent(result));
            eventBus.fireEvent(new UpdateTagListEvent(tagList));
        }
    });
}

From source file:accelerator.client.presenter.MainMenuPresenter.java

License:Open Source License

public void deleteProject(final Project project) {
    projectService.deleteProject(project.getKey(), new AsyncCallback<Key>() {
        public void onFailure(Throwable caught) {
            showError(caught);// w w w .  j a v a 2 s. c om
        }

        public void onSuccess(Key result) {
            showStatus(" \"" + project.getName() + "\" ????");

            projectList.remove(project);
            view.setProjectList(projectList);

            eventBus.fireEvent(new ProjectChangeEvent(project));
            eventBus.fireEvent(new UpdateProjectListEvent(projectList));
        }
    });
}

From source file:accelerator.client.presenter.MainMenuPresenter.java

License:Open Source License

public void deleteTag(final Tag tag) {
    tagService.deleteTag(tag.getKey(), new AsyncCallback<Key>() {
        public void onFailure(Throwable caught) {
            showError(caught);/*from   ww  w.ja  v  a2 s  .c om*/
        }

        public void onSuccess(Key result) {
            showStatus(" \"" + tag.getName() + "\" ????");

            tagList.remove(tag);
            view.setTagList(tagList);

            eventBus.fireEvent(new TagChangeEvent(tag));
            eventBus.fireEvent(new UpdateTagListEvent(tagList));
        }
    });
}

From source file:accelerator.client.presenter.MainMenuPresenter.java

License:Open Source License

public void loadProjectList() {
    assert view != null : "MainMenuPresenter.view ? null ??";

    projectService.getProjectList(new AsyncCallback<List<Project>>() {
        public void onFailure(Throwable caught) {
            showError(caught);/* w  ww . j  av  a 2s .co  m*/
        }

        public void onSuccess(List<Project> result) {
            projectList = result;
            view.setProjectList(result);
            eventBus.fireEvent(new UpdateProjectListEvent(result));
        }
    });
}

From source file:accelerator.client.presenter.MainMenuPresenter.java

License:Open Source License

public void loadTagList() {
    assert view != null : "MainMenuPresenter.view ? null ??";

    tagService.getTagList(new AsyncCallback<List<Tag>>() {
        public void onFailure(Throwable caught) {
            showError(caught);//w w w .  jav a  2s.  c  om
        }

        public void onSuccess(List<Tag> result) {
            tagList = result;
            view.setTagList(result);
            eventBus.fireEvent(new UpdateTagListEvent(result));
        }
    });
}