]> source.dussan.org Git - vaadin-framework.git/blob
cc850f2f86c9398db991e207ea8215fd50cb1a36
[vaadin-framework.git] /
1 package com.vaadin.tests.components.gridlayout;
2
3 import com.vaadin.server.VaadinRequest;
4 import com.vaadin.tests.components.AbstractReindeerTestUI;
5 import com.vaadin.ui.Button;
6 import com.vaadin.ui.Button.ClickEvent;
7 import com.vaadin.ui.ComponentContainer;
8 import com.vaadin.ui.GridLayout;
9 import com.vaadin.ui.Label;
10 import com.vaadin.ui.VerticalLayout;
11
12 public class MoveComponentsFromGridLayoutToInnerLayout extends AbstractReindeerTestUI {
13
14     protected Button testButton;
15     private GridLayout gl;
16     protected ComponentContainer vl;
17
18     @Override
19     protected void setup(VaadinRequest request) {
20         gl = new GridLayout();
21         gl.setHideEmptyRowsAndColumns(true);
22         gl.setWidth("200px");
23         gl.setHeight("200px");
24
25         testButton = new Button("Click to move to inner layout",
26                 new Button.ClickListener() {
27
28                     @Override
29                     public void buttonClick(ClickEvent event) {
30                         vl.addComponent(testButton);
31                     }
32                 });
33
34         gl.addComponent(testButton);
35
36         vl = new VerticalLayout();
37         vl.addComponent(new Label("I'm inside the inner layout"));
38         gl.addComponent(vl);
39
40         addComponent(gl);
41
42         Button b = new Button("Repaint inner layout",
43                 new Button.ClickListener() {
44
45                     @Override
46                     public void buttonClick(ClickEvent event) {
47                         vl.markAsDirty();
48                     }
49                 });
50
51         addComponent(b);
52     }
53
54     @Override
55     protected String getTestDescription() {
56         return "Click the first button to move it from an outer layout to an inner. Then click the second button to repaint the inner layout.";
57     }
58
59     @Override
60     protected Integer getTicketNumber() {
61         return 6060;
62     }
63
64 }