summaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/tests/tickets/Ticket2032.java
blob: be0098a8848845011909be80948f7ff42e3b5444 (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
package com.itmill.toolkit.tests.tickets;

import com.itmill.toolkit.Application;
import com.itmill.toolkit.terminal.UserError;
import com.itmill.toolkit.ui.ExpandLayout;
import com.itmill.toolkit.ui.GridLayout;
import com.itmill.toolkit.ui.Panel;
import com.itmill.toolkit.ui.TextField;
import com.itmill.toolkit.ui.Window;

public class Ticket2032 extends Application {

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

    private void createUI(GridLayout layout) {
        ExpandLayout el = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
        Panel p = new Panel(el);
        p.setWidth(600);
        p.setHeight(500);
        p.getLayout().setSizeFull();

        TextField tf = new TextField("Field caption");
        tf.setValue("Expanded");
        el.addComponent(tf);
        el.expand(tf);
        tf.setSizeFull();

        tf = new TextField("Vertical bottom");
        // tf.setComponentError(new UserError("Error"));
        tf.setValue("Vertical bottom");
        el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
                ExpandLayout.ALIGNMENT_BOTTOM);
        el.addComponent(tf);

        tf = new TextField("Vertical top");
        tf.setComponentError(new UserError("Error"));
        el.addComponent(tf);
        tf.setValue("Vertical top");
        el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
                ExpandLayout.ALIGNMENT_TOP);
        tf = new TextField("Vertical center");
        el.addComponent(tf);
        tf.setValue("Vertical center");
        // tf.setComponentError(new UserError("Error"));
        el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
                ExpandLayout.ALIGNMENT_VERTICAL_CENTER);

        layout.addComponent(p);
    }
}