aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java
blob: fe2fe16d938ce9cbff3a20090ac4d44c4a46dfd5 (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
package com.vaadin.tests.components.ui;

import com.vaadin.Application;
import com.vaadin.server.AbstractUIProvider;
import com.vaadin.server.WrappedRequest;
import com.vaadin.tests.components.AbstractTestApplication;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;

public class UIsInMultipleTabs extends AbstractTestApplication {
    private int numberOfUIsOpened;

    public static class TabUI extends UI {
        @Override
        protected void init(WrappedRequest request) {
            UIsInMultipleTabs application = (UIsInMultipleTabs) getApplication();
            String message = "This is UI number "
                    + ++application.numberOfUIsOpened;

            addComponent(new Label(message));
        }
    }

    public UIsInMultipleTabs() {
        addUIProvider(new AbstractUIProvider() {
            @Override
            public Class<? extends UI> getUIClass(Application application,
                    WrappedRequest request) {
                return TabUI.class;
            }
        });
    }

    @Override
    protected String getTestDescription() {
        return "Opening the same application again (e.g. in a new tab) should create a new UI.";
    }

    @Override
    protected Integer getTicketNumber() {
        return Integer.valueOf(7894);
    }
}