List of usage examples for com.google.gwt.core.client RunAsyncCallback RunAsyncCallback
RunAsyncCallback
From source file:cc.kune.embed.client.panels.EmbedPresenter.java
License:GNU Affero Public License
private void onGetContentSuccessful(final Session session, final StateAbstractDTO state) { getView().clear();//from ww w .java 2s . c om final StateContentDTO stateContent = (StateContentDTO) state; final boolean isLogged = session.isLogged(); final boolean isParticipant = stateContent.isParticipant(); Log.info("Is logged: " + isLogged + " isParticipant: " + isParticipant); final Boolean readOnly = EmbedConfiguration.get().getReadOnly(); Log.info("Is readonly: " + readOnly); final Boolean isReadOnly = readOnly == null ? false : readOnly; if (isLogged && isParticipant && !isReadOnly) { getView().setEditableContent(stateContent); } else { getView().setContent(stateContent); } // FIXME use GWTP here? GWT.runAsync(new RunAsyncCallback() { @Override public void onFailure(final Throwable reason) { // By now, do nothing } @Override public void onSuccess() { sitebar.get().init(stateTokenToOpen); } }); }
From source file:com.appspot.socialinquirer.client.activity.ActivityActivity.java
License:Apache License
@Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { if (name.equals(HistoryToken.Activity_Messages.token())) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); }//from w ww .j a v a2s . co m public void onSuccess() { dashboardView = clientFactory.getActivityView(); dashboardView.setName(name); dashboardView.setPresenter(ActivityActivity.this); containerWidget.setWidget(dashboardView.asWidget()); clientFactory.getUserService().getUserMessages(new AsyncCallback<ArrayList<Message>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Message> result) { dashboardView.setMessages(result); } }); } }); } else if (name.equals(HistoryToken.Activity_Polls.token())) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); } public void onSuccess() { dashboardView = clientFactory.getActivityView(); dashboardView.setName(name); dashboardView.setPresenter(ActivityActivity.this); containerWidget.setWidget(dashboardView.asWidget()); clientFactory.getContentService().getPolls(new AsyncCallback<ArrayList<Poll>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Poll> result) { dashboardView.setPolls(result); } }); } }); } else if (name.equals(HistoryToken.Activity_Quizzes.token())) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); } public void onSuccess() { dashboardView = clientFactory.getActivityView(); dashboardView.setName(name); dashboardView.setPresenter(ActivityActivity.this); containerWidget.setWidget(dashboardView.asWidget()); clientFactory.getContentService().getQuizzes(new AsyncCallback<ArrayList<Quiz>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Quiz> result) { dashboardView.setQuizzes(result); } }); } }); } else if (name.equals(HistoryToken.Activity_Tasks.token())) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); } public void onSuccess() { dashboardView = clientFactory.getActivityView(); dashboardView.setName(name); dashboardView.setPresenter(ActivityActivity.this); containerWidget.setWidget(dashboardView.asWidget()); clientFactory.getUserService().getUserTasks(new AsyncCallback<ArrayList<Task>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Task> result) { dashboardView.setTasks(result); } }); } }); } else if (name.equals(HistoryToken.Activity_Pages.token())) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); } public void onSuccess() { dashboardView = clientFactory.getActivityView(); dashboardView.setName(name); dashboardView.setPresenter(ActivityActivity.this); containerWidget.setWidget(dashboardView.asWidget()); clientFactory.getContentService().getPages(new AsyncCallback<ArrayList<Page>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Page> result) { dashboardView.setPages(result); } }); } }); } }
From source file:com.appspot.socialinquirer.client.activity.HomeActivity.java
License:Apache License
@Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); }/*from ww w.jav a2 s .c o m*/ public void onSuccess() { homeView = clientFactory.getHomeView(); homeView.setPresenter(HomeActivity.this); containerWidget.setWidget(homeView.asWidget()); clientFactory.getContentService().getQuizzes(new AsyncCallback<ArrayList<Quiz>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Quiz> result) { homeView.setQuizzes(result); } }); clientFactory.getContentService().getBuiltinClassifiers(new AsyncCallback<ArrayList<Classifier>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Classifier> result) { homeView.setClassifiers(result); } }); clientFactory.getUserService().getUserMessages(new AsyncCallback<ArrayList<Message>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Message> result) { homeView.setMessages(result); } }); if (clientFactory.getUser() != null) { clientFactory.getUserService().getUserMessages(new AsyncCallback<ArrayList<Message>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Message> result) { homeView.setMessages(result); } }); } } }); }
From source file:com.appspot.socialinquirer.client.activity.HomeActivity.java
License:Apache License
@Override public void onQuestionsSearchPerformed(final String text) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { Window.alert("Code download failed"); }/*from w ww. j a va 2s. c om*/ public void onSuccess() { SearchControlOptions options = new SearchControlOptions(); WebSearch ws = new WebSearch(); ws.setSiteRestriction("015203706368483719477:w4zebhpqxyu"); options.add(ws); SearchControl searchControl = new SearchControl(options); searchControl.addSearchResultsHandler(new SearchResultsHandler() { @Override public void onSearchResults(SearchResultsEvent event) { JsArray<? extends Result> results = event.getResults(); ArrayList<Question> questions = new ArrayList<Question>(); for (int i = 0; i < results.length(); i++) { Result result = results.get(i); if (result instanceof WebResult) { Question question = createQuestion((WebResult) result); question.setKey(getQuestionId(((WebResult) result).getUnescapedUrl())); if (question.getKey() != null) { questions.add(question); } } } homeView.setQuestions(questions); } }); searchControl.execute(text); } }); }
From source file:com.appspot.socialinquirer.client.activity.NetworkActivity.java
License:Apache License
@Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); }// w ww .jav a2s.c o m public void onSuccess() { dashboardView = clientFactory.getNetworkView(); dashboardView.setName(name); dashboardView.setPresenter(NetworkActivity.this); // dashboardView.setClassifiersList(user.getClassifiers()); containerWidget.setWidget(dashboardView.asWidget()); if (name.equals(HistoryToken.Network_Followers.token())) { clientFactory.getUserService().getFollowers(new AsyncCallback<ArrayList<User>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<User> result) { dashboardView.setConnections(result); } }); } else if (name.equals(HistoryToken.Network_Following.token())) { clientFactory.getUserService().getFollowing(new AsyncCallback<ArrayList<User>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<User> result) { dashboardView.setConnections(result); } }); } else if (name.equals(HistoryToken.Network_Recommended.token())) { clientFactory.getUserService().getRecommendedUsers(new AsyncCallback<ArrayList<User>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<User> result) { dashboardView.setConnections(result); } }); } } }); }
From source file:com.appspot.socialinquirer.client.activity.PageActivity.java
License:Apache License
@Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { final EverScribeConstants constants = clientFactory.getConstants(); GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(constants, constants.errorCodeDownloadFailed()); }/*w ww. j av a 2 s . c om*/ public void onSuccess() { String pageId = getPageId(name); dashboardView = clientFactory.getNewsPaperView(); dashboardView.setName(name); dashboardView.setPresenter(PageActivity.this); // dashboardView.setTemplatesList(user.getTemplates()); containerWidget.setWidget(dashboardView.asWidget()); clientFactory.getContentService().getPage(pageId, new AsyncCallback<Page>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(constants, caught.getLocalizedMessage()); } @Override public void onSuccess(Page result) { dashboardView.setPage(result); } }); } private String getPageId(String name) { int index = name.indexOf(':'); return (index > 0) ? name.substring(index + 1) : null; } }); }
From source file:com.appspot.socialinquirer.client.activity.PagesActivity.java
License:Apache License
@Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); }/*w ww . j a va 2 s .c o m*/ public void onSuccess() { dashboardView = clientFactory.getPagesView(); dashboardView.setName(name); dashboardView.setPresenter(PagesActivity.this); containerWidget.setWidget(dashboardView.asWidget()); clientFactory.getContentService().getPages(new AsyncCallback<ArrayList<Page>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Page> result) { dashboardView.setPages(result); } }); } }); }
From source file:com.appspot.socialinquirer.client.activity.QuestionActivity.java
License:Apache License
@Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); }//from w ww .j ava 2 s .c o m public void onSuccess() { String questionId = getQuestionId(name); dashboardView = clientFactory.getQuestionView(); final EverScribeConstants constants = clientFactory.getConstants(); dashboardView.setName(name); dashboardView.setPresenter(QuestionActivity.this); containerWidget.setWidget(dashboardView.asWidget()); clientFactory.getContentService().getQuestion(questionId, new AsyncCallback<Question>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(constants, caught.getLocalizedMessage()); } @Override public void onSuccess(Question result) { dashboardView.setQuestion(result); } }); clientFactory.getContentService().getQuizzes(new AsyncCallback<ArrayList<Quiz>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Quiz> result) { dashboardView.setQuizzes(result); } }); clientFactory.getContentService().getBuiltinClassifiers(new AsyncCallback<ArrayList<Classifier>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Classifier> result) { dashboardView.setClassifiers(result); } }); } private String getQuestionId(String name) { int index = name.indexOf(':'); return (index > 0) ? name.substring(index + 1) : null; } }); }
From source file:com.appspot.socialinquirer.client.activity.QuestionsActivity.java
License:Apache License
@Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); }/*w w w .java 2 s.c om*/ public void onSuccess() { dashboardView = clientFactory.getQuestionsView(); dashboardView.setName(name); // dashboardView.setBlogSettings(user.getBlogSettings()); dashboardView.setPresenter(QuestionsActivity.this); containerWidget.setWidget(dashboardView.asWidget()); if (name.equals(HistoryToken.Questions_Answered.token())) { clientFactory.getUserService().getAnsweredQuestions(new AsyncCallback<ArrayList<Question>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Question> result) { dashboardView.setQuestions(result); } }); } else if (name.equals(HistoryToken.Questions_Asked.token())) { clientFactory.getUserService().getAskedQuestions(new AsyncCallback<ArrayList<Question>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Question> result) { dashboardView.setQuestions(result); } }); } else if (name.equals(HistoryToken.Questions_Following.token())) { clientFactory.getUserService().getFollowingQuestions(new AsyncCallback<ArrayList<Question>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Question> result) { dashboardView.setQuestions(result); } }); } else if (name.equals(HistoryToken.Questions_Recommended.token())) { clientFactory.getUserService() .getRecommendedQuestions(new AsyncCallback<ArrayList<Question>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Question> result) { dashboardView.setQuestions(result); } }); } clientFactory.getContentService().getQuizzes(new AsyncCallback<ArrayList<Quiz>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Quiz> result) { dashboardView.setQuizzes(result); } }); clientFactory.getContentService().getBuiltinClassifiers(new AsyncCallback<ArrayList<Classifier>>() { @Override public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), caught.getLocalizedMessage()); } @Override public void onSuccess(ArrayList<Classifier> result) { dashboardView.setClassifiers(result); } }); } }); }
From source file:com.appspot.socialinquirer.client.activity.SettingsActivity.java
License:Apache License
@Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(clientFactory.getConstants(), clientFactory.getConstants().errorCodeDownloadFailed()); }//from ww w . java 2 s .c o m public void onSuccess() { dashboardView = clientFactory.getXmppSettingsView(); dashboardView.setName(name); dashboardView.setPaperSettings(user.getXmppSettings()); dashboardView.setPresenter(SettingsActivity.this); containerWidget.setWidget(dashboardView.asWidget()); // $(".help-link").click(new Function(){ // public void f(Element element) { // AnchorElement a = (AnchorElement) element; // UiUtils.showHelpDialog(clientFactory, a.getName()); // } // }); } }); }