blob: f1b96d24fd33021701608796246a6f7e5fc774d2 (
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
|
package com.vaadin.tests.components.abstractfield;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component.Event;
import com.vaadin.ui.Component.Listener;
import com.vaadin.ui.TextField;
public class AbstractFieldDataSourceReadOnly extends TestBase {
private static class StateHolder {
private ObjectProperty<String> textField = new ObjectProperty<String>(
"");
public ObjectProperty<String> getTextField() {
return textField;
}
@SuppressWarnings("unused")
public void setTextField(ObjectProperty<String> textField) {
this.textField = textField;
}
public void buttonClicked() {
textField.setReadOnly(true);
}
}
@Override
protected void setup() {
final StateHolder stateHolder = new StateHolder();
// Button
Button button = new Button("Make data source read-only");
button.addListener(new Listener() {
@Override
public void componentEvent(Event event) {
stateHolder.buttonClicked();
}
});
// Input field
TextField input = new TextField("Field");
input.setPropertyDataSource(stateHolder.getTextField());
addComponent(button);
addComponent(input);
}
@Override
protected String getDescription() {
return "Read-only status changes in data sources are not rendered immediately";
}
@Override
protected Integer getTicketNumber() {
return 5013;
}
}
|