blob: 9557137c8ad545ae9ff7454e4e4a7f419944f6be (
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
62
63
64
65
66
67
68
|
package com.vaadin.tests.components.orderedlayout;
import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class VerticalLayoutWidthCalculation extends AbstractTestCase {
@Override
public void init() {
final LegacyWindow mainWindow = new LegacyWindow(
"Vaadintest Application");
mainWindow.addWindow(createSubWindow());
setMainWindow(mainWindow);
}
private Window createSubWindow() {
HorizontalLayout hl = new HorizontalLayout();
VerticalLayout vlTF1 = new VerticalLayout();
vlTF1.setSizeUndefined();
final TextField tf1 = new TextField("Text1");
tf1.setSizeUndefined();
vlTF1.addComponent(tf1);
hl.addComponent(vlTF1);
VerticalLayout vlTF2 = new VerticalLayout();
vlTF2.setSizeUndefined();
final TextField tf2 = new TextField("Text2");
tf2.setVisible(false);
tf2.setSizeUndefined();
vlTF2.addComponent(tf2);
hl.addComponent(vlTF2);
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSizeUndefined();
Window wnd = new Window("Test", layout);
layout.addComponent(hl);
Button btn = new Button("Show/hide");
btn.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
tf2.setVisible(!tf2.isVisible());
}
});
layout.addComponent(btn);
return wnd;
}
@Override
protected String getDescription() {
return "The second TextField is initially invisible. Make it visible and then hide it again. You should end up with the same result as initially.";
}
@Override
protected Integer getTicketNumber() {
return 7260;
}
}
|