blob: 8359b024aa7ebc7bb48e3975d45b3346e747e05f (
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.tickets;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.TextField;
public class Ticket1806 extends com.vaadin.Application.LegacyApplication {
@Override
public void init() {
final LegacyWindow main = new LegacyWindow(getClass().getName()
.substring(getClass().getName().lastIndexOf(".") + 1));
setMainWindow(main);
final ObjectProperty<String> prop = new ObjectProperty<String>("");
final TextField tf1 = new TextField(
"Buffered TextField bound to ObjectProperty");
tf1.setBuffered(true);
tf1.setPropertyDataSource(prop);
main.addComponent(tf1);
main.addComponent(new Button(
"This button does nothing (but flushes queued variable changes)"));
main.addComponent(new Button("Commit the field to property",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
tf1.commit();
}
}));
main.addComponent(new Button("Show property value",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
main.showNotification("'" + prop.getValue() + "'");
}
}));
main.addComponent(new Button("Show field value",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
main.showNotification("'" + tf1.getValue() + "'");
}
}));
}
}
|