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

import static java.nio.charset.StandardCharsets.UTF_8;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomLayout;
import com.vaadin.v7.ui.TextField;

public class CustomLayoutWithMissingSlot extends AbstractTestUIWithLog {

    @Override
    protected void setup(VaadinRequest request) {
        CustomLayout cl;
        try {
            cl = new CustomLayout(new ByteArrayInputStream(
                    "<div>First: <div location='first'></div><p>Second: <div location='second'></div><p>"
                            .getBytes(UTF_8)));
            cl.addComponent(new TextField("This should be visible"), "first");
            Button button = new Button(
                    "This button is visible, together with one label");
            button.addClickListener(event -> log("Button clicked"));
            cl.addComponent(button, "second");
            cl.addComponent(
                    new TextField("This won't be as the slot is missing"),
                    "third");

            addComponent(cl);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}