summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/overlays/OverlayTouchScrolling.java
blob: fdcfdf726653e39540bbb3bcd61126ba5f86b026 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
@VaadinApache2LicenseForJavaFiles@
 */

package com.vaadin.tests.overlays;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;

public class OverlayTouchScrolling extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {

        final CssLayout green = new CssLayout();
        green.setSizeFull();
        final CssLayout layout = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                return "background:green;";
            }
        };
        layout.setSizeFull();
        layout.addComponent(green);
        setContent(layout);

        Button button = new Button("Tap me with a touch device");
        button.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {

                Notification
                        .show("Now close this and you can scroll in mad places.");
                green.addComponent(new Label(
                        "Thank you for clicking, now scroll (with touch device) to area without green background, which shouldn't be possible."));
            }
        });
        green.addComponent(button);
    }

    @Override
    protected String getTestDescription() {
        return "Using overlays breaks top level scrolling on touch devices";
    }

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