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.play.collection.preview.home.PreviewHomeView.java

License:Open Source License

/**
 * //from  w  ww  .  ja  va2  s. c  om
 * @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) {
    MixpanelUtil.Preview_Click_Assign();
    String collectionId = clickEvent.getRelativeElement().getAttribute("collectionId");

    if (!isAssignPopup) {
        isAssignPopup = true;
        AssignPopupPlayerVc successPopupVc = new AssignPopupPlayerVc(collectionId) {

            @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.play.collection.preview.home.PreviewHomeView.java

License:Open Source License

/**
 * /* w w  w.  j  a v  a2 s .  c om*/
 * @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) {
    MixpanelUtil.Preview_Click_Customize();
    String collectionId = clickEvent.getRelativeElement().getAttribute("collectionId");
    if (!isCustomizePopup) {
        isCustomizePopup = true;
        Boolean loginFlag = false;
        if (AppClientFactory.isAnonymous()) {
            loginFlag = true;
        } else {
            loginFlag = false;
        }
        RenameCustomizePopUp successPopupVc = new RenameCustomizePopUp(collectionId, loginFlag) {

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

}

From source file:org.ednovo.gooru.client.mvp.play.collection.preview.home.PreviewHomeView.java

License:Open Source License

/**
 * //from www .  j  a  v a  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("shareCollectionBtn")
public void onshareCollectionBtnClicked(ClickEvent clickEvent) {
    MixpanelUtil.Preview_Click_Share();
    String collectionId = clickEvent.getRelativeElement().getAttribute("collectionId");

    if (!isSharePopup) {
        isSharePopup = true;

        SharePlayerVc successPopupVc = new SharePlayerVc(collectionId) {

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

}

From source file:org.ednovo.gooru.client.mvp.profilepage.data.item.ProfileTopicListView.java

License:Open Source License

@UiHandler("assignCollectionBtn")
public void onassignCollectionBtnClicked(ClickEvent clickEvent) {
    String collectionId = getProfileLibraryDo().getGooruOid();
    if (!isAssignPopup) {
        isAssignPopup = true;/*w w w.ja  v  a2 s .  co  m*/
        final Map<String, String> params = StringUtil.splitQuery(Window.Location.getHref());
        if (params.containsKey(CUSTOMIZE)) {
            params.remove(CUSTOMIZE);
        }
        AssignPopupVc successPopupVc = new AssignPopupVc(collectionId, getProfileLibraryDo().getTitle(),
                getProfileLibraryDo().getGoals()) {
            @Override
            public void closePoup() {
                Window.enableScrolling(true);
                this.hide();
                isAssignPopup = false;
            }
        };
        Window.scrollTo(0, 0);
        successPopupVc.setWidth("500px");
        successPopupVc.setHeight("657px");
        successPopupVc.show();
        successPopupVc.center();
        if (AppClientFactory.isAnonymous()) {
            successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 10);
        } else {
            successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 10);
        }

        params.put(ASSIGN, "yes");
        params.put("collectionId", collectionId);
        PlaceRequest placeRequest = AppClientFactory.getPlaceManager()
                .preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params);
        AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true);
    }
}

From source file:org.ednovo.gooru.client.mvp.profilepage.data.item.ProfileTopicListView.java

License:Open Source License

@UiHandler("customizeCollectionBtn")
public void oncustomizeCollectionBtnClicked(ClickEvent clickEvent) {
    String collectionId = getProfileLibraryDo().getGooruOid();
    if (!isCustomizePopup) {
        isCustomizePopup = true;/*from ww w  . jav a 2  s.  c o m*/
        Boolean loginFlag = false;
        if (AppClientFactory.isAnonymous()) {
            loginFlag = true;
        } else {
            loginFlag = false;
        }
        final Map<String, String> params = StringUtil.splitQuery(Window.Location.getHref());
        if (params.containsKey(ASSIGN)) {
            params.remove(ASSIGN);
        }
        RenameAndCustomizeLibraryPopUp successPopupVc = new RenameAndCustomizeLibraryPopUp(collectionId,
                loginFlag, getProfileLibraryDo().getTitle()) {
            @Override
            public void closePoup() {
                Window.enableScrolling(true);
                this.hide();
                isCustomizePopup = false;
            }
        };
        Window.scrollTo(0, 0);
        successPopupVc.setWidth("500px");
        successPopupVc.setHeight("475px");
        successPopupVc.show();
        successPopupVc.center();

        params.put(CUSTOMIZE, "yes");
        params.put("collectionId", collectionId);
        PlaceRequest placeRequest = AppClientFactory.getPlaceManager()
                .preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params);
        AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true);
    }
}

