blob: 671fdf11634ed32bc7f8a53a9d8c2c501ffd2d88 (
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
69
70
71
72
73
74
75
76
|
package com.vaadin.tests.layouts.layouttester.GridLayout;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ContentMode;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Label;
public class GridLayoutSizing extends GridBaseLayoutTestUI {
@Override
protected void setup(VaadinRequest request) {
getLayoutForLayoutSizing("layout");
super.setup(request);
layout.setSizeFull();
}
@Override
protected void getLayoutForLayoutSizing(final String compType) {
layout.setSpacing(false);
layout.setMargin(false);
final AbstractComponent c1 = getTestTable();
final AbstractComponent c2 = getTestTable();
class SetSizeButton extends Button {
SetSizeButton(final String size) {
super();
setCaption("Set size " + size);
addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
if (compType == "layout") {
layout.setHeight(size);
layout.setWidth(size);
} else if (compType == "component") {
c2.setHeight(size);
c2.setWidth(size);
} else {
}
}
});
}
}
Button btn1 = new SetSizeButton("600px");
Button btn2 = new SetSizeButton("-1px");
Button btn3 = new SetSizeButton("75%");
Button btn4 = new SetSizeButton("100%");
layout.addComponent(btn1);
layout.addComponent(btn2);
layout.addComponent(btn3);
layout.addComponent(btn4);
layout.addComponent(c1);
layout.addComponent(new Label(
"<div style='height: 1px'></div><hr /><div style='height: 1px'></div>",
ContentMode.HTML));
layout.addComponent(c2);
btn2.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Label newLabel = new Label("--- NEW LABEL ---");
newLabel.setSizeUndefined();
layout.addComponent(newLabel);
}
});
btn2.setCaption(btn2.getCaption() + " + add Label");
}
}
|