aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/window/LongNotifications.java
blob: be67cfe9a04f1da4feac1676681f1409c8df35e1 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.vaadin.tests.components.window;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Notification;

public class LongNotifications extends TestBase {
    private final String text = "This is a veeeery large notification in the main window which should definitly not exist at all, in any app. But they finally do in real world applications, no matter what you do. People have small screens and desperatly try to run web apps in their iphones.";

    @Override
    protected String getDescription() {
        return "Notifications should not be wider than the screen.";
    }

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

    @Override
    protected void setup() {
        setTheme("tests-tickets");

        Button b = new Button("Show loooong notification",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {

                        getMainWindow().showNotification(
                                text,
                                "This is description for the same notifications."
                                        + text,
                                Notification.TYPE_HUMANIZED_MESSAGE);
                    }
                });
        getLayout().addComponent(b);

        b = new Button("Show notifications", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {

                getMainWindow().showNotification("Example failed",
                        "This is description for the same notifications.",
                        Notification.TYPE_HUMANIZED_MESSAGE);
            }
        });

        getLayout().addComponent(b);

        b = new Button("Show loooong notification  (error)",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {

                        getMainWindow()
                                .showNotification(
                                        text,
                                        "This is description for the same notifications."
                                                + text,
                                        Notification.TYPE_ERROR_MESSAGE);
                    }
                });
        getLayout().addComponent(b);

        b = new Button("Show notification (error)", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {

                getMainWindow().showNotification("Example failed",
                        "This is description for the same notifications.",
                        Notification.TYPE_ERROR_MESSAGE);
            }
        });

        getLayout().addComponent(b);

    }
}