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

import com.vaadin.shared.ui.ContentMode;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.v7.ui.TextField;

public class ClipContent extends TestBase {

    @Override
    protected void setup() {

        Label text = new Label(
                "1_long_line_that_should_be_clipped<br/>2_long_line_that_should_be_clipped<br/>3_long_line_that_should_be_clipped<br/>4_long_line_that_should_be_clipped<br/>",
                ContentMode.HTML);

        final CustomComponent cc = new CustomComponent(text);
        cc.setWidth("20px");
        cc.setHeight("20px");

        final TextField w = new TextField("Width");
        w.setValue("20px");
        w.addValueChangeListener(event -> cc.setWidth(w.getValue()));
        addComponent(w);
        final TextField h = new TextField("Height");
        h.setValue("20px");
        h.addValueChangeListener(event -> cc.setHeight(h.getValue()));
        addComponent(h);
        Button b = new Button("apply");
        addComponent(b);

        addComponent(cc);
    }

    @Override
    protected String getDescription() {
        return "The text in CustomComponent should be clipped if it has size defined.";
    }

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

}