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

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

public class PanelConcurrentModificationException extends TestBase {

    private final VerticalLayout panelLayout = new VerticalLayout();
    private final Panel panel = new Panel(panelLayout);

    @Override
    protected void setup() {
        panelLayout.setMargin(true);

        addComponent(new Button("Click here for exception",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        panelLayout.addComponent(new Label("Label"));
                    }
                }));
        addComponent(new Button("Or click here first",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        Notification
                                .show("It is now safe to click the other button");
                    }
                }));
        addComponent(panel);
    }

    @Override
    protected String getDescription() {
        return "Modifying Panel content causes Internal Error (ConcurrentModificationException)";
    }

    @Override
    protected Integer getTicketNumber() {
        // TODO Auto-generated method stub
        return null;
    }

}