blob: 5e6ebe5f7e5cfccf5ea4f8e40cf67d00ff8073af (
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
|
package com.vaadin.tests.components.abstractcomponent;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
public class ChangeHierarchyBeforeResponse extends AbstractReindeerTestUI {
private CssLayout layout = new CssLayout() {
@Override
public void beforeClientResponse(boolean initial) {
super.beforeClientResponse(initial);
if (initial) {
addComponent(buttonToAdd);
removeComponent(labelToRemove);
}
}
};
private Label labelToRemove = new Label("Label to remove") {
int count = 0;
@Override
public void beforeClientResponse(boolean initial) {
super.beforeClientResponse(initial);
if (initial) {
count++;
setValue("Initial count: " + count);
}
}
};
private Button buttonToAdd = new Button("Added from beforeClientResponse",
event -> layout.addComponent(labelToRemove)) {
@Override
public void beforeClientResponse(boolean initial) {
super.beforeClientResponse(initial);
setCaption("Add label to layout");
}
};
@Override
protected void setup(VaadinRequest request) {
layout.addComponent(labelToRemove);
addComponent(layout);
}
}
|