List of usage examples for com.google.gwt.user.client Timer schedule
public synchronized void schedule(int delayMs)
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.end.AssessmentsEndPresenter.java
License:Open Source License
@Override public void getCollectionMetaDataByUserAndSession(final String collectionId, final String classId, final String userId, final String sessionId, final PrintUserDataDO printData) { if (sessionId != null) { this.analyticService.getCollectionMetaDataByUserAndSession(StringUtil.getClassObj(), collectionId, classId, userId, sessionId, new AsyncCallback<ArrayList<CollectionSummaryMetaDataDo>>() { @Override/* w ww.j a v a 2s .c om*/ public void onSuccess(ArrayList<CollectionSummaryMetaDataDo> result) { if (result != null && result.size() != 0) { count = 0; if (result.get(0).getSession() != null && result.get(0).getSession().size() != 0) { int sessionSize = result.get(0).getSession().size(); int day = result.get(0).getSession().get(sessionSize - 1).getSequence(); printData.setUserName(null); printData.setSession(day + AnalyticsUtil.getOrdinalSuffix(day) + " Session"); printData.setSessionStartTime( AnalyticsUtil.getSessionsCreatedTime((Long.toString(result.get(0) .getSession().get(sessionSize - 1).getEventTime())))); getView().setSessionsData(result.get(0).getSession()); } displayScoreCountData(result.get(0)); getView().setCollectionMetaDataByUserAndSession(result); setCollectionSummaryData(collectionId, classId, userId, sessionId, printData); } else { Timer timer = new Timer() { @Override public void run() { if (count < 10) { getSessionsDataByUser(collectionId, classId, userId); count++; } else { if (count >= 10) { getView().errorMsg(); } } } }; timer.schedule(100); } } @Override public void onFailure(Throwable caught) { getView().errorMsg(); } }); } else { getView().errorMsg(); } }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.preview.AssessmentsPreviewPlayerPresenter.java
License:Open Source License
public void showCollectionEndView(String collectionId, String tabView) { this.collectionMetadataId = null; this.collectionItemDo = null; MixpanelUtil.Preview_Player_Reach_End(); getView().hidePlayerButtons(true, collectionDo.getGooruOid()); metadataPresenter.displayAuthorDetails(false); metadataPresenter.setCollectionMetadata(collectionDo); metadataPresenter.getFlagedReport(collectionId); showSignupPopup();/*from w ww. ja v a 2 s . com*/ setOpenEndedAnswerSubmited(true); if (this.collectionSummaryId != null) { if (this.collectionSummaryId.equalsIgnoreCase(collectionDo.getGooruOid())) { return; } } this.collectionSummaryId = collectionDo.getGooruOid(); clearSlot(COLLECTION_PLAYER_TOC_PRESENTER_SLOT); getView().setResourceTitle(collectionDo.getTitle()); getView().setStudentViewLink(); clearIframeContent(); if (!AppClientFactory.isAnonymous()) { metadataPresenter.getFlagedReport(collectionDo.getGooruOid()); } stopResourceDataLog(); resetAnswerLists(); Timer timer = new Timer() { @Override public void run() { AppClientFactory .printInfoLogger("restarted after 1500 milliseconds : " + System.currentTimeMillis()); stopCollectionDataLog(); setUserAttemptedQuestionTypeAndStatus(false, 0); updateSession(sessionId); metadataPresenter.setPreviewEndPresenter(); setInSlot(METADATA_PRESENTER_SLOT, metadataPresenter, false); } }; AppClientFactory.printInfoLogger("stoped for 1500 milliseconds : " + System.currentTimeMillis()); timer.schedule(1500); }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.preview.metadata.comment.CommentWidgetChildView.java
License:Open Source License
@UiHandler("postCommentBtn") public void clickOnPostCommentBtn(ClickEvent event) { if (commentField.getText().length() > 0) { Map<String, String> parms = new HashMap<String, String>(); parms.put("text", removeHtmlTags(commentField.getText())); AppClientFactory.getInjector().getResourceService().checkProfanity(parms, new SimpleAsyncCallback<Boolean>() { @Override//w ww . j a va2s . c o m public void onSuccess(Boolean value) { boolean isHavingBadWords = value; if (isHavingBadWords) { commentField.getElement().getStyle().setBorderColor("orange"); characterLimit.setText(i18n.GL0554()); characterLimit.setVisible(true); } else { commentField.getElement().getStyle().clearBackgroundColor(); commentField.getElement().getStyle().setBorderColor("#ccc"); AppClientFactory.fireEvent(new EditCommentChildViewEvent(getCommentUid(), removeHtmlTags(commentField.getText()), EDIT)); displaySuccessMsg(true); Timer timer = new Timer() { @Override public void run() { commentsDo.setComment(removeHtmlTags(commentField.getText())); commentHtml.setHTML(commentsDo.getComment()); String commentTime = getCreatedTime(commentsDo.getCreatedOn()); commentTime = commentTime + " " + i18n.GL_GRR_Hyphen() + " " + i18n.GL1434(); timestamp.setText(commentTime); timestamp.getElement().setAttribute("alt", commentTime); timestamp.getElement().setAttribute("title", commentTime); successPostMsg.setVisible(false); enableEditFunction(false); } }; timer.schedule(1000); characterLimit.setVisible(false); } } }); } else { //Ask user to delete the comment. commentHtml.setHTML(commentsDo.getComment()); deleteConfirmationPopupVc = new DeleteConfirmationPopupVc(i18n.GL0558(), i18n.GL0559()); enableEditFunction(true); } }
From source file:org.ednovo.gooru.client.mvp.classpage.studentclassview.reports.assessmentreport.AssessmentProgressReportChildPresenter.java
License:Open Source License
@Override public void getCollectionMetaDataByUserAndSession(final String collectionId, final String classId, final String courseId, final String unitId, final String lessonId, final String userId, final String sessionId, final PrintUserDataDO printData) { if (sessionId != null) { ClassDo classObj = new ClassDo(); classObj.setAssessmentId(collectionId); classObj.setClassId(classId);/* w w w. j a v a 2 s .co m*/ classObj.setCourseId(courseId); classObj.setUnitId(unitId); classObj.setLessonId(lessonId); classObj.setSessionId(sessionId); AppClientFactory.getInjector().getAnalyticsService().getCollectionMetaDataByUserAndSession(classObj, collectionId, classId, userId, sessionId, new AsyncCallback<ArrayList<CollectionSummaryMetaDataDo>>() { @Override public void onSuccess(ArrayList<CollectionSummaryMetaDataDo> result) { if (result != null && result.size() != 0) { getView().loaderVisibility(false); getView().errorPanelData(false, true); count = 0; if (!isSession()) { if (result.get(0).getSession() != null && result.get(0).getSession().size() != 0) { int sessionSize = result.get(0).getSession().size(); int day = result.get(0).getSession().get(sessionSize - 1).getSequence(); getView().setAttemptsData(result.get(0).getSession()); } setSession(true); } displayScoreCountData(result.get(0)); getView().setCollectionMetaDataByUserAndSession(result); setCollectionSummaryData(collectionId, classId, userId, sessionId, printData, null); } else { Timer timer = new Timer() { @Override public void run() { if (count < 10) { getSessionsDataByUser(collectionId, classId, courseId, unitId, lessonId, userId); count++; } else { if (count >= 10) { getView().errorMsg(); } } } }; timer.schedule(100); } } @Override public void onFailure(Throwable caught) { getView().errorMsg(); } }); } else { getView().errorMsg(); } }
From source file:org.ednovo.gooru.client.mvp.classpage.studentclassview.reports.assessmentreport.AssessmentProgressReportChildPresenter.java
License:Open Source License
@Override public void getContentPlayAllSessions(final String gooruUid, final String classGooruId, final String lessonGooruId, final String unitGooruId, final String courseGooruId, final String assessmentId, final String currentSessionId) { AppClientFactory.getInjector().getClasspageService().getContentPlayAllSessions(gooruUid, classGooruId, lessonGooruId, unitGooruId, courseGooruId, assessmentId, new SimpleAsyncCallback<List<UserPlayedSessionDo>>() { @Override//from ww w .ja va2 s .c om public void onSuccess(List<UserPlayedSessionDo> result) { if (result != null && result.size() > 0) { getView().loaderVisibility(false); getView().errorPanelData(false, true); setSessionId(result.get(0).getSessionId()); getSessionsDataByUser(assessmentId, classGooruId, classGooruId, lessonGooruId, unitGooruId, gooruUid); getView().setSessionsData(result); } else { Timer timer = new Timer() { @Override public void run() { if (count < 10) { getContentPlayAllSessions(gooruUid, classGooruId, lessonGooruId, unitGooruId, courseGooruId, assessmentId, currentSessionId); count++; } else { if (count >= 10) { getView().errorMsg(); } } } }; timer.schedule(100); } } }); }
From source file:org.ednovo.gooru.client.mvp.image.upload.ImageUploadView.java
License:Open Source License
/** * See for more details {@link PopupViewWithUiHandlers} for details. * //from w w w. ja va2 s. co m * @param eventBus instance of {@link EventBus} */ @Inject public ImageUploadView(EventBus eventBus) { super(eventBus); GooruCBundle.INSTANCE.css().ensureInjected(); appPopUp = new AppPopUp(GL1424); appPopUp.setContent(uiBinder.createAndBindUi(this)); appPopUp.setStyleName(GooruCBundle.INSTANCE.css().imageUploadPopup()); imageCropPopup = new AppPopUp(GL1424); imageCropPopup.setStyleName(GooruCBundle.INSTANCE.css().imageUploadPopup()); chooseText.setText(GL1215 + GL_SPL_SEMICOLON); imageUploadOnWebLbl.setText(GL1216); imageUploadOnComputerLbl.setText(GL1217); uploadGooruImages.setText(GL1218); uploadFromComputer.setText(GL1219); uploadLimitText.setText(GL1220); notWorkingLblText.setText(GL1221 + " " + GL_SPL_QUESTION); readThisLbl.setText(GL1222 + GL_SPL_EXCLAMATION); onSystemCancelBtn.setText(GL0142); uploadFromWebText.setText(GL1223); imageURLLbl.setText(GL1224); uploadImageButtonOnWeb.setText(GL1225); typeImageurlText.setText(GL1226); infoUrlUploadText.setText(GL1227); onWebCancelBtn.setText(GL0142); chooseFromText.setText(GL1228 + GL_SPL_SEMICOLON); okButtonOnUploadGooruImages.setText(GL0190); cancelButtonOnUploadGooruImages.setText(GL0142); fileUpload.getElement().setAttribute("size", "25"); fileUpload.getElement().setId("fileUpload"); onWebCancelBtn.getElement().setId("btnCancel"); onSystemCancelBtn.getElement().setId("btnCancel"); fileUpload.getElement().setId("fileUpload"); imageUploadOnWebLbl.getElement().setId("lnkOnWeb"); imageUploadOnComputerLbl.getElement().setId("lnkOnComputer"); uploadGooruImages.getElement().setId("lnkGooruImages"); imageUploadOnComputerLbl.setStyleName(GooruCBundle.INSTANCE.css().uploadClose()); imageUploadOnWebLbl.setStyleName(GooruCBundle.INSTANCE.css().uploadActive()); uploadGooruImages.setStyleName(GooruCBundle.INSTANCE.css().uploadClose()); uploadGooruImages.getElement().getStyle().setDisplay(Display.NONE); imageWebUploadUrlTxtBox.getElement().setId("tbImageWebUploadUrl"); uploadImageButtonOnWeb.getElement().setId("btnUpload"); urlValidation.setVisible(false); imageWebUploadUrlTxtBox.addFocusHandler(new OnTextFocus()); urlValidation.setStyleName(GooruCBundle.INSTANCE.css().imageUrlError()); handelFormEvent(); appPopUp.setModal(true); notWorkingPanel.setVisible(false); readThisLbl.setHref(GL1265); // Window.enableScrolling(false); // AppClientFactory.fireEvent(new SetHeaderZIndexEvent(0, false)); addClickEventToDefaultImages(); fileuploadForm.addSubmitHandler(new FormPanel.SubmitHandler() { public void onSubmit(final SubmitEvent event) { String browesr = BrowserAgent.getWebBrowserClient(); if (browesr.contains("ie")) { Timer timer = new Timer() { @Override public void run() { glasspanelLoadingImage(false); fileuploadForm.reset(); event.cancel(); notWorkingPanel.setVisible(true); } }; timer.schedule(10000); } if (!"".equalsIgnoreCase(fileUpload.getFilename())) { String size = getFileNameSize(); double sizeOfImage = Double.parseDouble(size); if (sizeOfImage > 5) { new AlertForImageUpload(GL0061, GL1229); glasspanelLoadingImage(false); fileuploadForm.reset(); event.cancel(); // Window.enableScrolling(true); // AppClientFactory.fireEvent(new SetHeaderZIndexEvent(0, true)); } } else { event.cancel(); // cancel the event // Window.enableScrolling(true); // AppClientFactory.fireEvent(new SetHeaderZIndexEvent(0, true)); } } }); }
From source file:org.ednovo.gooru.client.mvp.play.collection.preview.metadata.comment.CommentWidgetChildView.java
License:Open Source License
@UiHandler("postCommentBtn") public void clickOnPostCommentBtn(ClickEvent event) { if (commentField.getText().length() > 0) { Map<String, String> parms = new HashMap<String, String>(); parms.put("text", commentField.getText()); AppClientFactory.getInjector().getResourceService().checkProfanity(parms, new SimpleAsyncCallback<Boolean>() { @Override/* w ww . j a va 2 s . co m*/ public void onSuccess(Boolean value) { boolean isHavingBadWords = value; if (isHavingBadWords) { commentField.getElement().getStyle().setBorderColor("orange"); characterLimit.setText(GL0554); characterLimit.setVisible(true); } else { commentField.getElement().getStyle().clearBackgroundColor(); commentField.getElement().getStyle().setBorderColor("#ccc"); AppClientFactory.fireEvent(new EditCommentChildViewEvent(getCommentUid(), commentField.getText(), EDIT)); displaySuccessMsg(true); Timer timer = new Timer() { @Override public void run() { commentsDo.setComment(commentField.getText()); commentHtml.setHTML(commentsDo.getComment()); String commentTime = getCreatedTime(commentsDo.getCreatedOn()); commentTime = commentTime + " " + GL_GRR_Hyphen + " " + GL1434; timestamp.setText(commentTime); successPostMsg.setVisible(false); enableEditFunction(false); } }; timer.schedule(1000); characterLimit.setVisible(false); } } }); } else { //Ask user to delete the comment. commentHtml.setHTML(commentsDo.getComment()); deleteConfirmationPopupVc = new DeleteConfirmationPopupVc(GL0558, GL0559); enableEditFunction(true); } }
From source file:org.ednovo.gooru.client.mvp.play.collection.preview.metadata.PreviewPlayerMetadataView.java
License:Open Source License
/** * @function deleteComment /* w w w . j av a 2 s . c o m*/ * * @created_date : 03-Jan-2014 * * @description * * @parm(s) : @param commentUid * * @return : void * * @throws : <Mentioned if any exceptions> * */ private void deleteComment(final String commentUid) { Iterator<Widget> widgets = commentsContainer.iterator(); while (widgets.hasNext()) { Widget widget = widgets.next(); if (widget instanceof CommentWidgetChildView && ((CommentWidgetChildView) widget).getCommentUid().equals(commentUid)) { CommentWidgetChildView commentWidgetChildView = ((CommentWidgetChildView) widget); int index = commentsContainer.getWidgetIndex(commentWidgetChildView); commentsContainer.remove(index); final HTMLPanel deletePanel = new HTMLPanel(GL0555); deletePanel.setStyleName(playerStyle.deleteMsg()); commentsContainer.insert(deletePanel, index); new FadeInAndOut(deletePanel.getElement(), 1000); Timer timer = new Timer() { @Override public void run() { int deleteIndex = commentsContainer.getWidgetIndex(deletePanel); commentsContainer.remove(deleteIndex); getUiHandlers().deleteCommentFromCollection(collectionDo.getGooruOid(), commentUid, commentsContainer.getWidgetCount() + "", 1 + ""); } }; timer.schedule(1000); totalHitCount += DECREMENT_BY_ONE; setCommentsText(DECREMENT_BY_ONE); } } }
From source file:org.ednovo.gooru.client.mvp.rating.RatingUserWidgetView.java
License:Open Source License
@UiHandler("deleteReview") public void onClickDeleteReview(ClickEvent event) { AppClientFactory.getInjector().getPlayerAppService().deleteRating(starRatingsDo.getDeleteRatingGooruOid(), new SimpleAsyncCallback<Void>() { @Override/*ww w . j a va2 s. c om*/ public void onSuccess(Void result) { reviewContainer.clear(); reviewContainer.addStyleName(style.deletePanel()); if (!starRatingsDo.getFreeText().equals("") && starRatingsDo.getFreeText() != null) { AppClientFactory .fireEvent(new DeletePlayerStarReviewEvent(starRatingsDo.getAssocGooruOid())); } else { AppClientFactory.fireEvent(new DeletePlayerStarRatingsEvent()); } final HTMLPanel deletePanel = new HTMLPanel(""); Label deleteMsg = new Label(); deleteMsg.setText(i18n.GL1853()); deleteMsg.getElement().setAttribute("alt", i18n.GL1853()); deleteMsg.getElement().setAttribute("title", i18n.GL1853()); deleteMsg.setStyleName(style.lbldeleteMsg()); deletePanel.add(deleteMsg); reviewContainer.add(deletePanel); new FadeInAndOut(deletePanel.getElement(), 1000); Timer timer = new Timer() { @Override public void run() { int deleteIndex = reviewContainer.getWidgetIndex(deletePanel); reviewContainer.remove(deleteIndex); reviewContainer.setVisible(false); AppClientFactory.fireEvent(new UpdateRatingOnDeleteEvent(true)); AppClientFactory .fireEvent(new UpdateRatingsGraphEvent(starRatingsDo.getAssocGooruOid())); } }; timer.schedule(1000); } }); }
From source file:org.ednovo.gooru.client.mvp.search.SearchResultWrapperVc.java
License:Open Source License
/** * Added dragged resource to shelf // ww w . j a v a 2 s. com * @param addedToShelf if is true add dragged resource to shelf else not */ public void setAddedToShelf(boolean addedToShelf) { addedStatusLbl.setText(addedToShelf ? ADDED : DRAG_TO_ADD); if (addedToShelf) { addedStatusLbl.addStyleName(SearchResultWrapperCBundle.INSTANCE.css().added()); if (getDisclosurePanel().isOpen()) { final Timer t = new Timer() { public void run() { getSearchMoreInfoVc().reset(moreInfoMode); } }; t.schedule(2000); } } else { addedStatusLbl.removeStyleName(SearchResultWrapperCBundle.INSTANCE.css().added()); } setAddedStatus(addedToShelf); }