Example usage for com.google.gwt.user.client Window scrollTo

List of usage examples for com.google.gwt.user.client Window scrollTo

Introduction

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

Prototype

public static void scrollTo(int left, int top) 

Source Link

Usage

From source file:org.ednovo.gooru.client.mvp.gshelf.ShelfMainPresenter.java

License:Open Source License

@Override
protected void onReset() {
    super.onReset();
    Window.enableScrolling(true);
    String id = getPlaceManager().getRequestParameter("id");
    String o1 = getPlaceManager().getRequestParameter("o1");
    String o2 = getPlaceManager().getRequestParameter("o2");
    String o3 = getPlaceManager().getRequestParameter("o3");

    String idParm = AppClientFactory.getPlaceManager().getRequestParameter("id") != null
            && !AppClientFactory.getPlaceManager().getRequestParameter("id").equalsIgnoreCase("")
                    ? AppClientFactory.getPlaceManager().getRequestParameter("id")
                    : null;/*from w w w  . j av a  2  s .  c o  m*/
    String isSuccessParm = AppClientFactory.getPlaceManager().getRequestParameter("isSuccess") != null
            && !AppClientFactory.getPlaceManager().getRequestParameter("isSuccess").equalsIgnoreCase("")
                    ? AppClientFactory.getPlaceManager().getRequestParameter("isSuccess")
                    : null;
    if (isSuccessParm != null && isSuccessParm.equalsIgnoreCase("true") && isSuccess) {
        SetDefaultTypeAndVersion();
        isSuccess = false;
    }
    if (idParm != null && AppClientFactory.isAnonymous()) {
        AppClientFactory.fireEvent(new InvokeLoginEvent());

    } else if (AppClientFactory.isAnonymous()) {
        getView().setNoDataForAnonymousUser(true);
    } else {
        if (version == null || (version != null
                && !version.equalsIgnoreCase(AppClientFactory.getLoggedInUser().getToken()))) {
            Window.scrollTo(0, 0);
            callWorkspaceApi();
            version = AppClientFactory.getLoggedInUser().getToken();
            if (o3 != null && id == null) {
                getFolderMetaData(o3);
            } else if (o2 != null && id == null) {
                getFolderMetaData(o2);
            } else if (o1 != null && id == null) {
                getFolderMetaData(o1);
            } else if (idParm != null && !isApiCalled) {
                isApiCalled = true;
                getResourceService().getCollection(idParm, false, getCollectionAsyncCallback());
            }
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.gshelf.unitdetails.UnitInfoPresenter.java

License:Open Source License

@Override
public void createAndSaveUnitDetails(final CreateDo createDo, final boolean isCreateLesson,
        final FolderDo courseObj, final String courseId, final TreeItem currentShelfTreeWidget) {
    AppClientFactory.getInjector().getfolderService().createCourse(createDo, true, courseId, null, null,
            new SimpleAsyncCallback<FolderDo>() {
                @Override//from   w w w. j  a  va 2s .c o  m
                public void onSuccess(FolderDo result) {
                    getView().resetBtns();
                    params.put("o1", courseId);
                    params.put("o2", result.getGooruOid());
                    params.put("view", "Course");
                    myCollectionsRightClusterPresenter.getShelfMainPresenter().updateTitleOfTreeWidget(result,
                            isCreateLesson, currentShelfTreeWidget);
                    myCollectionsRightClusterPresenter.updateBreadCrumbsTitle(result, UNIT);
                    AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.MYCONTENT, params);
                    if (isCreateLesson) {
                        myCollectionsRightClusterPresenter.setTabItems(1, UNIT, result);
                        myCollectionsRightClusterPresenter.setTabItems(1, LESSON, null);
                        myCollectionsRightClusterPresenter.setUnitTemplate(LESSON, currentShelfTreeWidget);
                    } else {
                        myCollectionsRightClusterPresenter.setFolderListDoChild(null);
                        myCollectionsRightClusterPresenter.setTabItems(2, UNIT, result);
                    }
                    Window.scrollTo(0, 0);
                    getView().spinnerImageVisibility(false);
                }
            });
}

From source file:org.ednovo.gooru.client.mvp.gshelf.unitdetails.UnitInfoPresenter.java

License:Open Source License

@Override
public void updateUnitDetails(final CreateDo createDo, final String id, final boolean isCreateUnit,
        final FolderDo folderDo, final TreeItem currentShelfTreeWidget) {
    String o1 = AppClientFactory.getPlaceManager().getRequestParameter("o1", null);
    AppClientFactory.getInjector().getfolderService().updateCourse(o1, id, null, null, createDo,
            new SimpleAsyncCallback<Void>() {
                @Override//w  w  w.j  ava  2s  . c  o  m
                public void onSuccess(Void result) {
                    getView().resetBtns();
                    folderDo.setTitle(createDo.getTitle());
                    folderDo.setType(UNIT);
                    folderDo.setIdeas(createDo.getIdeas());
                    folderDo.setQuestions(createDo.getQuestions());
                    //folderDo.setGooruOid(id);
                    myCollectionsRightClusterPresenter.getShelfMainPresenter().updateTitleOfTreeWidget(folderDo,
                            isCreateUnit, currentShelfTreeWidget);
                    myCollectionsRightClusterPresenter.updateBreadCrumbsTitle(folderDo, UNIT);
                    if (isCreateUnit) {
                        myCollectionsRightClusterPresenter.setTabItems(1, UNIT, folderDo);
                        myCollectionsRightClusterPresenter.setTabItems(1, LESSON, null);
                        myCollectionsRightClusterPresenter.setUnitTemplate(LESSON, currentShelfTreeWidget);
                    } else {
                        myCollectionsRightClusterPresenter.setTabItems(2, UNIT, folderDo);
                    }
                    Window.scrollTo(0, 0);
                    getView().spinnerImageVisibility(false);
                }
            });
}

From source file:org.ednovo.gooru.client.mvp.gshelf.unitdetails.UnitInfoView.java

License:Open Source License

@UiHandler("saveUnitBtn")
public void clickOnSaveUnitBtn(ClickEvent saveCourseEvent) {
    TreeItem currentShelfTreeWidget = getUiHandlers().getSelectedWidget();
    String courseId = AppClientFactory.getPlaceManager().getRequestParameter(O1_LEVEL, null);
    saveUnitBtn.addStyleName("disabled");
    saveUnitBtn.setEnabled(false);//w  w w  . jav  a 2  s. com
    spinnerImageVisibility(true);
    CreateDo createOrUpDate = new CreateDo();
    createOrUpDate.setTitle(unitTitle.getText());
    createOrUpDate.setIdeas(txaBigIdeas.getText());
    createOrUpDate.setQuestions(txaEssentialQuestions.getText());
    createOrUpDate.setSubdomainIds(getSelectedSubDomainIds());
    createOrUpDate.setTaxonomyCourseIds(getSelectedCourseIds());
    if (validateInputs()) {
        lblErrorMessage.setVisible(false);
        unitTitle.removeStyleName("textAreaErrorMessage");
        getUiHandlers().checkProfanity(unitTitle.getText().trim(), false, 0, courseId, createOrUpDate,
                currentShelfTreeWidget);
    } else {
        Window.scrollTo(unitTitle.getAbsoluteLeft(),
                unitTitle.getAbsoluteTop() - (unitTitle.getOffsetHeight() * 3));
        lblErrorMessage.setVisible(true);
        unitTitle.setStyleName("textAreaErrorMessage");
        unitTitle.addStyleName("form-control");
        resetBtns();
        spinnerImageVisibility(false);
    }
}

From source file:org.ednovo.gooru.client.mvp.gshelf.unitdetails.UnitInfoView.java

License:Open Source License

@UiHandler("nextCreateLessonBtn")
public void clickOnNextLessonBtn(ClickEvent saveCourseEvent) {
    TreeItem currentShelfTreeWidget = getUiHandlers().getSelectedWidget();
    String courseId = AppClientFactory.getPlaceManager().getRequestParameter(O1_LEVEL, null);
    nextCreateLessonBtn.addStyleName("disabled");
    nextCreateLessonBtn.setEnabled(false);
    spinnerImageVisibility(true);//from w w  w  .  j  av  a  2  s.  c om

    CreateDo createOrUpDate = new CreateDo();
    createOrUpDate.setTitle(unitTitle.getText());
    createOrUpDate.setIdeas(txaBigIdeas.getText());
    createOrUpDate.setQuestions(txaEssentialQuestions.getText());
    createOrUpDate.setSubdomainIds(getSelectedSubDomainIds());
    createOrUpDate.setTaxonomyCourseIds(getSelectedCourseIds());
    if (validateInputs()) {
        lblErrorMessage.setVisible(false);
        unitTitle.removeStyleName("textAreaErrorMessage");
        getUiHandlers().checkProfanity(unitTitle.getText().trim(), true, 0, courseId, createOrUpDate,
                currentShelfTreeWidget);
    } else {
        Window.scrollTo(unitTitle.getAbsoluteLeft(),
                unitTitle.getAbsoluteTop() - (unitTitle.getOffsetHeight() * 3));
        lblErrorMessage.setVisible(true);
        unitTitle.setStyleName("textAreaErrorMessage");
        unitTitle.addStyleName("form-control");
        resetBtns();
        spinnerImageVisibility(false);
    }
}

From source file:org.ednovo.gooru.client.mvp.home.FeaturedSlideVc.java

License:Open Source License

/**
 * To play the featured collection/*w w  w.  j a v a  2s .c  o m*/
 * @param e {@link ClickEvent} instance
 */
@UiHandler("collectionStudyButtonFocPanel")
public void playCollectionByContentImage(ClickEvent e) {
    MixpanelUtil.Click_FeaturedCollection();
    FeaturedContentVc.elapsedTimer.scheduleRepeating(500 * 6);
    Window.scrollTo(0, 0);
    Element embedElement = Document.get().getElementById("embed");
    Element parentElement = Document.get().getElementById("embed").getParentElement();
    embedElement.removeFromParent();

    Map<String, String> params = new HashMap<String, String>();
    params.put("id", this.collectionGooruOid.getValue());
    AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.PREVIEW_PLAY, params);
}

From source file:org.ednovo.gooru.client.mvp.home.library.LibraryTopicListView.java

License:Open Source License

/**
 * /*from   w w w .  jav  a  2 s. c o  m*/
 * @function onassignCollectionBtnClicked 
 * 
 * @created_date : 11-Dec-2013
 * 
 * @description
 * 
 * 
 * @parm(s) : @param clickEvent
 * 
 * @return : void
 *
 * @throws : <Mentioned if any exceptions>
 *
 * 
 */
@UiHandler("assignCollectionBtn")
public void onassignCollectionBtnClicked(ClickEvent clickEvent) {
    String collectionId = getConceptDo().getGooruOid();
    if (AppClientFactory.getPlaceManager().getRequestParameter(STANDARD_ID) != null) {
        MixpanelUtil.mixpanelEvent("standardlibrary_assign_collection");
    }
    MixpanelUtil.mixpanelEvent("LandingPage_Assign_Collection");

    if (!isAssignPopup) {
        isAssignPopup = true;
        AssignPopupVc successPopupVc = new AssignPopupVc(collectionId, getConceptDo().getTitle(),
                getConceptDo().getGoals()) {

            @Override
            public void closePoup() {
                Window.enableScrolling(true);
                this.hide();
                isAssignPopup = false;
            }
        };
        Window.scrollTo(0, 0);
        successPopupVc.setWidth("500px");
        successPopupVc.setHeight("auto");

        successPopupVc.show();
        successPopupVc.center();
        if (AppClientFactory.isAnonymous()) {
            successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 30);
        } else {
            successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 30);
        }

    }

}

