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.apache.cxf.management.web.browser.client.ui.ErrorDialog.java

License:Apache License

private void initializeLayout(@Nonnull final String errorName, @Nullable final String errorMessage) {

    // Create error name and error message labels
    Label errorNameLabel = new Label(errorName);
    errorNameLabel.setStyleName(resources.css().errorDialogErrorType());

    Label errorMessageLabel = null;
    if (errorMessage != null && !"".equals(errorMessage)) {
        errorMessageLabel = new Label(errorMessage);
        DOM.setStyleAttribute(errorMessageLabel.getElement(), "whiteSpace", "pre");
    }//ww w. j  a va2s  .  c  o  m

    // Initialize 'close' button
    closeButton.setText(contants.errorDialogContineButton());
    closeButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            hide();
        }
    });
    closeButton.addKeyPressHandler(new KeyPressHandler() {

        public void onKeyPress(KeyPressEvent event) {

            /*
            if the close button is triggered by a key we need to consume the key
            event, otherwise the key event would be propagated to the parent
            screen and eventually trigger some unwanted action there after the
            error dialog was closed
             */
            event.stopPropagation();
        }
    });

    // Create 'title' label
    Label titleLabel = new Label();
    titleLabel.setStyleName(resources.css().errorDialogTitle());
    titleLabel.setText(contants.errorDialogTitle());

    // Create wrapper panel for 'error name' and 'error message' labels
    FlowPanel contentPanel = new FlowPanel();
    contentPanel.add(errorNameLabel);
    contentPanel.add(errorMessageLabel);

    // Create wrapper panel for 'close' button
    FlowPanel buttonsPanel = new FlowPanel();
    buttonsPanel.setStyleName(resources.css().errorDialogButtons());
    buttonsPanel.add(closeButton);

    // Create main panel and add all remain widgets
    FlowPanel centerPanel = new FlowPanel();
    centerPanel.add(titleLabel);
    centerPanel.add(contentPanel);
    centerPanel.add(buttonsPanel);

    // Add styles to window
    setGlassEnabled(true);
    getGlassElement().addClassName(resources.css().errorDialogGlass());
    addStyleName(resources.css().errorDialog());

    // Add main panel
    add(centerPanel);

    // Set window position
    int left = Window.getScrollLeft() + 20;
    int top = Window.getScrollTop() + 20;
    setPopupPosition(left, top);
}

From source file:org.cee.webreader.client.ui.Start.java

License:Apache License

@Override
public void removeScrollHandler() {
    if (scrollRegistration != null) {
        scrollRegistration.removeHandler();
        scrollRegistration = null;/* w  w  w . ja  v a  2  s.com*/
    }
    scrollPosition = Window.getScrollTop();
}

From source file:org.cee.webreader.client.ui.WindowVerticalScroll.java

License:Apache License

@Override
public int getVerticalScrollPosition() {
    return Window.getScrollTop();
}

From source file:org.cruxframework.crux.smartfaces.client.dialog.PopupPanel.java

License:Apache License

/**
 * Gets the popup's top position relative to the browser's center area.
 * /*from   w w w  .jav  a 2 s.c o  m*/
 * @return the popup's top position
 */
private int getPopupTopToCenter() {
    int windowTop = Window.getScrollTop();
    int windowHeight = Window.getClientHeight();
    int centerTop = (windowHeight / 2) + windowTop;

    int offsetHeight = getOffsetHeight();
    return centerTop - (offsetHeight / 2);
}

From source file:org.cruxframework.crux.smartfaces.client.dialog.PopupPanel.java

License:Apache License

