Example usage for com.google.gwt.user.client.ui ScrollPanel getScrollPosition

List of usage examples for com.google.gwt.user.client.ui ScrollPanel getScrollPosition

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui ScrollPanel getScrollPosition.

Prototype

@Deprecated
public int getScrollPosition() 

Source Link

Document

Gets the vertical scroll position.

Usage

From source file:com.vaadin.addon.calendar.gwt.client.ui.schedule.WeekGrid.java

private void setVerticalScroll(boolean isVerticalScrollEnabled) {
    if (isVerticalScrollEnabled && !(isVerticalScrollable())) {
        verticalScrollEnabled = true;//from w  w w.j ava2s.c o  m
        horizontalScrollEnabled = false;
        wrapper.remove(content);

        final ScrollPanel scrollPanel = new ScrollPanel();
        scrollPanel.setStylePrimaryName("v-calendar-week-wrapper");
        scrollPanel.setWidget(content);

        scrollPanel.addScrollHandler(new ScrollHandler() {
            public void onScroll(ScrollEvent event) {
                if (calendar.getScrollListener() != null) {
                    calendar.getScrollListener().scroll(scrollPanel.getScrollPosition());
                }
            }
        });

        setWidget(scrollPanel);
        wrapper = scrollPanel;

    } else if (!isVerticalScrollEnabled && (isVerticalScrollable())) {
        verticalScrollEnabled = false;
        horizontalScrollEnabled = false;
        wrapper.remove(content);

        SimplePanel simplePanel = new SimplePanel();
        simplePanel.setStylePrimaryName("v-calendar-week-wrapper");
        simplePanel.setWidget(content);

        setWidget(simplePanel);
        wrapper = simplePanel;
    }
}