blob: 6a8b37db3e4bce7d795c86855b05c4dde3d9069e (
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
|
package com.vaadin.tests.components.orderedlayout;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.VerticalLayout;
public class ReplaceComponentNPE extends TestBase {
@Override
protected String getDescription() {
return "Clicking 'ReplaceComponent' should replace the 'Button' button with a VericalLayout, and move the button inside the verticalLayout. Visually this can be seen by the added margins of the VerticalLayout.";
}
@Override
protected Integer getTicketNumber() {
return 3195;
}
final Button button = new Button("Button");
final VerticalLayout outer = new VerticalLayout();
@Override
protected void setup() {
outer.setMargin(true);
Button changer = new Button("ReplaceComponent");
changer.addClickListener(event -> {
getLayout().replaceComponent(button, outer);
outer.addComponent(button);
});
getLayout().addComponent(button);
getLayout().addComponent(changer);
}
}
|