aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java
blob: 577ca463bcccffb67772ee89feffe1f568257062 (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
55
56
57
58
59
60
61
62
63
package com.vaadin.tests.tickets;

import com.vaadin.Application;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.UserError;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

public class Ticket1966_3 extends Application {

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
        setMainWindow(w);
        // setTheme("tests-tickets");
        GridLayout layout = new GridLayout(10, 10);
        w.setContent(layout);
        createUI(layout);
    }

    private void createUI(GridLayout layout) {
        VerticalLayout ol = new VerticalLayout();
        Panel p = new Panel(ol);
        p.setWidth("300px");
        p.setHeight("300px");
        p.getContent().setSizeFull();

        TextField tf = new TextField("Long caption, longer than 100 pixels");
        tf.setWidth("100px");

        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_RIGHT);

        tf = new TextField("Short caption");
        tf.setWidth("100px");

        tf.setComponentError(new UserError("error message"));
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_RIGHT);

        tf = new TextField("Short caption");
        tf.setComponentError(new UserError("error message"));
        tf.setIcon(new ThemeResource("icons/16/calendar.png"));
        tf.setWidth("100px");

        tf.setComponentError(new UserError("error message"));
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_RIGHT);

        tf = new TextField();
        tf.setValue("No caption");
        tf.setWidth("100px");

        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_RIGHT);

        layout.addComponent(p);
    }
}