blob: c510e8deba9622b1350cf674a5dfbd6bc1976c1e (
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
|
package com.vaadin.tests.layouts;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
public class VerticalLayoutWithRelativeSizeComponentsInitiallyHidden
extends TestBase {
@Override
protected String getDescription() {
return "Size calculations fail if expanded component is relative sized "
+ "and initially invisible and when becoming visible at the "
+ "same time some other component size changes.";
}
@Override
protected Integer getTicketNumber() {
return 4608;
}
@Override
protected void setup() {
VerticalLayout verticalLayout = getLayout();
verticalLayout.setHeight("500px");
final Label bar = new Label("Bar");
bar.setSizeUndefined();
final Label foobar = new Label("FooBar");
foobar.setSizeFull();
foobar.setVisible(false);
bar.setHeight("100px");
// bar.setHeight("100px");
bar.setVisible(false);
Button b = new Button(
"Click to set bar visible. Button should stay visible.");
b.addClickListener(event -> {
bar.setVisible(true);
foobar.setVisible(true);
});
verticalLayout.addComponent(bar);
verticalLayout.addComponent(foobar);
verticalLayout.setExpandRatio(foobar, 1);
verticalLayout.addComponent(b);
}
}
|