From source file:org.ednovo.gooru.client.mvp.profilepage.data.item.ProfileTopicListView.java

License:Open Source License

/**
 * //from w w w.  j  a  va 2  s . c o m
 * Showing Customize or Assign popup after login with gmail account.
 * 
 */

private void showPopupAfterGmailSignin() {

    String collectionId = getProfileLibraryDo().getGooruOid() != null ? getProfileLibraryDo().getGooruOid()
            : null;
    String colleId = AppClientFactory.getPlaceManager().getRequestParameter("collectionId") != null
            ? AppClientFactory.getPlaceManager().getRequestParameter("collectionId")
            : null;
    String customize = AppClientFactory.getPlaceManager().getRequestParameter(CUSTOMIZE) != null
            ? AppClientFactory.getPlaceManager().getRequestParameter(CUSTOMIZE)
            : null;
    String assign = AppClientFactory.getPlaceManager().getRequestParameter(ASSIGN) != null
            ? AppClientFactory.getPlaceManager().getRequestParameter(ASSIGN)
            : null;

    if (customize != null && customize.equals("yes")) {
        if (colleId.equals(collectionId) && isVisible) {
            isVisible = false;
            Boolean loginFlag = false;
            if (AppClientFactory.isAnonymous()) {
                loginFlag = true;
            } else {
                loginFlag = false;
            }
            final Map<String, String> params = StringUtil.splitQuery(Window.Location.getHref());
            RenameAndCustomizeLibraryPopUp customizePopup = new RenameAndCustomizeLibraryPopUp(collectionId,
                    loginFlag, getProfileLibraryDo().getTitle()) {
                @Override
                public void closePoup() {
                    Window.enableScrolling(true);
                    this.hide();
                    isCustomizePopup = false;

                }
            };
            Window.scrollTo(0, 0);
            customizePopup.setWidth("500px");
            customizePopup.setHeight("440px");
            customizePopup.show();
            customizePopup.center();

        }

    }
    if (assign != null && assign.equals("yes")) {
        final Map<String, String> params = StringUtil.splitQuery(Window.Location.getHref());
        if (colleId.equals(collectionId) && isVisible) {
            isVisible = false;
            AssignPopupVc assignPopup = new AssignPopupVc(collectionId, getProfileLibraryDo().getTitle(),
                    getProfileLibraryDo().getGoals()) {
                @Override
                public void closePoup() {
                    Window.enableScrolling(true);
                    this.hide();
                    isAssignPopup = false;
                    params.remove(ASSIGN);
                    PlaceRequest placeRequest = AppClientFactory.getPlaceManager()
                            .preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params);
                    AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true);
                }
            };
            Window.scrollTo(0, 0);
            assignPopup.setWidth("500px");
            assignPopup.setHeight("657px");
            assignPopup.show();
            assignPopup.center();
            if (AppClientFactory.isAnonymous()) {
                assignPopup.setPopupPosition(assignPopup.getAbsoluteLeft(), 10);
            } else {
                assignPopup.setPopupPosition(assignPopup.getAbsoluteLeft(), 10);
            }

        }

    }

}

From source file:org.ednovo.gooru.client.mvp.profilepage.data.ProfilePageLibraryView.java

License:Open Source License

