aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/window/SubwindowDraggability.java
blob: 45fb343b456c5e09ef5329d2626cf2a95ca52203 (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.window;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Window;

public class SubwindowDraggability extends TestBase {

    @Override
    protected void setup() {
        final Window draggableSubWindow = new Window("Draggable sub window");
        draggableSubWindow.setHeight("300px");
        final Window fixedSubWindow = new Window("Fixed sub window");
        fixedSubWindow.setHeight("200px");
        fixedSubWindow.setDraggable(false);

        fixedSubWindow.center();
        getMainWindow().addWindow(draggableSubWindow);
        getMainWindow().addWindow(fixedSubWindow);

        Button b = new Button("Swap", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                boolean b = draggableSubWindow.isDraggable();

                draggableSubWindow.setDraggable(!b);
                fixedSubWindow.setDraggable(b);

            }

        });
        addComponent(b);
    }

    @Override
    protected String getDescription() {
        return "Two sub windows. One is draggable, the other one is fixed and cannot be moved by the user";
    }

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

}