aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/uitest/UIScrolling.java
blob: e9f3d97f1f725aeec94a1cde0192bd8ace0cd963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.vaadin.tests.components.uitest;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Notification;
import com.vaadin.ui.UI;

public class UIScrolling extends AbstractReindeerTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        // Set layout to high enough to get scroll.
        getLayout().setHeight("2250px");
        addComponent(new Button("scroll to 1000px",
                event -> UI.getCurrent().setScrollTop(1000)));
        addComponent(new Button(
                "This button is halfway down. Click to report scroll position.",
                event -> Notification.show("Scrolled to "
                        + event.getButton().getUI().getScrollTop() + " px")));
    }

    @Override
    protected String getTestDescription() {
        return "Windows can be programmatically scrolled";
    }

    @Override
    protected Integer getTicketNumber() {
        return 9952;
    }

}