blob: 360ad60acd78d64b21bcb3decc610a5b76ca65c9 (
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
|
package com.vaadin.tests.components.window;
import java.util.ArrayDeque;
import java.util.NoSuchElementException;
import java.util.Queue;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;
public class WindowZIndex extends AbstractReindeerTestUI {
@Override
protected String getTestDescription() {
return "Windows should stack correctly when adding new windows, closing opened ones and switching focus.";
}
@Override
protected Integer getTicketNumber() {
return 13174;
}
int windowCount = 0;
Queue<Window> windows = new ArrayDeque<>();
@Override
protected void setup(VaadinRequest request) {
addComponent(new Button("Add window", event -> {
Window window = new Window();
window.setPositionX(100 + 20 * windowCount);
window.setPositionY(100 + 20 * windowCount);
window.setHeight(200, Unit.PIXELS);
window.setWidth(200, Unit.PIXELS);
window.setContent(new Label("Window " + ++windowCount));
addWindow(window);
windows.add(window);
}));
addComponent(new Button("Close window", event -> {
try {
windows.remove().close();
} catch (NoSuchElementException e) {
}
}));
}
}
|