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

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

Introduction

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

Prototype

public static int getScrollTop() 

Source Link

Usage

From source file:org.ednovo.gooru.client.mvp.classpage.teach.reports.lesson.TeachLessonReportChildView.java

License:Open Source License

@Override
public void onLoad() {
    super.onLoad();
    lessonTablePanel.getElement().getParentElement().setAttribute("style",
            "min-height:" + (Window.getClientHeight() + Window.getScrollTop() - 100) + "px");
}

From source file:org.ednovo.gooru.client.mvp.classpage.teach.reports.unit.TeachUnitReportChildView.java

License:Open Source License

@Override
public void onLoad() {
    super.onLoad();
    unitTablePanel.getElement().getParentElement().setAttribute("style",
            "min-height:" + (Window.getClientHeight() + Window.getScrollTop() - 100) + "px");
}

From source file:org.ednovo.gooru.client.mvp.gsearch.SearchAbstractView.java

License:Open Source License

public void removeTopWidgets(boolean isBottomOrTop) {
    try {/*from w  w w .j a  v a  2  s. com*/
        int removeableWidgetCount = 1;
        if (isBottomOrTop) {
            int widgetCount = searchResultPanel.getWidgetCount() - removeableWidgetCount;
            int totalWidgetCount = searchResultPanel.getWidgetCount();
            int removeWidgetCount = searchResultPanel.getWidgetCount();
            if (searchResultPanel.getWidgetCount() > 10) {
                Iterator<Widget> widgets = searchResultPanel.iterator();
                while (widgets.hasNext()) {
                    if (widgetCount == totalWidgetCount) {
                        break;
                    }
                    searchResultPanel.remove(removeWidgetCount - 1);
                    widgetCount++;
                    removeWidgetCount--;
                }
            }
        } else {
            int widgetCount = 1;
            if (searchResultPanel.getWidgetCount() > 10) {
                Iterator<Widget> widgets = searchResultPanel.iterator();
                while (widgets.hasNext()) {
                    if (widgetCount > removeableWidgetCount) {
                        break;
                    }
                    final Widget widget = widgets.next();
                    searchResultPanel.remove(widget);
                    widgetCount++;
                }
                //This code is used to scroll automatically after loading the bottom results.
                if (AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken()
                        .equals(PlaceTokens.SEARCH_COLLECTION)) {
                    Window.scrollTo(0, Window.getScrollTop() - (getWidgetHeight() * 4));
                } else {
                    Window.scrollTo(0, Window.getScrollTop() - (getWidgetHeight() * 2));
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.ednovo.gooru.client.mvp.play.collection.end.study.CollectionHomeMetadataView.java

License:Open Source License

/**
 * /* w w w  .  j  a  va  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) {
    final Map<String, String> params = StringUtil.splitQuery(Window.Location.getHref());
    String collectionId = collectionDo.getGooruOid();
    //   Window.enableScrolling(false);
    //final Map<String,String> params = new HashMap<String,String>();
    AssignPopupVc successPopupVc = new AssignPopupVc(collectionId, collectionDo.getTitle(),
            collectionDo.getGoals()) {
        @Override
        public void closePoup() {
            Window.enableScrolling(true);
            this.hide();
            params.remove("assign");
            PlaceRequest placeRequest = AppClientFactory.getPlaceManager()
                    .preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params);
            AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true);
        }
    };
    //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;width:500px;overflow-x:hidden;overflow-y:scroll");
    }else{
       successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;width:500px;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));

    //successPopupVc.center();
    //successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 10);

    //            if(!successPopupVc.isVisible()){
    //               successPopupVc.show();
    //               successPopupVc.center();
    //            }
    //            Window.enableScrolling(false);
    //            if (AppClientFactory.isAnonymous()){
    //               successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 10);
    //            }
    //            else{
    //successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 10);
    //            }
    params.put("assign", "yes");
    PlaceRequest placeRequest = AppClientFactory.getPlaceManager()
            .preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params);
    AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true);

    //      final 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;
    //               }
    //               public void triggerShareEvent(String shareType,boolean confirmStatus){
    //                  getUiHandlers().triggerCollectionShareDataEvent(collectionId,PlayerDataLogEvents.COLLECTION,shareType,confirmStatus);
    //               }
    //            };
    //            Window.scrollTo(0, 0);
    //            successPopupVc.setWidth("500px");
    //            successPopupVc.setHeight("350px");
    //            successPopupVc.show();
    //            successPopupVc.center();
    //         }

}

From source file:org.ednovo.gooru.client.mvp.play.collection.share.email.SummaryPageEmailShareUc.java

License:Open Source License

@UiHandler("btnSend")
public void onSendBtnClickEvent(ClickEvent event) {
    isvalid = true;//from  w  w w  . j a va 2  s  . c  o m
    if (fromTxt.isVisible()) {
        if (fromTxt.getText().equals("")) {
            fromValidation.setVisible(true);
            isvalid = false;
        }
        if ((fromTxt.getText() != null && !fromTxt.getText().isEmpty())
                && !fromTxt.getText().contains(AT_SYMBOL)) {

            fromValidation.setText(GL1027);
            fromValidation.setVisible(true);
            isvalid = false;
        }
    }

    if (toTxt.getText().equals("")) {
        toValidation.setVisible(true);
        isvalid = false;
    }
    if ((toTxt.getText() != null && !toTxt.getText().isEmpty()) && !toTxt.getText().contains(AT_SYMBOL)) {

        toValidation.setText(GL1027);
        toValidation.setVisible(true);
        isvalid = false;
    }
    if (isvalid) {
        final Map<String, String> parms = new HashMap<String, String>();
        parms.put("text", subTxt.getValue());
        AppClientFactory.getInjector().getResourceService().checkProfanity(parms,
                new SimpleAsyncCallback<Boolean>() {
                    @Override
                    public void onSuccess(Boolean value) {
                        isHavingBadWordsInTextbox = value;
                        if (value) {
                            SetStyleForProfanity.SetStyleForProfanityForTextBox(subTxt, mandatoryErrorLbl,
                                    value);
                        } else {
                            parms.put("text", msgTxa.getText());
                            AppClientFactory.getInjector().getResourceService().checkProfanity(parms,
                                    new SimpleAsyncCallback<Boolean>() {

                                        @Override
                                        public void onSuccess(Boolean result) {
                                            isHavingBadWordsInRichText = result;
                                            if (result) {
                                                SetStyleForProfanity.SetStyleForProfanityForRichTextArea(msgTxa,
                                                        mandatoryErrorRichTextArea, result);
                                            } else {
                                                if (!isHavingBadWordsInRichText && !isHavingBadWordsInTextbox) {
                                                    String fromEmail = "";
                                                    if (fromTxt.isVisible()) {
                                                        fromEmail = fromTxt.getText();
                                                    } else {
                                                        fromEmail = fromLbl.getText();
                                                    }
                                                    AppClientFactory.getInjector().getPlayerAppService()
                                                            .sendEmailWithPdf(toTxt.getText(), fromEmail, cfm,
                                                                    subTxt.getText(), msgTxa.getHTML(), pdfUrl,
                                                                    cpAttachmentContainer.getText(),
                                                                    new SimpleAsyncCallback<String>() {
                                                                        @Override
                                                                        public void onSuccess(String result) {
                                                                            if (result.equalsIgnoreCase(
                                                                                    "success")) {
                                                                                closeEmailpanel();
                                                                                ThankYouToolTip thankYouToolTip = new ThankYouToolTip();
                                                                                thankYouToolTip.setTitleData(
                                                                                        GL0222,
                                                                                        toTxt.getText());
                                                                                thankYouToolTip
                                                                                        .setPopupPosition(
                                                                                                (Window.getClientWidth()
                                                                                                        - 400)
                                                                                                        / 2,
                                                                                                (Window.getClientHeight()
                                                                                                        - 165)
                                                                                                        / 2
                                                                                                        + Window.getScrollTop());
                                                                                thankYouToolTip.show();
                                                                            }
                                                                        }
                                                                    });
                                                }
                                            }
                                        }
                                    });
                        }
                    }
                });
    }
    /*if (isvalid  && !isHavingBadWordsInRichText && !isHavingBadWordsInTextbox) {
       String fromEmail = "";
       if(fromTxt.isVisible()) {
    fromEmail = fromTxt.getText();
       } else {
    fromEmail = fromLbl.getText();
       }
               
       AppClientFactory.getInjector().getPlayerAppService().sendEmailWithPdf(toTxt.getText(),fromEmail,cfm,subTxt.getText(), msgTxa.getHTML(), pdfUrl,cpAttachmentContainer.getText(),new SimpleAsyncCallback<String>(){
            
    @Override
    public void onSuccess(String result) {
            
       if(result.equalsIgnoreCase("success")) {
            
          closeEmailpanel();
            
          ThankYouToolTip thankYouToolTip=new ThankYouToolTip();
            
          thankYouToolTip.setTitleData("Email to Friend", toTxt.getText());
            
          thankYouToolTip.setPopupPosition((Window.getClientWidth()-400)/2,(Window.getClientHeight()-165)/2+Window.getScrollTop());
            
          thankYouToolTip.show();   
            
       }
            
    }
            
            
            
       });
               
    //         playerRpcService.sendEmailWithPdf(restEndPoint, session, toTxt.getText(), fromEmail, cfm, subTxt.getText(), msgTxa.getHTML(), pdfUrl, cpAttachmentContainer.getText(), new AsyncCallback<String>() {
    //            @Override
    //            public void onSuccess(String response) {
    //               if(response.equalsIgnoreCase("success")) {
    //                  closeEmailpanel();
    //                  ThankYouToolTip thankYouToolTip=new ThankYouToolTip();
    //                  thankYouToolTip.setTitleData("Email to Friend", toTxt.getText());
    //                  thankYouToolTip.setPopupPosition((Window.getClientWidth()-400)/2,(Window.getClientHeight()-165)/2+Window.getScrollTop());
    //                  thankYouToolTip.show();                  
    //               }
    //            }
    //            @Override
    //            public void onFailure(Throwable arg0) {
    //            }
    //         });
    }*/
}

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

@UiHandler("addTagsBtn")
public void onAddTagsBtnClicked(ClickEvent clickEvent) {
    if (AppClientFactory.isAnonymous()) {
        AppClientFactory.fireEvent(new InvokeLoginEvent());
    } else {/*from  ww  w . j a  va2s.com*/
        Window.enableScrolling(false);
        popup = new AddTagesPopupView(searchResultDo.getGooruOid()) {

            @Override
            public void closePoup(boolean isCancelclicked) {
                this.hide();
                if (!isCancelclicked) {
                    SuccessPopupViewVc success = new SuccessPopupViewVc() {

                        @Override
                        public void onClickPositiveButton(ClickEvent event) {
                            this.hide();

                            if (AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken()
                                    .equalsIgnoreCase(PlaceTokens.COLLECTION_SEARCH)
                                    || AppClientFactory.getPlaceManager().getCurrentPlaceRequest()
                                            .getNameToken().equalsIgnoreCase(PlaceTokens.RESOURCE_SEARCH)) {
                                Window.enableScrolling(false);
                            } else {
                                Window.enableScrolling(true);
                            }
                        }

                    };
                    success.setHeight("253px");
                    success.setWidth("450px");
                    success.setPopupTitle(i18n.GL1795());
                    success.setDescText(i18n.GL1796());
                    success.enableTaggingImage();
                    success.setPositiveButtonText(i18n.GL0190());
                    success.center();
                    success.show();
                } else {
                    if (AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken()
                            .equalsIgnoreCase(PlaceTokens.COLLECTION_SEARCH)
                            || AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken()
                                    .equalsIgnoreCase(PlaceTokens.RESOURCE_SEARCH)) {
                        Window.enableScrolling(false);
                    } else {
                        Window.enableScrolling(true);
                    }
                }
            }
        };
        popup.show();
        popup.setPopupPosition(popup.getAbsoluteLeft(), Window.getScrollTop() + 10);
    }
}

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

License:Open Source License

/**
 * @param clickEvent {@link ClickEvent} 
 *//* w w w .j  a  v  a  2  s.  c  o  m*/
@UiHandler("addTagsBtn")
public void onAddTagsBtnClicked(ClickEvent clickEvent) {

    if (AppClientFactory.isAnonymous()) {
        AppClientFactory.fireEvent(new InvokeLoginEvent());
    } else {
        Window.enableScrolling(false);
        addTagesPopupView = new AddTagesPopupView(resourceGooruOid) {

            /** 
             * (non-Javadoc)
             * @see org.ednovo.gooru.client.mvp.addTagesPopup.AddTagesPopupView#closePoup(boolean)
             */
            @Override
            public void closePoup(boolean isCancelclicked) {
                this.hide();
                if (!isCancelclicked) {
                    SuccessPopupViewVc success = new SuccessPopupViewVc() {

                        /** (non-Javadoc)
                         * @see org.ednovo.gooru.client.mvp.shelf.collection.tab.collaborators.vc.SuccessPopupViewVc#onClickPositiveButton(com.google.gwt.event.dom.client.ClickEvent)
                         */
                        @Override
                        public void onClickPositiveButton(ClickEvent event) {
                            this.hide();
                            isTagsAdded = true;
                            setCurrentTagsDispalyCount(0);
                            getUiHandlers().getResourceTags(resourceGooruOid, offSet, limit, true);
                            if (AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken()
                                    .equalsIgnoreCase(PlaceTokens.COLLECTION_SEARCH)
                                    || AppClientFactory.getPlaceManager().getCurrentPlaceRequest()
                                            .getNameToken().equalsIgnoreCase(PlaceTokens.RESOURCE_SEARCH)) {
                                Window.enableScrolling(false);
                            } else {
                                Window.enableScrolling(true);
                            }
                        }

                    };
                    success.setHeight("253px");
                    success.setWidth("450px");
                    success.setPopupTitle(i18n.GL1795());
                    success.setDescText(i18n.GL1796());
                    success.enableTaggingImage();
                    success.setPositiveButtonText(i18n.GL0190());
                    success.center();
                    success.show();
                } else {
                    if (AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken()
                            .equalsIgnoreCase(PlaceTokens.COLLECTION_SEARCH)
                            || AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken()
                                    .equalsIgnoreCase(PlaceTokens.RESOURCE_SEARCH)) {
                        Window.enableScrolling(false);
                    } else {
                        Window.enableScrolling(true);
                    }
                }
            }
        };
        addTagesPopupView.show();
        addTagesPopupView.setPopupPosition(addTagesPopupView.getAbsoluteLeft(), Window.getScrollTop() + 10);
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.CollectionShareAlertPopup.java

License:Open Source License

public void showPopup() {
    this.setGlassEnabled(true);
    Window.enableScrolling(false);
    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(99, false));
    if (isPrivateResource) {
        int top = Window.getClientHeight();
        int left = Window.getClientWidth();
        left = (left - 450) / 2;//from  w  ww .j a v  a2  s.  co m
        top = ((top - 400) / 2) + Window.getScrollTop();
        this.setPopupPosition(left, top);
    } else {
        this.center();
    }
    this.show();

}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.info.CollectionInfoTabView.java

License:Open Source License

/**
 * Adding new course for the collection , will check it has more than five
 * courses and the selected course is repeated or not
 * //  ww w. j av a  2s  .  co m
 * @param clickEvent
 *            specifies event type
 */
@UiHandler("addCourseBtn")
public void onAddCourseClick(ClickEvent clickEvent) {
    if (courseListUc != null) {
        courseListUc.center();
        courseListUc.show();
        courseListUc.setDefaultCourseData();
    } else {
        courseListUc = new CourseListUc(collectionDo);
        courseListUc.setPopupPosition(clickEvent.getRelativeElement().getAbsoluteLeft() - (450),
                Window.getScrollTop() + 50);
    }

    Window.enableScrolling(false);
}

From source file:org.ednovo.gooru.client.mvp.shelf.ShelfView.java

License:Open Source License

@UiHandler("moveCollectionLbl")
public void onMoveCollectionClick(ClickEvent clickEvent) {
    folderPopupUc = new FolderPopupUc(COLLECTION_MOVE, true) {
        @Override/*from w  w  w  .ja  v a 2  s  . c  om*/
        public void onClickPositiveButton(ClickEvent event, String folderName, String parentId,
                HashMap<String, String> params) {
            MixpanelUtil.mixpanelEvent(COLLECTION_MOVE_MP_EVENT);
            getUiHandlers().moveCollection(collectionDo.getGooruOid(), parentId, folderName, params);
        }
    };
    folderPopupUc.setGlassEnabled(true);
    folderPopupUc.removeStyleName("gwt-PopupPanelGlass");
    folderPopupUc.setPopupPosition(clickEvent.getRelativeElement().getAbsoluteLeft() - (604),
            Window.getScrollTop() + 60);
    Window.enableScrolling(false);
    /*folderPopupUc.center();*/
    folderPopupUc.show();
}