From source file:org.ednovo.gooru.client.mvp.home.library.LibraryTopicListView.java

License:Open Source License

/**
 * // w w  w. j ava  2 s .c o  m
 * @function oncustomizeCollectionBtnClicked 
 * 
 * @created_date : 11-Dec-2013
 * 
 * @description
 * 
 * 
 * @parm(s) : @param clickEvent
 * 
 * @return : void
 *
 * @throws : <Mentioned if any exceptions>
 *
 */
@UiHandler("customizeCollectionBtn")
public void oncustomizeCollectionBtnClicked(ClickEvent clickEvent) {
    if (AppClientFactory.getPlaceManager().getRequestParameter(STANDARD_ID) != null) {
        MixpanelUtil.mixpanelEvent("standardlibrary_customize_collection");
    }
    String collectionId = getConceptDo().getGooruOid();
    MixpanelUtil.mixpanelEvent("LandingPage_customize_collection");

    if (!isCustomizePopup) {
        isCustomizePopup = true;
        Boolean loginFlag = false;
        if (AppClientFactory.isAnonymous()) {
            loginFlag = true;
        } else {
            loginFlag = false;
        }
        RenameAndCustomizeLibraryPopUp successPopupVc = new RenameAndCustomizeLibraryPopUp(collectionId,
                loginFlag, getConceptDo().getTitle()) {

            @Override
            public void closePoup() {
                Window.enableScrolling(true);
                this.hide();
                isCustomizePopup = false;
            }
        };
        Window.scrollTo(0, 0);
        successPopupVc.setWidth("500px");
        successPopupVc.setHeight("340px");
        successPopupVc.show();
        successPopupVc.center();
    }

}

