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
|
package com.vaadin.tests.tickets;
import com.vaadin.Application;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.UI.LegacyWindow;
public class Ticket2023 extends com.vaadin.Application
implements Button.ClickListener {
AbstractComponent c = new Button();
@Override
public void init() {
LegacyWindow main = new LegacyWindow();
setMainWindow(main);
String[] sizes = { "20", "100", "1", "0", "-1", "", "z" };
String[] units = { "%", "px", "em", "ex", "in", "cm", "mm", "pt", "pc",
"", "p", "zyx" };
GridLayout gl = new GridLayout(units.length, sizes.length);
main.addComponent(gl);
for (int i = 0; i < sizes.length; i++) {
for (int j = 0; j < units.length; j++) {
String s = sizes[i] + units[j];
gl.addComponent(new Button(s, this));
}
}
gl.addComponent(new Button("null", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
c.setWidth(null);
c.setHeight(null);
}
}));
main.addComponent(c);
}
@Override
public void buttonClick(ClickEvent event) {
c.setWidth(event.getButton().getCaption());
c.setHeight(event.getButton().getCaption());
}
}
|