private int getTopRelativeObject(final UIObject relativeObject) {
    int offsetHeight = getOffsetHeight();
    int top = relativeObject.getAbsoluteTop();

    int windowTop = Window.getScrollTop();
    int windowBottom = Window.getScrollTop() + Window.getClientHeight();

    int distanceFromWindowTop = top - windowTop;
    int distanceToWindowBottom = windowBottom - (top + relativeObject.getOffsetHeight());

    if (distanceToWindowBottom < offsetHeight && distanceFromWindowTop >= offsetHeight) {
        top -= offsetHeight;//  w  w  w  .  j  av a2 s .c  o m
    } else {
        top += relativeObject.getOffsetHeight();
    }
    return top;
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.info.AssessmentsResourceInfoView.java

License:Open Source License

public void addResourceTags() {
    if (AppClientFactory.isAnonymous()) {
        AppClientFactory.fireEvent(new InvokeLoginEvent());
    } else {//from w  w w  .ja v a  2s.com
        popup = new AddTagesPopupView(collectionItemDoGlobal.getResource().getGooruOid()) {
            public void getAddedResourceTags() {
                getUiHandlers().getAddedResourceTags(collectionItemDoGlobal.getResource().getGooruOid());
            }

            @Override
            public void closePoup(boolean isCancelclicked) {
                this.hide();
                if (!isCancelclicked) {
                    SuccessPopupViewVc success = new SuccessPopupViewVc() {
                        @Override
                        public void onClickPositiveButton(ClickEvent event) {
                            this.hide();
                        }
                    };
                    success.setGlassStyleName(PlayerBundle.INSTANCE.getPlayerStyle().resourceTagsGlassPanel());
                    /*   success.setHeight("253px");
                       success.setWidth("450px");*/
                    success.setPopupTitle(i18n.GL1795());
                    success.setDescText(i18n.GL1796());
                    success.enableTaggingImage();
                    success.setPositiveButtonText(i18n.GL0190());
                    success.center();
                    success.show();
                    success.getElement().getStyle().setZIndex(99999);
                }
            }
        };
        popup.show();
        popup.setPopupPosition(popup.getAbsoluteLeft(), Window.getScrollTop() + 10);
    }
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.resource.body.AssessmentsResourcePlayerMetadataView.java

License:Open Source License

/**
 * Invokes Thankyou tool tip after user rated a resource and sets the metadata.
 * @param assocGooruOid {@link String}//from   ww w.ja  v a2 s  .  com
 * @param score {@link Integer}
 * @param review {@link String}
 * @param average {@link Integer}
 * @param count {@link Integer}
 */
@Override
public void setRatingMetaData(String assocGooruOid, Integer score, String review, double average,
        Integer count) {
    this.assocGooruOId = assocGooruOid;
    this.score = score;
    this.count = count;
    this.average = average;
    String userName = "";
    if (collectionItemDo.getResource() != null && collectionItemDo.getResource().getUser() != null
            && collectionItemDo.getResource().getUser().getUsername() != null) {
        userName = collectionItemDo.getResource().getUser().getUsername();
    }
    if (score > 1) {
        thankYouResourceStarRatings = new ThankYouResourceStarRatings(assocGooruOid, score, review, average,
                count, userName);
        thankYouResourceStarRatings.getElement().getStyle().setZIndex(999999);
        thankYouResourceStarRatings.getElement().getStyle().setPadding(0, Unit.PX);
        if (AppClientFactory.getCurrentPlaceToken().equalsIgnoreCase(PlaceTokens.RESOURCE_PLAY)) {
            thankYouResourceStarRatings.setPopupPosition(three_star.getElement().getAbsoluteLeft() + (-73),
                    three_star.getElement().getAbsoluteTop() + 40);
        } else {
            thankYouResourceStarRatings.setPopupPosition(800, Window.getScrollTop() + 153);
        }

        thankYouResourceStarRatings.show();
        thankYouResourceStarRatings.setAutoHideEnabled(true);
        thankYouResourceStarRatings.getElement().getPreviousSiblingElement().getStyle().setZIndex(999999);
        thankYouResourceStarRatings.getElement().getPreviousSiblingElement().getStyle().setOpacity(0);
    } else {
        thankYouResourceStarRatingsPoor = new ThankYouResourceStarRatingsPoor(assocGooruOid, score, review,
                average, count, userName);
        thankYouResourceStarRatingsPoor.getElement().getStyle().setZIndex(999999);
        thankYouResourceStarRatingsPoor.getElement().getStyle().setPadding(0, Unit.PX);
        if (AppClientFactory.getCurrentPlaceToken().equalsIgnoreCase(PlaceTokens.RESOURCE_PLAY)) {
            thankYouResourceStarRatingsPoor.setPopupPosition(three_star.getElement().getAbsoluteLeft() + (-73),
                    three_star.getElement().getAbsoluteTop() + 40);
        } else {
            thankYouResourceStarRatingsPoor.setPopupPosition(800, Window.getScrollTop() + 153);
        }
        thankYouResourceStarRatingsPoor.show();
        thankYouResourceStarRatingsPoor.setAutoHideEnabled(true);
        thankYouResourceStarRatingsPoor.getElement().getPreviousSiblingElement().getStyle().setZIndex(999999);
        thankYouResourceStarRatingsPoor.getElement().getPreviousSiblingElement().getStyle().setOpacity(0);
    }
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.resource.body.AssessmentsResourcePlayerMetadataView.java

License:Open Source License

@Override
public void displaySuccessPopup() {
    if (ratingsConfirmationPopup != null && ratingsConfirmationPopup.isVisible()) {
        ratingsConfirmationPopup.hide();
    }//from   w w  w. j a va  2 s. c om
    isFromThanksPopup = false;
    ratingsConfirmationPopup = new RatingsConfirmationPopup(assocGooruOId, score, count, average,
            collectionItemDo.getResource().getUser().getUsername());
    ratingsConfirmationPopup.show();
    ratingsConfirmationPopup.setAutoHideEnabled(true);
    ratingsConfirmationPopup.getElement().getStyle().setZIndex(99999);
    ratingsConfirmationPopup.getElement().getPreviousSiblingElement().getStyle().setZIndex(999999);
    ratingsConfirmationPopup.getElement().getPreviousSiblingElement().getStyle().setOpacity(0);
    if (AppClientFactory.getCurrentPlaceToken().equalsIgnoreCase(PlaceTokens.RESOURCE_PLAY)) {
        ratingsConfirmationPopup.setPopupPosition(three_star.getElement().getAbsoluteLeft() + (-73),
                three_star.getElement().getAbsoluteTop() + 40);
    } else {
        ratingsConfirmationPopup.setPopupPosition(800, Window.getScrollTop() + 153);
    }

}

From source file:org.ednovo.gooru.client.mvp.assessments.play.resource.body.AssessmentsResourcePlayerMetadataView.java

License:Open Source License

public void addResourceTags() {
    if (AppClientFactory.isAnonymous()) {
        AppClientFactory.fireEvent(new InvokeLoginEvent());
    } else {//  w  w  w  .  j a  va 2s .  c  o m
        AddTagesPopupView addTagesPopupView = new AddTagesPopupView(
                collectionItemDo.getResource().getGooruOid()) {
            public void getAddedResourceTags() {
                getUiHandlers().getResourceTagsToDisplay(collectionItemDo.getResource().getGooruOid());
            }

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

                        @Override
                        public void onClickPositiveButton(ClickEvent event) {
                            this.hide();
                        }
                    };
                    success.setGlassStyleName(PlayerBundle.INSTANCE.getPlayerStyle().resourceTagsGlassPanel());
                    /*success.setHeight("253px");
                    success.setWidth("450px");*/
                    success.setPopupTitle(i18n.GL1795());
                    success.setDescText(i18n.GL1796());
                    success.enableTaggingImage();
                    success.setPositiveButtonText(i18n.GL0190());
                    success.center();
                    success.show();
                    success.getElement().getStyle().setZIndex(99999);
                }
            }
        };
        addTagesPopupView.show();
        addTagesPopupView.setPopupPosition(addTagesPopupView.getAbsoluteLeft(), Window.getScrollTop() + 10);
    }
}

From source file:org.ednovo.gooru.client.mvp.classpage.teach.reports.course.TeachCourseReportChildView.java

License:Open Source License

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