From source file:org.ednovo.gooru.client.mvp.home.library.LibraryView.java

License:Open Source License

/**
 * /*from  ww  w .j a  va2  s  .c  o  m*/
 * @function loadContributorsPage 
 * 
 * @created_date : 03-Dec-2013
 * 
 * @description
 * 
 * @param placeToken 
 * 
 * @return : void
 *
 * @throws : <Mentioned if any exceptions>
 *
 */
public void loadContributorsPage(String callBack, String placeToken) {
    setPlaceToken(placeToken);
    String courseId = AppClientFactory.getPlaceManager().getRequestParameter(COURSE_ID);
    String unitId = AppClientFactory.getPlaceManager().getRequestParameter(UNIT_ID);
    String subjectId = AppClientFactory.getPlaceManager().getRequestParameter(SUBJECT_NAME);
    String standardId = AppClientFactory.getPlaceManager().getRequestParameter(STANDARD_ID);
    subjectListId = subjectId;
    unitListId = unitId;
    standardListId = standardId;
    selectedPage = 1;
    String callBackSignup = AppClientFactory.getPlaceManager().getRequestParameter(CALLBACK, null);
    String discoverUrl = Window.Location.getHref();
    if (!AppClientFactory.isAnonymous()) {
        final String loginType = AppClientFactory.getLoggedInUser().getLoginType() != null
                ? AppClientFactory.getLoggedInUser().getLoginType()
                : "";
        int flag = AppClientFactory.getLoggedInUser().getViewFlag();
        if (flag <= 7 && !loginType.equalsIgnoreCase("apps")) {
            Window.enableScrolling(false);
        } else {
            Window.enableScrolling(true);
        }
    } else {
        Window.enableScrolling(true);
    }

    if (callBack.equalsIgnoreCase(FEATURED_CONTRIBUTORS)) {
        discoverUrl.replaceAll("&page=" + FEATURED_CONTRIBUTORS, "");
        AppClientFactory.fireEvent(new SetDiscoverLinkEvent(discoverUrl));
        featuredCourseTabs.setVisible(false);
        featuredCousesLbl.setVisible(false);
        landingBanner.setVisible(false);
        container.setVisible(false);
        contributorsContainer.setVisible(true);
        if (contributorsContainer.getWidgetCount() <= 0) {
            contributorsContainer.add(new LibraryContributorsView(getPlaceToken()));
        }
        libraryMenuNavigation.setTabSelection(FEATURED_CONTRIBUTORS);
    } else if (callBack.equalsIgnoreCase(COURSE_PAGE)) {
        AppClientFactory.fireEvent(new SetDiscoverLinkEvent(discoverUrl));
        landingBanner.setVisible(false);
        contributorsContainer.setVisible(false);
        featuredCourseTabs.setVisible(false);
        featuredCousesLbl.setVisible(false);
        if (subjectId.equals(STANDARDS)) {
            featuredContributorsLink.setVisible(false);
        } else {
            featuredContributorsLink.setVisible(true);
        }
        featuredEducator.setVisible(true);
        courseBanner.setVisible(true);
        container.setVisible(true);

        Window.scrollTo(0, 0);
        if (standardId == null) {
            String subjectName = getSubjectNameBySubjectId(courseMap, subjectId);
            CourseDo courseDo = null;
            if (subjectName != null && courseMap.get(subjectName) != null
                    && courseMap.get(subjectName).getData() != null && courseId != null) {
                libraryMenuNavigation.setTabSelection(subjectName);
                courseDo = getCourseDoFromCourseId(courseMap.get(subjectName), courseId);
                setCourseData(courseDo);
            } else {
                libraryMenuNavigation.getTaxonomyData(subjectId, courseId);
            }
        } else {
            String subjectName = STANDARDS;
            CourseDo courseDo = null;
            if (subjectName != null && standardsMap.get(subjectName) != null
                    && standardsMap.get(subjectName).getData() != null && courseId != null) {
                libraryMenuNavigation.setTabSelection(subjectName);
                courseDo = getCourseDoFromCourseIdStandards(standardsMap.get(STANDARDS), standardId, courseId);
                setCourseData(courseDo);
            } else {
                libraryMenuNavigation.getTaxonomyData(subjectId, courseId);
            }
        }

    } else if (callBack.equalsIgnoreCase(FEATURED_COURSE_PAGE)) {
        libraryMenuNavigation.setTabSelection(FEATURED_LABEL);
        if (callBackSignup != null) {
            Window.enableScrolling(false);
        }
        AppClientFactory.fireEvent(new SetDiscoverLinkEvent(discoverUrl));
        contributorsContainer.setVisible(false);
        featuredEducator.setVisible(false);
        courseBanner.setVisible(false);
        landingBanner.setVisible(true);
        container.setVisible(true);
        featuredCourseTabs.setVisible(true);
        featuredCousesLbl.setVisible(true);
        if ((callBack != previousCallBack) || (courseId != previousCourseId)) {
            if (courseMap != null && courseMap.get("featured") != null) {
                setFeaturedCourseWidgets(courseMap.get("featured").getData(), true);
            } else {
                getFeaturedCourses(FEATURED_LABEL);
            }
        }
    } else if (callBack.equalsIgnoreCase(PARTNER_PAGE)) {
        if (courseMap != null && courseMap.get(FEATURED_LABEL) != null) {
        } else {
            getFeaturedCourses(FEATURED_LABEL);
        }
        landingBanner.setVisible(false);
        contributorsContainer.setVisible(false);

        //For setting the partner's website data
        featuredEducator.setVisible(true);
        educatorPhoto.setVisible(false);
        featuredContributor.setVisible(false);
        featuredContributorsLink.setVisible(true);

        featuredCourseTabs.setVisible(false);
        featuredCousesLbl.setVisible(false);
        courseBanner.setVisible(true);
        container.setVisible(true);
    }
    this.previousCallBack = callBack;
    this.previousCourseId = courseId;
}

