blob: 8cf70894b1d862510f576ac6079647d078186f34 (
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
|
package com.vaadin.tests.tickets;
import com.vaadin.server.LegacyApplication;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.VerticalLayout;
public class Ticket2347 extends LegacyApplication {
private Button b1;
@Override
public void init() {
LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
setMainWindow(w);
setTheme("tests-tickets");
createUI((VerticalLayout) w.getContent());
}
private void createUI(VerticalLayout layout) {
CustomLayout cl = new CustomLayout("Ticket2347");
b1 = new Button("200px button");
b1.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
if (b1.getWidth() == 200.0) {
b1.setWidth("300px");
} else {
b1.setWidth("200px");
}
b1.setCaption(b1.getWidth() + "px button");
}
});
b1.setWidth("200px");
Button b2 = new Button("100% button");
b2.setWidth("100%");
cl.addComponent(b1, "button1");
cl.addComponent(b2, "button2");
layout.addComponent(cl);
}
}
|