@Override
public void setUnitList(final ProfileLibraryListDo profileLibraryListDo) {
    totalLeftPanelCount = profileLibraryListDo.getCount();
    String folderId = AppClientFactory.getPlaceManager().getRequestParameter(FOLDERID);
    int firstWidgetCount = leftNav.getWidgetCount();
    final ArrayList<ProfileLibraryDo> folderList = profileLibraryListDo.getSearchResult();
    for (int i = 0; i < folderList.size(); i++) {
        LeftMenuItemView leftMenuItemView = new LeftMenuItemView(folderList.get(i));
        leftNav.add(leftMenuItemView);/*from  www .  j a v a2s . co m*/
        leftMenuItemView.setWidgetCount(leftNav.getWidgetCount() + 1);
        leftMenuItemView.setType(folderList.get(i).getType());
        if (folderList.get(i).getType().equals("scollection")) {
            leftMenuItemView.addStyleName(style.collection());
        }
        if (firstWidgetCount == 0 && folderId == null) {
            firstWidgetCount++;
            loadingPanel(true);
            leftMenuItemView.addStyleName(style.open());
            leftMenuItemView.addStyleName(style.active());
            unitListId = folderList.get(i).getGooruOid();
            if (folderList.get(i).getType().equals("scollection")) {
                setTopicListData(folderList.get(i), unitListId);
            } else {
                setTopicListData(folderList.get(i).getCollectionItems(), unitListId);
            }
        }
    }

    final Iterator<Widget> widgets = leftNav.iterator();

    while (widgets.hasNext()) {
        final Widget widget = widgets.next();
        final LeftMenuItemView leftMenuItemView = ((LeftMenuItemView) widget);
        leftMenuItemView.getUnitMenuItemPanel().addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if (leftMenuItemView.getWidgetCount() > 10) {
                    Window.scrollTo(0, 0);
                }
                loadingPanel(true);
                final Iterator<Widget> widgetsPanel = leftNav.iterator();
                while (widgetsPanel.hasNext()) {
                    final Widget widgetTxt = widgetsPanel.next();
                    widgetTxt.removeStyleName(style.active());
                    widgetTxt.removeStyleName(style.open());
                }
                widget.addStyleName(style.open());
                widget.addStyleName(style.active());
                unitListId = leftMenuItemView.getUnitId();
                if (leftMenuItemView.getType().equals("scollection")) {
                    getPresenter().getProfileLibraryCollection(unitListId, false);
                } else {
                    getPresenter().getPartnerChildFolderItems(unitListId, 1);
                }
            }
        });
    }
    isApiProgress = true;
}

From source file:org.ednovo.gooru.client.mvp.search.SearchResultWrapperVc.java

License:Open Source License

/**
 * Set moreInfo and share meat data//from  www  .j a  va2s .  co m
 * @param searchResultDo Type of SearchResultDo
 */
public void setData(T searchResultDo) {
    this.searchResultDo = searchResultDo;
    //getSearchMoreInfoVc().setData(searchResultDo); 
    getSearchShareVc().setData(searchResultDo);

    final String gooruOid = searchResultDo.getGooruOid();
    resourcePlayerClickPanel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            Map<String, String> params = new HashMap<String, String>();
            params.put("id", gooruOid);
            if (rootWebUrl.contains("collection-search")) {
                Window.scrollTo(0, 0);
                AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.COLLECTION_PLAY, params);
            } else if (rootWebUrl.contains("resource-search")) {
                params.put("pn", "resource");
                AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.RESOURCE_PLAY, params);
            }
        }
    });

}

From source file:org.ednovo.gooru.client.mvp.search.SearchRootPresenter.java

License:Open Source License

@Override
protected void onReveal() {
    super.onReveal();
    Window.scrollTo(0, 0);
}

From source file:org.ednovo.gooru.client.mvp.settings.UserSettingsPresenter.java

License:Open Source License

@Override
public void onReveal() {
    Window.scrollTo(0, 0);
    AppClientFactory.setBrowserWindowTitle(SeoTokens.SETTINGS_TITLE);
    AppClientFactory.setMetaDataDescription(SeoTokens.HOME_META_DESCRIPTION);
    getView().clearPanels();/*from w  w w  .  j  a va 2s  . c  o m*/
    getView().getAboutUsContainer().setVisible(false);
    boolean isConfirmStatus = true;
    String newMailId = AppClientFactory.getPlaceManager().getRequestParameter("newMailId");
    String userId = AppClientFactory.getPlaceManager().getRequestParameter("userId");
    String confirmStatus = AppClientFactory.getPlaceManager().getRequestParameter("confirmStatus");
    if (confirmStatus != null && confirmStatus.equalsIgnoreCase("true")) {
        isConfirmStatus = true;
    } else {
        isConfirmStatus = false;
    }

    if (newMailId != null && userId != null && isConfirmStatus != false) {
        emailId = newMailId;
        if (!AppClientFactory.getLoggedInUser().getUserUid().equals(AppClientFactory.GOORU_ANONYMOUS)) {
            saveEmail(isConfirmStatus);
        } else {
            AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.HOME);
            AppClientFactory.fireEvent(new InvokeLoginEvent());
        }
    } else {
        displaySettingsPage();
    }
    Window.enableScrolling(true);
    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(0, true));
    if (AppClientFactory.getLoggedInUser().getConfirmStatus() == 0 && isConfirmStatus) {
        String gooruUid = AppClientFactory.getGooruUid();
        String token = AppClientFactory.getLoginSessionToken();
        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));
                        }
                    }
                });
    }
    AppClientFactory.fireEvent(new ConfirmStatusPopupEvent(false));
}