blob: c1965ff92b52d3e71afe9167e5b84874dddcdccd (
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
|
package com.vaadin.tests.components.label;
import com.vaadin.data.util.ObjectProperty;
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.Button.ClickListener;
import com.vaadin.ui.Label;
public class LabelPropertySourceValue extends AbstractTestUI {
private Label label;
@Override
public void setup(VaadinRequest request) {
label = new Label("Hello Vaadin user");
addComponent(label);
Button button = new Button("Give label a new property data source...");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
ObjectProperty<String> p = new ObjectProperty<String>(
"This text should appear on the label after clicking the button.");
label.setPropertyDataSource(p);
}
});
addComponent(button);
button = new Button("Remove data source", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
label.setPropertyDataSource(null);
}
});
addComponent(button);
button = new Button("Set label value to 'foo'", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
label.setValue("foo");
}
});
addComponent(button);
}
@Override
protected String getTestDescription() {
return "The value should change by clicking the button";
}
@Override
protected Integer getTicketNumber() {
return 9618;
}
}
|