blob: 33c1313e209fc7c85f04f068fa07d07148fa49e9 (
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
65
66
67
68
69
70
71
|
package com.vaadin.tests.tickets;
import com.vaadin.Application;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.TextField;
public class Ticket2053 extends Application {
int childs = 0;
@Override
public void init() {
final LegacyWindow main = new LegacyWindow("#2053");
setMainWindow(main);
Button nothing = new Button("Do nothing");
main.addComponent(nothing);
nothing.setDescription("Even though no action is taked, this window is refreshed to "
+ "draw changes not originating from this window. Such changes include changes "
+ "made by other browser-windows.");
Button add = new Button("Add a window", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
final String name = "Child " + (++childs);
LegacyWindow c = new LegacyWindow(name);
addWindow(c);
main.open(new ExternalResource(c.getURL()), "_new");
main.addComponent(new Label(name + " opened"));
final TextField tf = new TextField("Non immediate textfield");
c.addComponent(tf);
tf.addListener(new Property.ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
main.addComponent(new Label(name + " send text:"
+ tf.getValue()));
}
});
for (int i = 0; i < 3; i++) {
final String caption = "Slow button " + i;
c.addComponent(new Button(caption,
new Button.ClickListener() {
@Override
public synchronized void buttonClick(
ClickEvent event) {
try {
this.wait(2000);
} catch (InterruptedException e) {
}
main.addComponent(new Label(caption
+ " pressed"));
}
}));
}
}
});
main.addComponent(add);
add.setDescription("This button opens a new browser window. Closing the browser "
+ "window should do two things: 1) submit all unsubmitted state to server "
+ "(print any changes to textfield to main window) and 2) call window.close()"
+ " on the child window (print closed on the main window)");
}
}
|