From source file:org.ednovo.gooru.client.mvp.library.district.DistrictMenuNav.java

License:Open Source License

protected void setTaxonomyData(final String subjectname, final String subjectCode,
        ProfileLibraryListDo profileLibraryListDo) {
    if (profileLibraryListDo.getSearchResult() != null) {
        for (final ProfileLibraryDo profileLibraryDo : profileLibraryListDo.getSearchResult()) {
            Label courseTitle = new Label(profileLibraryDo.getTitle());
            courseTitle.setStyleName(districtStyleUc.courseOption());
            final String courseId = profileLibraryDo.getGooruOid().toString();
            courseTitle.addClickHandler(new ClickHandler() {
                @Override/*  ww  w . j a  v a  2s. c om*/
                public void onClick(ClickEvent event) {
                    Window.scrollTo(0, 0);
                    setTabSelection(subjectname);
                    getCourse(courseId, subjectname, profileLibraryDo);
                }
            });
            if (subjectname.equalsIgnoreCase(SCIENCE)) {
                scienceCourses.add(courseTitle);
            } else if (subjectname.equalsIgnoreCase(MATH)) {
                mathCourses.add(courseTitle);
            } else if (subjectname.equalsIgnoreCase(SOCIAL)) {
                socialCourses.add(courseTitle);
            } else if (subjectname.equalsIgnoreCase(LANGUAGE)) {
                elaCourses.add(courseTitle);
            } else if (subjectname.equalsIgnoreCase(LEARNING)) {
                learnCourses.add(courseTitle);
            }
        }
    }
}