blob: 3524ad8c541ab6f9c1be960f4e4bc855453783cc (
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.tickets;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI.LegacyWindow;
public class Ticket1775 extends com.vaadin.LegacyApplication {
@Override
public void init() {
final LegacyWindow main = new LegacyWindow("#1775");
setMainWindow(main);
setTheme("tests-tickets");
String layoutName = "Ticket1775";
final CustomLayout layout = new CustomLayout(layoutName);
main.addComponent(layout);
Button button2 = new Button("Populate content");
main.addComponent(button2);
final Button button = new Button("Change content");
main.addComponent(button);
button2.addListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Label mainComponent = new Label("Main");
Label header = new Label("Header");
final Label anotherComponent = new Label("another");
layout.addComponent(mainComponent, "body");
layout.addComponent(header, "loginUser");
button.addListener(new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
layout.addComponent(anotherComponent, "body");
layout.removeComponent("loginUser");
}
});
}
});
}
}
|