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

import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.VerticalLayout;

public class HierarchyChangeForRemovedComponentContainers extends TestBase {

    private HorizontalLayout mainContent;
    private VerticalLayout lo2;

    @Override
    protected void setup() {

        mainContent = new HorizontalLayout();
        mainContent.setSizeFull();

        lo2 = new VerticalLayout();
        Button button1 = new Button("asdasd1");
        button1.setHeight("90%");
        Button button2 = new Button("asdasd2");
        button2.setHeight("90%");
        lo2.addComponent(button1);
        lo2.addComponent(button2);

        compose();

        addComponent(
                new Button("Replace layout with button", event -> compose2()));
    }

    private void compose() {
        getLayout().removeAllComponents();
        getLayout().addComponent(mainContent);
        mainContent.addComponent(lo2);
        System.out.println("composed");
    }

    private void compose2() {
        getLayout().removeAllComponents();
        getLayout().addComponent(lo2);
    }

    @Override
    protected String getDescription() {
        return "HierarchyChange events should be triggered for removed layouts";
    }

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

}