aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java
blob: 1da2322dc95d19bf0cb73bc801458d24596851d8 (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
64
package com.vaadin.tests.components.gridlayout;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;

public class MoveComponentsFromGridLayoutToInnerLayout extends AbstractTestUI {

    protected Button testButton;
    private GridLayout gl;
    protected ComponentContainer vl;

    @Override
    protected void setup(VaadinRequest request) {
        gl = new GridLayout();
        gl.setHideEmptyRowsAndColumns(true);
        gl.setWidth("200px");
        gl.setHeight("200px");

        testButton = new Button("Click to move to inner layout",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        vl.addComponent(testButton);
                    }
                });

        gl.addComponent(testButton);

        vl = new VerticalLayout();
        vl.addComponent(new Label("I'm inside the inner layout"));
        gl.addComponent(vl);

        addComponent(gl);

        Button b = new Button("Repaint inner layout",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        vl.markAsDirty();
                    }
                });

        addComponent(b);
    }

    @Override
    protected String getTestDescription() {
        return "Click the first button to move it from an outer layout to an inner. Then click the second button to repaint the inner layout.";
    }

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

}