List of usage examples for com.google.gwt.user.client Window scrollTo
public static void scrollTo(int left, int top)
From source file:org.ednovo.gooru.application.client.gin.BasePopupViewWithHandlers.java
License:Open Source License
@Override public void hide() { super.hide(); String count = Cookies.getCookie("MyCookie"); String scrollVal = Cookies.getCookie("getScrollTop"); if (count != null && Integer.parseInt(count) == 7) { } else {/* w w w . ja v a2s . c o m*/ Document.get().getDocumentElement().getStyle().setProperty("overflow", ""); } if (!StringUtil.isEmpty(scrollVal) && AppClientFactory.getCurrentPlaceToken().equalsIgnoreCase(PlaceTokens.SEARCH_COLLECTION)) { Window.scrollTo(0, Integer.parseInt(scrollVal)); } }
From source file:org.ednovo.gooru.application.client.home.HomePresenter.java
License:Open Source License
@Override public void onBind() { super.onBind(); Window.enableScrolling(true); Window.scrollTo(0, 0); MixpanelUtil.Arrive_Landing_Page();//from ww w. j av a2 s . c o m setRegisterdUserAsyncCallback(new SimpleAsyncCallback<UserDo>() { @Override public void onSuccess(final UserDo user) { GWT.runAsync(new SimpleRunAsyncCallback() { @Override public void onSuccess() { initilazeRegistrationView(user); } }); } }); setInSlot(CONTRIBUTORS_SLOT, contributorsPresenter); tooltipTimer = new Timer() { public void run() { contributorsPresenter.getContributors(); } }; tooltipTimer.schedule(TOOLTIP_DELAY_TIME); }
From source file:org.ednovo.gooru.application.client.home.HomePresenter.java
License:Open Source License
private void callBackMethods() { GWT.runAsync(new SimpleRunAsyncCallback() { @Override/* w ww .jav a 2 s .c o m*/ public void onSuccess() { if (AppClientFactory.getLoggedInUser().getConfirmStatus() == 0) { AppClientFactory.fireEvent(new ConfirmStatusPopupEvent(true)); } if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("registration")) { getUserService().getRegistredUserDetails( AppClientFactory.getPlaceManager().getRequestParameter(GOORU_UID), getRegisterdUserAsyncCallback()); parentGooruUID = AppClientFactory.getPlaceManager().getRequestParameter(GOORU_UID); } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("changePassword")) { validateResetLink(AppClientFactory.getPlaceManager().getRequestParameter("resetToken")); } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("signup")) { //To show SignUp (Registration popup) if (AppClientFactory.isAnonymous()) { Window.enableScrolling(false); AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false)); String type = getPlaceManager().getRequestParameter("type"); int displayScreen = getPlaceManager().getRequestParameter("type") != null ? Integer.parseInt(type) : 1; signUpViewPresenter.displayPopup(displayScreen); addToPopupSlot(signUpViewPresenter); } } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("registerChild")) { if (getPlaceManager().getRequestParameter("dob") != null && getPlaceManager().getRequestParameter("userName") != null) { String externalId = AppClientFactory.getLoggedInUser().getExternalId(); String email = AppClientFactory.getLoggedInUser().getEmailId(); String parentEmailId = email != null && !email.equalsIgnoreCase("") ? email : externalId != null && externalId.equalsIgnoreCase("") ? externalId : null; String parameterEmailId = getPlaceManager().getRequestParameter("emailId", null); parentEmailId = parameterEmailId != null && !parameterEmailId.equalsIgnoreCase("") ? parameterEmailId : parentEmailId; StudentSignUpUc studentSignUp = new StudentSignUpUc(parentEmailId, getPlaceManager().getRequestParameter("userName"), getPlaceManager().getRequestParameter("dob").replaceAll("D", "\\/"), AppClientFactory.isAnonymous() ? getPlaceManager().getRequestParameter("privateGooruUId") : AppClientFactory.getLoggedInUser().getGooruUId()); studentSignUp.center(); studentSignUp.show(); } } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("guide")) { } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("profileUpdate")) { if (AppClientFactory.isAnonymous()) { AppClientFactory.fireEvent(new InvokeLoginEvent()); } else { signUpCompletePresenter.displayView(); addToPopupSlot(signUpCompletePresenter); } } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("turn13")) { if (AppClientFactory.isAnonymous()) { AppClientFactory.fireEvent(new InvokeLoginEvent()); } else { if (!signUpAfterThirteenPresenter.isVisible()) { signUpAfterThirteenPresenter.displayView(); addToPopupSlot(signUpAfterThirteenPresenter); } } } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("confirmUser")) { //SignUpGradeCourseView gradeCourseView = new SignUpGradeCourseView(AppClientFactory.getLoggedInUser()); //Check if user is logged or not. if (AppClientFactory.isAnonymous()) { //If not Open Login Popup AppClientFactory.fireEvent(new InvokeLoginEvent()); } else { if (AppClientFactory.getLoggedInUser().getConfirmStatus() == 0) { String gooruUid = getPlaceManager().getRequestParameter("gooruuid") != null ? getPlaceManager().getRequestParameter("gooruuid") : ""; String token = getPlaceManager().getRequestParameter("sessionid") != null ? getPlaceManager().getRequestParameter("sessionid") : ""; Map<String, String> params = new HashMap<String, String>(); params.put("confirmUser", "true"); params.put("gooruUid", AppClientFactory.getLoggedInUser().getGooruUId()); // Confirm User and remove/hide Not confirmed Popup. AppClientFactory.getInjector().getUserService().updateUserDetails(gooruUid, token, params, new SimpleAsyncCallback<ProfileDo>() { @Override public void onSuccess(ProfileDo result) { //Display thanks popup if required. //Set Visiblity to false AppClientFactory.setLoggedInUser(result.getUser()); boolean isConfirmed = result.getUser().getConfirmStatus() == 1 ? true : false; if (isConfirmed) { AppClientFactory .fireEvent(new ConfirmStatusPopupEvent(isConfirmed)); ThanksEmailConfirmPopupUc confirmPopup = new ThanksEmailConfirmPopupUc(); confirmPopup.center(); confirmPopup.show(); } } }); } } } if (getPlaceManager().getRequestParameter(LOGINEVENT) != null && getPlaceManager().getRequestParameter(LOGINEVENT).equalsIgnoreCase("true") && AppClientFactory.isAnonymous()) { AppClientFactory.fireEvent(new InvokeLoginEvent()); } if (getPlaceManager().getRequestParameter(ERROR) != null && getPlaceManager().getRequestParameter(ERROR).equals("401") && AppClientFactory.isAnonymous()) { new AlertContentUc(i18n.GL1966(), i18n.GL1938()); } final UserDo userDo = AppClientFactory.getLoggedInUser(); int flag = userDo != null ? userDo.getViewFlag() : 0; final String loginType = userDo != null && userDo.getLoginType() != null ? userDo.getLoginType() : ""; //Show Popup where user can update his details like, username and role. Show this only for non regular user and if he is logging for the first time. if (!AppClientFactory.isAnonymous() && flag == 0 && !loginType.equalsIgnoreCase(CREDENTIAL)) { Window.enableScrolling(false); AlmostDoneUc update = new AlmostDoneUc(AppClientFactory.getLoggedInUser().getEmailId(), AppClientFactory.getLoggedInUser()); update.setGlassEnabled(true); update.show(); update.center(); Document doc = Document.get(); Element bodyelement = doc.getBody(); Window.scrollTo(0, 0); bodyelement.getParentElement().setAttribute("style", "overflow:hidden"); } else if (flag > 0 && flag <= 11 && !AppClientFactory.isAnonymous()) { showMarketingPopup(userDo); } AppClientFactory.fireEvent(new SetFooterEvent( AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken())); } }); }
From source file:org.ednovo.gooru.application.client.home.HomeView.java
License:Open Source License
@UiHandler("achLearn") public void onClickLearn(ClickEvent event) { GWT.runAsync(new SimpleRunAsyncCallback() { @Override// ww w .j a v a 2 s . c om public void onSuccess() { int scrollTop = 0; try { scrollTop = Document.get().getElementById("getStarted").getAbsoluteTop(); } catch (Exception e) { AppClientFactory.printSevereLogger("achLearn Click Event :" + e.getMessage()); } Window.scrollTo(0, scrollTop - 40); } }); }
From source file:org.ednovo.gooru.application.client.home.HomeView.java
License:Open Source License
@UiHandler("viewSampleResportsBtn") public void onClickViewSampleReportBtn(ClickEvent event) { GWT.runAsync(new SimpleRunAsyncCallback() { @Override// w w w.j a v a 2 s. c om public void onSuccess() { Window.scrollTo(0, 0); SampleReportView sampleReportView = new SampleReportView(); } }); }
From source file:org.ednovo.gooru.application.client.newhome.NewHomePresenter.java
License:Open Source License
private void callBackMethods() { GWT.runAsync(new SimpleRunAsyncCallback() { @Override/* ww w . ja v a 2 s . co m*/ public void onSuccess() { if (AppClientFactory.getLoggedInUser().getConfirmStatus() == 0) { AppClientFactory.fireEvent(new ConfirmStatusPopupEvent(true)); } if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("registration")) { getUserService().getRegistredUserDetails( AppClientFactory.getPlaceManager().getRequestParameter(GOORU_UID), getRegisterdUserAsyncCallback()); parentGooruUID = AppClientFactory.getPlaceManager().getRequestParameter(GOORU_UID); } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("changePassword")) { validateResetLink(AppClientFactory.getPlaceManager().getRequestParameter("resetToken")); } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("signup")) { //To show SignUp (Registration popup) if (AppClientFactory.isAnonymous()) { Window.enableScrolling(false); AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false)); String type = getPlaceManager().getRequestParameter("type"); int displayScreen = getPlaceManager().getRequestParameter("type") != null ? Integer.parseInt(type) : 1; signUpViewPresenter.displayPopup(displayScreen); addToPopupSlot(signUpViewPresenter); } } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("registerChild")) { if (getPlaceManager().getRequestParameter("dob") != null && getPlaceManager().getRequestParameter("userName") != null) { String externalId = AppClientFactory.getLoggedInUser().getExternalId(); String email = AppClientFactory.getLoggedInUser().getEmailId(); String parentEmailId = email != null && !email.equalsIgnoreCase("") ? email : externalId != null && externalId.equalsIgnoreCase("") ? externalId : null; String parameterEmailId = getPlaceManager().getRequestParameter("emailId", null); parentEmailId = parameterEmailId != null && !parameterEmailId.equalsIgnoreCase("") ? parameterEmailId : parentEmailId; StudentSignUpUc studentSignUp = new StudentSignUpUc(parentEmailId, getPlaceManager().getRequestParameter("userName"), getPlaceManager().getRequestParameter("dob").replaceAll("D", "\\/"), AppClientFactory.isAnonymous() ? getPlaceManager().getRequestParameter("privateGooruUId") : AppClientFactory.getLoggedInUser().getGooruUId()); studentSignUp.center(); studentSignUp.show(); } } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("guide")) { } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("profileUpdate")) { if (AppClientFactory.isAnonymous()) { AppClientFactory.fireEvent(new InvokeLoginEvent()); } else { signUpCompletePresenter.displayView(); addToPopupSlot(signUpCompletePresenter); } } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("turn13")) { if (AppClientFactory.isAnonymous()) { AppClientFactory.fireEvent(new InvokeLoginEvent()); } else { if (!signUpAfterThirteenPresenter.isVisible()) { signUpAfterThirteenPresenter.displayView(); addToPopupSlot(signUpAfterThirteenPresenter); } } } else if (getPlaceManager().getRequestParameter(CALLBACK) != null && getPlaceManager().getRequestParameter(CALLBACK).equalsIgnoreCase("confirmUser")) { //SignUpGradeCourseView gradeCourseView = new SignUpGradeCourseView(AppClientFactory.getLoggedInUser()); //Check if user is logged or not. if (AppClientFactory.isAnonymous()) { //If not Open Login Popup AppClientFactory.fireEvent(new InvokeLoginEvent()); } else { if (AppClientFactory.getLoggedInUser().getConfirmStatus() == 0) { String gooruUid = getPlaceManager().getRequestParameter("gooruuid") != null ? getPlaceManager().getRequestParameter("gooruuid") : ""; String token = getPlaceManager().getRequestParameter("sessionid") != null ? getPlaceManager().getRequestParameter("sessionid") : ""; Map<String, String> params = new HashMap<String, String>(); params.put("confirmUser", "true"); params.put("gooruUid", AppClientFactory.getLoggedInUser().getGooruUId()); // Confirm User and remove/hide Not confirmed Popup. AppClientFactory.getInjector().getUserService().updateUserDetails(gooruUid, token, params, new SimpleAsyncCallback<ProfileDo>() { @Override public void onSuccess(ProfileDo result) { //Display thanks popup if required. //Set Visiblity to false AppClientFactory.setLoggedInUser(result.getUser()); boolean isConfirmed = result.getUser().getConfirmStatus() == 1 ? true : false; if (isConfirmed) { AppClientFactory .fireEvent(new ConfirmStatusPopupEvent(isConfirmed)); ThanksEmailConfirmPopupUc confirmPopup = new ThanksEmailConfirmPopupUc(); confirmPopup.center(); confirmPopup.show(); } } }); } } } if (getPlaceManager().getRequestParameter(LOGINEVENT) != null && getPlaceManager().getRequestParameter(LOGINEVENT).equalsIgnoreCase("true") && AppClientFactory.isAnonymous()) { AppClientFactory.fireEvent(new InvokeLoginEvent()); } if (getPlaceManager().getRequestParameter(ERROR) != null && getPlaceManager().getRequestParameter(ERROR).equals("401") && AppClientFactory.isAnonymous()) { new AlertContentUc(i18n.GL1966(), i18n.GL1938()); } final UserDo userDo = AppClientFactory.getLoggedInUser(); int flag = userDo != null ? userDo.getViewFlag() : 0; final String loginType = userDo != null && userDo.getLoginType() != null ? userDo.getLoginType() : ""; //Show Popup where user can update his details like, username and role. Show this only for non regular user and if he is logging for the first time. if (!AppClientFactory.isAnonymous() && flag == 0 && !loginType.equalsIgnoreCase(CREDENTIAL)) { Window.enableScrolling(false); AlmostDoneUc update = new AlmostDoneUc(AppClientFactory.getLoggedInUser().getEmailId(), AppClientFactory.getLoggedInUser()); update.setGlassEnabled(true); update.show(); update.center(); Document doc = Document.get(); Element bodyelement = doc.getBody(); Window.scrollTo(0, 0); bodyelement.getParentElement().setAttribute("style", "overflow:hidden"); } else if (flag > 0 && flag <= 11 && !AppClientFactory.isAnonymous()) { } AppClientFactory.fireEvent(new SetFooterEvent( AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken())); } }); }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.java
License:Open Source License
@Override protected void onReveal() { super.onReveal(); Document doc = Document.get(); Element bodyelement = doc.getBody(); Window.scrollTo(0, 0); bodyelement.setAttribute("style", "min-height:300px"); bodyelement.getParentElement().setAttribute("style", "overflow:hidden"); }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.java
License:Open Source License
@Override protected void onReset() { super.onReset(); Document doc = Document.get(); Element bodyelement = doc.getBody(); Window.scrollTo(0, 0); bodyelement.setAttribute("style", "min-height:300px"); bodyelement.getParentElement().setAttribute("style", "overflow:hidden"); }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.end.study.AssessmentsHomeMetadataView.java
License:Open Source License
/** * * @function oncustomizeCollectionBtnClicked * * @created_date : 11-Dec-2013//from w w w .j a v a 2 s . c o m * * @description * * * @parm(s) : @param clickEvent * * @return : void * * @throws : <Mentioned if any exceptions> * */ @UiHandler("customizeCollectionBtn") public void oncustomizeCollectionBtnClicked(ClickEvent clickEvent) { final String collectionId = clickEvent.getRelativeElement().getAttribute("collectionId"); final String collectionTitle = collectionDo.getTitle(); if (!isCustomizePopup) { isCustomizePopup = true; Window.scrollTo(0, 0); if (AppClientFactory.isAnonymous()) { LoginPopupUc loginPopupUc = new LoginPopupUc() { @Override public void onLoginSuccess() { Window.enableScrolling(false); getUiHandlers().setDefultVersionAndType(); remixPresenterWidget.DisableMyCollectionsPanelData(false); remixPresenterWidget.getLoadingImage(); remixPresenterWidget.getUserShelfCollectionsData(collectionId, "coursebuilder", collectionTitle); remixPresenterWidget.getView().getAppPopUp().show(); isCustomizePopup = false; remixPresenterWidget.getView().getAppPopUp().center(); remixPresenterWidget.getView().getAppPopUp().setGlassEnabled(true); remixPresenterWidget.getView().getAppPopUp().setGlassStyleName("setGlassPanelZIndex"); } }; loginPopupUc.show(); loginPopupUc.setGlassEnabled(true); loginPopupUc.setGlassStyleName("setGlassPanelZIndex"); } else { getUiHandlers().setDefultVersionAndType(); remixPresenterWidget.DisableMyCollectionsPanelData(false); remixPresenterWidget.getLoadingImage(); remixPresenterWidget.getUserShelfCollectionsData(collectionId, "coursebuilder", collectionTitle); remixPresenterWidget.getView().getAppPopUp().show(); isCustomizePopup = false; remixPresenterWidget.getView().getAppPopUp().center(); remixPresenterWidget.getView().getAppPopUp().setGlassEnabled(true); remixPresenterWidget.getView().getAppPopUp().setGlassStyleName("setGlassPanelZIndex"); } // successPopupVc.setWidth("500px"); /*if (!BrowserAgent.isDevice() && AppClientFactory.isAnonymous()){ successPopupVc.setWidth("500px"); successPopupVc.setHeight("515px"); }else if(!BrowserAgent.isDevice() && !AppClientFactory.isAnonymous()){ successPopupVc.setWidth("500px"); successPopupVc.setHeight("336px"); } successPopupVc.show(); successPopupVc.center();*/ Map<String, String> params = StringUtil.splitQuery(Window.Location.getHref()); } }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.end.study.AssessmentsHomeMetadataView.java
License:Open Source License
/** * * @function oncustomizeCollectionBtnClicked * * @created_date : 11-Dec-2013// www. java2s . c o m * * @description * * * @parm(s) : @param clickEvent * * @return : void * * @throws : <Mentioned if any exceptions> * */ @UiHandler("shareCollectionBtn") public void onshareCollectionBtnClicked(ClickEvent clickEvent) { getUiHandlers().triggerCollectionShareDataEvent(null, PlayerDataLogEvents.COLLECTION, "gooru", false); String collectionId = collectionDo.getGooruOid(); AssignPopupVc successPopupVc = new AssignPopupVc(collectionId, collectionDo.getTitle(), collectionDo.getGoals()) { @Override public void closePoup() { Window.enableScrolling(true); this.hide(); } }; Window.scrollTo(0, 0); int clientHeight = Window.getClientHeight(); //successPopupVc.setWidth("500px"); //successPopupVc.setHeight("658px"); if (clientHeight > 625) { clientHeight = 625; //successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;overflow-x:hidden;overflow-y:scroll"); } /*else{ successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;overflow-x:hidden;overflow-y:scroll"); }*/ successPopupVc.show(); int left = (Window.getClientWidth() - 500) >> 1; int top = (Window.getClientHeight() - clientHeight) >> 1; // successPopupVc.setHeight("658px"); // successPopupVc.setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max(Window.getScrollTop()+5, 0)); /*if(AppClientFactory.isAnonymous()){ successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), -30); }*/ if (!BrowserAgent.isDevice() && AppClientFactory.isAnonymous()) { /*successPopupVc.setWidth("550px"); successPopupVc.setHeight("625px"); successPopupVc.center();*/ successPopupVc.setPopupPosition(0, (Window.getClientHeight() - 625) / 2); } else if (!BrowserAgent.isDevice() && !AppClientFactory.isAnonymous()) { /*successPopupVc.setWidth("550px"); successPopupVc.setHeight("502px"); successPopupVc.center();*/ successPopupVc.setPopupPosition(0, (Window.getClientHeight() - 527) / 2); } }