aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/popupview/PopupViewWithRTE.java
blob: 069ccef2bb4abb65551457e40dff2f8b8aef5142 (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
package com.vaadin.tests.components.popupview;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Component;
import com.vaadin.ui.PopupView;
import com.vaadin.ui.PopupView.Content;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.VerticalLayout;

public class PopupViewWithRTE extends TestBase {

    @Override
    protected String getDescription() {
        return "Rich text editor should work properly in popupview. Try to edit text below.";
    }

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

    @Override
    protected void setup() {
        PopupView pv = new PopupView(new Content() {

            RichTextArea rte = new RichTextArea();

            VerticalLayout vl = new VerticalLayout();

            @Override
            public String getMinimizedValueAsHTML() {
                String value = rte.getValue();
                if (value == null || "".equals(value)) {
                    value = "Initial <b>content</b> for <h3>rte</h3>.";
                    rte.setValue(value);
                    rte.setHeight("150px");
                    rte.setWidth("100%");
                    vl.addComponent(rte);
                    vl.setWidth("600px");
                }
                return value.toString();
            }

            @Override
            public Component getPopupComponent() {
                return vl;
            }
        });
        getLayout().addComponent(pv);
    }

}