aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/layouts/VerticalLayoutRemoveComponent.java
blob: 24431a5aa30b0dde75078a127398f40862a04748 (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
package com.vaadin.tests.layouts;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
public class VerticalLayoutRemoveComponent extends TestBase {

    @Override
    protected void setup() {
        final VerticalLayout layout = new VerticalLayout();
        layout.setId("targetLayout");
        // spacing makes it harder to track only the relevant events
        layout.setSpacing(false);
        final TextField tf = new TextField("Caption1");
        Button b = new Button("Remove field ",
                event -> layout.removeComponent(tf));
        layout.addComponent(tf);
        layout.addComponent(b);
        layout.addComponent(new TextField("Caption2"));
        layout.addComponent(new TextField("Caption3"));

        addComponent(layout);
    }

    @Override
    protected String getDescription() {
        return "Clicking on the button should remove one text field but other textfields and their captions should stay intact.";
    }

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

}