]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove Window.addComponent() (#2924) 67/267/1
authorHenri Sara <hesara@vaadin.com>
Wed, 14 Nov 2012 13:13:21 +0000 (15:13 +0200)
committerHenri Sara <hesara@vaadin.com>
Wed, 14 Nov 2012 13:13:21 +0000 (15:13 +0200)
Change-Id: Ida3269e3cce906fd4b55c5e1049b24e0ff383289

48 files changed:
server/src/com/vaadin/server/ComponentSizeValidator.java
server/src/com/vaadin/ui/Window.java
server/tests/src/com/vaadin/data/util/sqlcontainer/TicketTests.java
uitest/src/com/vaadin/tests/ModalWindow.java
uitest/src/com/vaadin/tests/NativeWindowing.java
uitest/src/com/vaadin/tests/TestCaptionWrapper.java
uitest/src/com/vaadin/tests/TestForNativeWindowing.java
uitest/src/com/vaadin/tests/TestForWindowing.java
uitest/src/com/vaadin/tests/components/TouchScrollables.java
uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxInPopup.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java
uitest/src/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java
uitest/src/com/vaadin/tests/components/embedded/EmbeddedApplet.java
uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWidthCalculation.java
uitest/src/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java
uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java
uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java
uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java
uitest/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java
uitest/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java
uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java
uitest/src/com/vaadin/tests/components/window/LazyWindowResize.java
uitest/src/com/vaadin/tests/components/window/SubWindowFocus.java
uitest/src/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java
uitest/src/com/vaadin/tests/components/window/SubWindowOrder.java
uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java
uitest/src/com/vaadin/tests/components/window/SubWindows.java
uitest/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java
uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java
uitest/src/com/vaadin/tests/components/window/WindowClickEvents.java
uitest/src/com/vaadin/tests/components/window/WindowResizeListener.java
uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java
uitest/src/com/vaadin/tests/dd/DDTest6.java
uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java
uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java
uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java
uitest/src/com/vaadin/tests/tickets/Ticket1804.java
uitest/src/com/vaadin/tests/tickets/Ticket1811.java
uitest/src/com/vaadin/tests/tickets/Ticket1819.java
uitest/src/com/vaadin/tests/tickets/Ticket2009.java
uitest/src/com/vaadin/tests/tickets/Ticket2021.java
uitest/src/com/vaadin/tests/tickets/Ticket2099.java
uitest/src/com/vaadin/tests/tickets/Ticket2204.java
uitest/src/com/vaadin/tests/tickets/Ticket2323.java

index 08fa150a9d2a20d076a9bc842f54920415301fbc..7e72f10f51668d5e243579f796c92edcd4d38cee 100644 (file)
@@ -60,21 +60,23 @@ public class ComponentSizeValidator implements Serializable {
             Component component, List<InvalidLayout> errors,
             InvalidLayout parent) {
 
-        boolean invalidHeight = !checkHeights(component);
-        boolean invalidWidth = !checkWidths(component);
-
-        if (invalidHeight || invalidWidth) {
-            InvalidLayout error = new InvalidLayout(component, invalidHeight,
-                    invalidWidth);
-            if (parent != null) {
-                parent.addError(error);
-            } else {
-                if (errors == null) {
-                    errors = new LinkedList<InvalidLayout>();
+        if (component != null) {
+            boolean invalidHeight = !checkHeights(component);
+            boolean invalidWidth = !checkWidths(component);
+
+            if (invalidHeight || invalidWidth) {
+                InvalidLayout error = new InvalidLayout(component,
+                        invalidHeight, invalidWidth);
+                if (parent != null) {
+                    parent.addError(error);
+                } else {
+                    if (errors == null) {
+                        errors = new LinkedList<InvalidLayout>();
+                    }
+                    errors.add(error);
                 }
-                errors.add(error);
+                parent = error;
             }
-            parent = error;
         }
 
         if (component instanceof Panel) {
index 7e9fecbdc59a6dd40117b45e9d7fc9cb07132701..3f6091aa9006f58b7d90734541b734171f3724bb 100644 (file)
@@ -105,40 +105,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
         setSizeUndefined();
     }
 
-    /**
-     * Add a component to the content ({@link ComponentContainer}) of a window.
-     * 
-     * This version creates an empty {@link VerticalLayout} if no container is
-     * defined, but this automatic creation will be removed in future versions.
-     * 
-     * @param c
-     *            component to add
-     * 
-     * @deprecated use Window.setContent(Component) instead
-     */
-    @Deprecated
-    public void addComponent(Component c) {
-        if (c instanceof Window) {
-            throw new IllegalArgumentException(
-                    "Window cannot be added to another via addComponent. "
-                            + "Use addWindow(Window) instead.");
-        }
-
-        if (getContent() == null) {
-            // TODO this automatic creation should be removed in the future
-            VerticalLayout content = new VerticalLayout();
-            content.setMargin(true);
-            setContent(content);
-        }
-
-        if (getContent() instanceof ComponentContainer) {
-            ((ComponentContainer) getContent()).addComponent(c);
-        } else {
-            throw new IllegalArgumentException(
-                    "Cannot add component to a window whose content is not a ComponentContainer");
-        }
-    }
-
     /* ********************************************************************* */
 
     /*
index deebe9a08e6774d8df09246cff8e935ad8946356..6e95aff0277ee1d4565f803dbd64804cb1918fb1 100644 (file)
@@ -44,7 +44,7 @@ public class TicketTests {
                 "SELECT * FROM people", Arrays.asList("ID"), connectionPool));
         Table table = new Table();
         Window w = new Window();
-        w.addComponent(table);
+        w.setContent(table);
         table.setContainerDataSource(container);
     }
 
index 47db1141c0950ee860a155a21cc78568920ed23e..479379794119ca6c114d62c2db32e67f369cc39c 100644 (file)
@@ -22,6 +22,7 @@ import com.vaadin.ui.Button.ClickListener;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 /**
@@ -77,22 +78,24 @@ public class ModalWindow extends com.vaadin.server.LegacyApplication implements
 
     private void openSubWindow() {
         // Modal window
-        test = new Window("Modal window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        test = new Window("Modal window", layout);
         test.setModal(true);
         getMainWindow().addWindow(test);
-        test.addComponent(new Label(
+        layout.addComponent(new Label(
                 "You have to close this window before accessing others."));
 
         // Textfield for modal window
         final TextField f = new TextField();
         f.setTabIndex(4);
-        test.addComponent(f);
+        layout.addComponent(f);
         f.focus();
 
         // Modal window button
         final Button b = new Button("Test Button in modal window");
         b.setTabIndex(5);
         b.addListener(this);
-        test.addComponent(b);
+        layout.addComponent(b);
     }
 }
index ddd72d7beca8494a5f5f4e990bf3b0ad30e34aa7..91ed4a4cac7f1322abab0660c6e006621e581da1 100644 (file)
@@ -25,6 +25,7 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class NativeWindowing extends LegacyApplication {
@@ -40,8 +41,10 @@ public class NativeWindowing extends LegacyApplication {
                 new Button.ClickListener() {
                     @Override
                     public void buttonClick(ClickEvent event) {
+                        VerticalLayout layout = new VerticalLayout();
+                        layout.setMargin(true);
                         final Window w = new Window("sw "
-                                + System.currentTimeMillis());
+                                + System.currentTimeMillis(), layout);
                         main.addWindow(w);
                         w.setPositionX(100);
                         w.setPositionY(100);
@@ -59,9 +62,9 @@ public class NativeWindowing extends LegacyApplication {
                             }
 
                         });
-                        w.addComponent(closebutton);
+                        layout.addComponent(closebutton);
 
-                        w.addComponent(new Label(
+                        layout.addComponent(new Label(
                                 "<p>Lorem ipsum dolor sit amet.</p>"
                                         + "<p>Lorem ipsum dolor sit amet.</p>"
                                         + "<p>Lorem ipsum dolor sit amet.</p>"
index a5f7b83c32dd115f98161835cc491f081eb50aef..ec785c953fa7f4dd8b728f76f25e99cfa68c7301 100644 (file)
@@ -105,9 +105,11 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
         test(gridLayout);
         populateLayout(gridLayout);
 
-        final Window window = new Window("TEST: Window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        final Window window = new Window("TEST: Window", layout);
         test(window);
-        populateLayout((Layout) window.getContent());
+        populateLayout(layout);
 
     }
 
index 95ffe8b706b3d87dc3ca69c7b3470a2141fa2032..c4a6a7b605d8d3283a1fbfec429f583d0e675239 100644 (file)
@@ -25,6 +25,7 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class TestForNativeWindowing extends LegacyApplication {
@@ -40,8 +41,10 @@ public class TestForNativeWindowing extends LegacyApplication {
                 new Button.ClickListener() {
                     @Override
                     public void buttonClick(ClickEvent event) {
+                        VerticalLayout layout = new VerticalLayout();
+                        layout.setMargin(true);
                         final Window w = new Window("sw "
-                                + System.currentTimeMillis());
+                                + System.currentTimeMillis(), layout);
                         main.addWindow(w);
                         w.setPositionX(100);
                         w.setPositionY(100);
@@ -59,9 +62,9 @@ public class TestForNativeWindowing extends LegacyApplication {
                             }
 
                         });
-                        w.addComponent(closebutton);
+                        layout.addComponent(closebutton);
 
-                        w.addComponent(new Label(
+                        layout.addComponent(new Label(
                                 "<p>Lorem ipsum dolor sit amet.</p>"
                                         + "<p>Lorem ipsum dolor sit amet.</p>"
                                         + "<p>Lorem ipsum dolor sit amet.</p>"
index 2818862def9b37b920af988c59a55df6cf21d2be..2175aa63ba332990a5d1a9eb177cbb385a5fb802 100644 (file)
@@ -51,7 +51,9 @@ public class TestForWindowing extends CustomComponent {
 
                     @Override
                     public void buttonClick(ClickEvent event) {
-                        Window w = new Window("Testing Window");
+                        VerticalLayout layout = new VerticalLayout();
+                        layout.setMargin(true);
+                        Window w = new Window("Testing Window", layout);
 
                         if (asModal.getValue().booleanValue()) {
                             w.setModal(true);
@@ -85,8 +87,8 @@ public class TestForWindowing extends CustomComponent {
 
                         });
 
-                        w.addComponent(s1);
-                        w.addComponent(s2);
+                        layout.addComponent(s1);
+                        layout.addComponent(s2);
 
                         Slider s = new Slider();
                         s.setCaption("Volume");
@@ -97,7 +99,7 @@ public class TestForWindowing extends CustomComponent {
                         // s.setOrientation(Slider.ORIENTATION_VERTICAL);
                         // s.setArrows(false);
 
-                        w.addComponent(s);
+                        layout.addComponent(s);
 
                         UI.getCurrent().addWindow(w);
 
index e80a8801a238f269c88104effde87720df344f32..1af1cc82e9cb0853e8c04e90c3f24689388328f3 100644 (file)
@@ -167,10 +167,12 @@ public class TouchScrollables extends TestBase {
         Button b = new Button("Open subwindow", new Button.ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
-                Window w = new Window("Subwindow");
+                VerticalLayout layout = new VerticalLayout();
+                layout.setMargin(true);
+                Window w = new Window("Subwindow", layout);
                 w.center();
                 w.setHeight("200px");
-                w.addComponent(getBigComponent());
+                layout.addComponent(getBigComponent());
                 getMainWindow().addWindow(w);
             }
         });
index d0321100dd4b0ba922b2395aa8767491a5b41e2f..3c7a9a40ea4a9b2cf375e69f05679925be02a35f 100644 (file)
@@ -8,6 +8,7 @@ import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Notification;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 @SuppressWarnings("serial")
@@ -31,7 +32,10 @@ public class ShortCutListenerModification extends TestBase implements
 
         for (int j = 0; j < 20; j++) {
 
+            VerticalLayout layout = new VerticalLayout();
+            layout.setMargin(true);
             Window window = new Window();
+            window.setContent(layout);
             getMainWindow().addWindow(window);
 
             Button button1 = new Button("b1 (CTRL-C)");
@@ -43,8 +47,8 @@ public class ShortCutListenerModification extends TestBase implements
             button1.setClickShortcut(KeyCode.C, ModifierKey.CTRL);
             button2.setClickShortcut(KeyCode.V, ModifierKey.CTRL);
 
-            window.addComponent(button1);
-            window.addComponent(button2);
+            layout.addComponent(button1);
+            layout.addComponent(button2);
             button1.focus();
             button1.setData(prev);
             prev = button1;
index 393a8ceb6b34ffb57dec36b66bd66f911a0d0a1c..209a31708cdca07bce927c11d621c4147d9966ba 100644 (file)
@@ -6,15 +6,19 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.ComboBox;
 import com.vaadin.ui.Component;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class ComboBoxInPopup extends TestBase {
 
     @Override
     protected void setup() {
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        layout.setSizeUndefined();
         final Window w = new Window();
-        w.getContent().setSizeUndefined();
-        w.addComponent(createComboBox());
+        w.setContent(layout);
+        layout.addComponent(createComboBox());
         Button close = new Button("Close window", new Button.ClickListener() {
 
             @Override
@@ -23,7 +27,7 @@ public class ComboBoxInPopup extends TestBase {
             }
         });
         close.setClickShortcut(KeyCode.ESCAPE, null);
-        w.addComponent(close);
+        layout.addComponent(close);
 
         getLayout().getUI().addWindow(w);
 
index 24aea183143968146e71f479fc736c9eb231aa0f..d1d2f58239afc0f04f59fdb49ee6c4378d90467d 100644 (file)
@@ -6,6 +6,7 @@ import com.vaadin.event.FieldEvents;
 import com.vaadin.event.FieldEvents.FocusEvent;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class ComboBoxSuggestionOnDetach extends TestBase {
@@ -13,6 +14,12 @@ public class ComboBoxSuggestionOnDetach extends TestBase {
     @Override
     protected void setup() {
         final Window popup = new Window();
+
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        layout.setSizeUndefined();
+        popup.setContent(layout);
+
         ComboBox comboBox = new ComboBox("Combo box", Arrays.asList("Option 1",
                 "Option 2", "Option 3"));
         comboBox.addListener(new FieldEvents.FocusListener() {
@@ -21,10 +28,9 @@ public class ComboBoxSuggestionOnDetach extends TestBase {
                 popup.close();
             }
         });
-        popup.addComponent(comboBox);
+        layout.addComponent(comboBox);
 
         popup.setSizeUndefined();
-        popup.getContent().setSizeUndefined();
         popup.center();
 
         getMainWindow().addWindow(popup);
index 173f1596a700e0cad8a6fe040427bc30c4d5e7aa..d6fbb465e8d42283c1a0441fb5ad830cf4054714 100644 (file)
@@ -75,9 +75,10 @@ public class DateFieldInSubWindow extends AbstractTestCase {
         }
 
         protected void initWindow() {
-            VerticalLayout layout = (VerticalLayout) getContent();
+            VerticalLayout layout = new VerticalLayout();
             layout.setMargin(true);
             layout.setSpacing(true);
+            setContent(layout);
 
             /**
              * This causes the window to add the .v-readonly style!
@@ -97,7 +98,7 @@ public class DateFieldInSubWindow extends AbstractTestCase {
                 generalForm.setVisibleItemProperties(new String[] { "myDate",
                         "myString" });
                 generalForm.setValidationVisible(true);
-                addComponent(generalForm);
+                layout.addComponent(generalForm);
             }
 
             HorizontalLayout buttons = new HorizontalLayout();
index 4b318c38908026967019e7f52d244f2c6f7da3cd..fec2fb14475cfa90e95450311f2013a710f70ebf 100644 (file)
@@ -6,6 +6,7 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Embedded;
 import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class EmbeddedApplet extends TestBase {
@@ -36,8 +37,10 @@ public class EmbeddedApplet extends TestBase {
             }
         }));
 
-        Window window = new Window("Testwindow");
-        window.addComponent(new Label("I am inside the window"));
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window window = new Window("Testwindow", layout);
+        layout.addComponent(new Label("I am inside the window"));
         applet.getUI().addWindow(window);
     }
 }
index f558285224a8d6b991dd83f41e16b458eac9317f..9557137c8ad545ae9ff7454e4e4a7f419944f6be 100644 (file)
@@ -37,18 +37,20 @@ public class VerticalLayoutWidthCalculation extends AbstractTestCase {
         vlTF2.addComponent(tf2);
         hl.addComponent(vlTF2);
 
-        Window wnd = new Window("Test");
-        wnd.getContent().setSizeUndefined();
-        wnd.addComponent(hl);
+        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.addListener(new Button.ClickListener() {
+        btn.addClickListener(new Button.ClickListener() {
 
             @Override
             public void buttonClick(ClickEvent event) {
                 tf2.setVisible(!tf2.isVisible());
             }
         });
-        wnd.addComponent(btn);
+        layout.addComponent(btn);
 
         return wnd;
     }
index ba4fe93b681265b25bec195aa69fb231b0f00995..a5441f38b16e370ddf512d0bc5ce6c4b8c013a66 100644 (file)
@@ -27,8 +27,8 @@ public class PopupViewClickShortcut extends TestBase {
         addComponent(new PopupView("Show popup table", makeTable("Popup",
                 KeyCode.P)));
         addComponent(makeTable("Main window", KeyCode.M));
-        sub.addComponent(new PopupView("Show popup table", makeTable(
-                "Subwindow popup", KeyCode.U)));
+        ((ComponentContainer) sub.getContent()).addComponent(new PopupView(
+                "Show popup table", makeTable("Subwindow popup", KeyCode.U)));
     }
 
     private ComponentContainer makeTable(final String caption, int keyCode) {
index ae9ba302c676f7807e0073571cc3666652ff1d6d..8293d9919fd98f9f30cacb26b64433cdf1cef5b3 100644 (file)
@@ -59,10 +59,12 @@ public class RichTextAreaWithKeyboardShortcuts extends TestBase {
         panelLayout.addComponent(createRichTextArea("InPanel"));
         getLayout().addComponent(panel);
 
-        Window w = new Window("SubWindow");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window w = new Window("SubWindow", layout);
         w.addActionHandler(actionHandler);
-        w.addComponent(createRichTextArea("InSubWindow"));
-        w.getContent().setSizeUndefined();
+        layout.addComponent(createRichTextArea("InSubWindow"));
+        layout.setSizeUndefined();
 
         getLayout().getUI().addWindow(w);
 
index ceb5ff5c60a08a43f3aa03762b10d87687e2e78f..8e6b68d666bdcf6ef77c16013d488b478c4c1325 100644 (file)
@@ -86,7 +86,10 @@ public class WindowsCssTest extends VerticalLayout {
             String styleName) {
 
         Window window = new Window();
-        window.addComponent(new Label("Some content"));
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        window.setContent(layout);
+        layout.addComponent(new Label("Some content"));
 
         if (caption != null) {
             window.setCaption(caption);
index 9994414d124d6c1a7285a33a4b1259a3e33939bd..455fb2e531d36977832851a8139f2c20a5eeae69 100644 (file)
@@ -11,6 +11,7 @@ import com.vaadin.ui.Button.ClickListener;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class AttachShouldBeCalledForSubWindows extends AbstractTestCase {
@@ -72,7 +73,9 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase {
     }
 
     private Window createSubWindow() {
-        Window w = new Window("Sub window") {
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window w = new Window("Sub window", layout) {
             @Override
             public void attach() {
                 log(this);
@@ -95,7 +98,7 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase {
             }
         });
         okButton.setClickShortcut(KeyCode.ENTER);
-        w.addComponent(okButton);
+        layout.addComponent(okButton);
         w.center();
         return w;
     }
index a7fcda3cf1d920545af260efc062b9f144e669c7..efe7eb20bf45507b57bc8acd9b15cb644e8fecb4 100644 (file)
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.window;
 
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class CenteredWindowWithUndefinedSize extends TestBase {
@@ -18,14 +19,16 @@ public class CenteredWindowWithUndefinedSize extends TestBase {
 
     @Override
     protected void setup() {
-        Window centered = new Window("A window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window centered = new Window("A window", layout);
         centered.setSizeUndefined();
-        centered.getContent().setSizeFull();
+        layout.setSizeFull();
         centered.center();
 
         Label l = new Label("This window should be centered");
         l.setSizeUndefined();
-        centered.addComponent(l);
+        layout.addComponent(l);
 
         getMainWindow().addWindow(centered);
 
index 8060ec9955b975b07c57dc3b1a9b6ae8c4609feb..e2a59b60057c321054c1281d8696eb74c2b55ccc 100644 (file)
@@ -5,6 +5,7 @@ import com.vaadin.tests.util.Log;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 import com.vaadin.ui.Window.CloseEvent;
 import com.vaadin.ui.Window.CloseListener;
@@ -30,9 +31,11 @@ public class CloseSubWindow extends TestBase {
     }
 
     private Window createClosableSubWindow(final String title) {
-        final Window window = new Window(title);
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        layout.setSizeFull();
+        final Window window = new Window(title, layout);
         window.setSizeUndefined();
-        window.getContent().setSizeFull();
         window.setClosable(true);
 
         Button closeButton = new Button("Close");
@@ -42,7 +45,7 @@ public class CloseSubWindow extends TestBase {
                 event.getButton().findAncestor(Window.class).close();
             }
         });
-        window.addComponent(closeButton);
+        layout.addComponent(closeButton);
 
         Button removeButton = new Button("Remove from parent");
         removeButton.addListener(new ClickListener() {
@@ -51,7 +54,7 @@ public class CloseSubWindow extends TestBase {
                 window.close();
             }
         });
-        window.addComponent(closeButton);
+        layout.addComponent(closeButton);
 
         window.addListener(new CloseListener() {
             @Override
index 6ca5837ceed9f55636e2859f6482b5578d8aecc6..579590ed78a02a95630fcb8e072534e35063e249 100644 (file)
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.window;
 import com.vaadin.server.ThemeResource;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Embedded;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class EmbeddedInSubWindow extends TestBase {
@@ -20,15 +21,17 @@ public class EmbeddedInSubWindow extends TestBase {
     @Override
     protected void setup() {
         setTheme("tests-tickets");
-        Window zoom = new Window("Image Preview");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        layout.setSizeUndefined();
+        Window zoom = new Window("Image Preview", layout);
         zoom.setSizeUndefined();
-        zoom.getContent().setSizeUndefined();
 
         String res = "icons/EmbeddedInSubWindow-image.png";
         Embedded imagePreview = new Embedded(null, new ThemeResource(res));
         imagePreview.setSizeUndefined();
 
-        zoom.addComponent(imagePreview);
+        layout.addComponent(imagePreview);
         zoom.setModal(true);
         zoom.setResizable(false);
 
index 5ce0636f6ff08303ed5dad0632ae22207ececd35..af997f36192b972b079ca399c7c8a4546d791071 100644 (file)
@@ -2,19 +2,22 @@ package com.vaadin.tests.components.window;
 
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class ExtraLargeSubWindow extends TestBase {
 
     @Override
     protected void setup() {
-        Window w = new Window("full sized window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        layout.setSizeFull();
+        Window w = new Window("full sized window", layout);
         w.setWidth("2000px");
         w.setHeight("2000px");
-        w.getContent().setSizeFull();
         NativeButton b = new NativeButton("A large button");
         b.setSizeFull();
-        w.addComponent(b);
+        layout.addComponent(b);
 
         getMainWindow().addWindow(w);
     }
index 03deb4ea2092814aec4b785653bf0d47fc5e60de..35a4b8c761b5d85af7f2cbf466d7a4c32627c6f8 100644 (file)
@@ -5,6 +5,7 @@ import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class ExtraWindowShown extends TestBase {
@@ -16,19 +17,22 @@ public class ExtraWindowShown extends TestBase {
             @Override
             public void buttonClick(ClickEvent event) {
 
-                final Window w = new Window("Sub window");
+                VerticalLayout layout = new VerticalLayout();
+                layout.setMargin(true);
+                final Window w = new Window("Sub window", layout);
                 w.center();
-                w.addComponent(new Button("Close", new Button.ClickListener() {
-
-                    @Override
-                    public void buttonClick(ClickEvent event) {
-                        w.close();
-                    }
-                }));
+                layout.addComponent(new Button("Close",
+                        new Button.ClickListener() {
+
+                            @Override
+                            public void buttonClick(ClickEvent event) {
+                                w.close();
+                            }
+                        }));
                 Button iconButton = new Button("A button with icon");
                 iconButton
                         .setIcon(new ThemeResource("../runo/icons/16/ok.png"));
-                w.addComponent(iconButton);
+                layout.addComponent(iconButton);
                 event.getButton().getUI().addWindow(w);
             }
 
index 8ccd389b1a27c5c784537775672646e329d1b7b8..dd98024f1cddf9e6a96b0027973bd9b3989f2bb7 100644 (file)
@@ -11,6 +11,7 @@ import com.vaadin.tests.util.LoremIpsum;
 import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 import com.vaadin.ui.Window.ResizeEvent;
 import com.vaadin.ui.Window.ResizeListener;
@@ -54,11 +55,13 @@ public class LazyWindowResize extends AbstractTestCase {
     public void init() {
         mainWindow = new LegacyWindow("Resize test");
         setMainWindow(mainWindow);
-        subWindow = new Window("Sub window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        subWindow = new Window("Sub window", layout);
         subWindow.setHeight("50%");
         subWindow.setWidth("50%");
         subWindow.center();
-        subWindow.addComponent(new Label(LoremIpsum.get(1000)));
+        layout.addComponent(new Label(LoremIpsum.get(1000)));
         getMainWindow().addWindow(subWindow);
 
         lazyMode = new CheckBox("Lazy resize");
index 389c92698670518403880a702033747a6e7cb314..637df36e19d97097995623f377209fef32749542 100644 (file)
@@ -7,6 +7,7 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class SubWindowFocus extends TestBase {
@@ -43,12 +44,14 @@ public class SubWindowFocus extends TestBase {
         Button b = new Button("new", new Button.ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
-                final Window win = new Window("Subwin");
-                win.getContent().setWidth(null);
+                VerticalLayout layout = new VerticalLayout();
+                layout.setMargin(true);
+                final Window win = new Window("Subwin", layout);
+                layout.setWidth(null);
                 win.center();
                 win.setClosable(false);
                 getMainWindow().addWindow(win);
-                win.addComponent(new Label("SPACE notifies, ESC closes."));
+                layout.addComponent(new Label("SPACE notifies, ESC closes."));
 
                 win.addActionHandler(new Action.Handler() {
 
@@ -76,7 +79,7 @@ public class SubWindowFocus extends TestBase {
 
                 });
 
-                win.addComponent(new TextField());
+                layout.addComponent(new TextField());
             }
 
         });
index bb5a8173621150cbff7745d77cefe749f85b02fd..2a0f60f39086f3d3c640569b79ef0601a0f42db6 100644 (file)
@@ -14,6 +14,7 @@ import com.vaadin.ui.ComponentContainer;
 import com.vaadin.ui.Notification;
 import com.vaadin.ui.TextField;
 import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class SubWindowFocusAndBlurListeners extends TestBase {
@@ -32,10 +33,12 @@ public class SubWindowFocusAndBlurListeners extends TestBase {
     @Override
     protected void setup() {
 
-        final Window window = new Window("Focus test window");
-        window.getContent().setSizeUndefined();
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        final Window window = new Window("Focus test window", layout);
+        layout.setSizeUndefined();
 
-        window.addComponent(new TextField());
+        layout.addComponent(new TextField());
         window.addListener(new FocusListener() {
             @Override
             public void focus(FocusEvent event) {
index 0ca7fd1067c6d7912673fea0d2706fa68831d0a2..4585a036ff65fd4e4500ceda8a1036a44ac56fa4 100644 (file)
@@ -11,6 +11,7 @@ import com.vaadin.ui.CssLayout;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class SubWindowOrder extends TestBase {
@@ -23,11 +24,13 @@ public class SubWindowOrder extends TestBase {
         UI mainWindow = getMainWindow();
         HorizontalLayout controlpanels = new HorizontalLayout();
         for (int i = 1; i <= 5; i++) {
-            Window dialog = new Window("Dialog " + i);
-            dialog.getContent().setSizeUndefined();
+            VerticalLayout layout = new VerticalLayout();
+            layout.setMargin(true);
+            Window dialog = new Window("Dialog " + i, layout);
+            layout.setSizeUndefined();
             windowlist.addBean(dialog);
-            dialog.addComponent(new Label("this is dialog number " + i));
-            dialog.addComponent(new ControlPanel());
+            layout.addComponent(new Label("this is dialog number " + i));
+            layout.addComponent(new ControlPanel());
             mainWindow.addWindow(dialog);
         }
         controlpanels.addComponent(new ControlPanel());
index 5bda762d3f74f1e1398960bd8a931ec58ac67afb..473b3e1f9c04ae5d03e7bae33dbe551b993cde34 100644 (file)
@@ -4,6 +4,7 @@ import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class SubWindowWithUndefinedHeight extends TestBase {
@@ -20,10 +21,12 @@ public class SubWindowWithUndefinedHeight extends TestBase {
 
     @Override
     protected void setup() {
-        final Window subwindow = new Window("subwindow");
+        final VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        final Window subwindow = new Window("subwindow", layout);
         subwindow.center();
         subwindow.setSizeUndefined();
-        subwindow.getContent().setSizeUndefined();
+        layout.setSizeUndefined();
 
         final Button tabButton = new Button("A button");
         tabButton.setCaption("Tab 1");
@@ -42,17 +45,17 @@ public class SubWindowWithUndefinedHeight extends TestBase {
             public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
                 if (tabsheet.getSelectedTab() == tabButton) {
                     tabsheet.setSizeUndefined();
-                    subwindow.getContent().setSizeUndefined();
+                    layout.setSizeUndefined();
                     subwindow.setSizeUndefined();
                 } else if (tabsheet.getSelectedTab() == table) {
                     subwindow.setWidth("500px");
                     subwindow.setHeight("500px");
-                    subwindow.getContent().setSizeFull();
+                    layout.setSizeFull();
                     tabsheet.setSizeFull();
                 }
             }
         });
-        subwindow.addComponent(tabsheet);
+        layout.addComponent(tabsheet);
 
         Button button = new Button("click me", new Button.ClickListener() {
             @Override
index a146aeed49e73864948aaf4d56785b79026b3d3c..28e130be1f4f700888ac9960880b50c96cd5aee0 100644 (file)
@@ -9,6 +9,7 @@ import com.vaadin.ui.ComponentContainer;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.TextArea;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class SubWindows extends TestBase {
@@ -45,16 +46,16 @@ public class SubWindows extends TestBase {
 
     @Override
     protected void setup() {
-        autoWideWindow = new Window("Dialog - width by contents",
-                new HorizontalLayout());
-        autoWideWindow.getContent().setSizeUndefined();
-        autoWideWindow.addComponent(new TextField("Field 1"));
-        autoWideWindow.addComponent(new TextField("Field 2"));
-        autoWideWindow.addComponent(new Button("Add", new ClickListener() {
+        final HorizontalLayout hl = new HorizontalLayout();
+        autoWideWindow = new Window("Dialog - width by contents", hl);
+        hl.setSizeUndefined();
+        hl.addComponent(new TextField("Field 1"));
+        hl.addComponent(new TextField("Field 2"));
+        hl.addComponent(new Button("Add", new ClickListener() {
 
             @Override
             public void buttonClick(ClickEvent event) {
-                autoWideWindow.addComponent(createRemoveButton());
+                hl.addComponent(createRemoveButton());
 
             }
 
@@ -63,29 +64,34 @@ public class SubWindows extends TestBase {
         getMainWindow().addWindow(autoWideWindow);
 
         {
-            Window dialog = new Window("Dialog - undefined width");
-            dialog.addComponent(new TextField("Field 1"));
+            VerticalLayout vl = new VerticalLayout();
+            hl.setMargin(true);
+            Window dialog = new Window("Dialog - undefined width", vl);
+            vl.addComponent(new TextField("Field 1"));
 
             TextField tf2 = new TextField("Field 2");
             tf2.setWidth("500px");
-            dialog.addComponent(tf2);
-            dialog.addComponent(new Button("Ok"));
+            vl.addComponent(tf2);
+            vl.addComponent(new Button("Ok"));
 
             dialog.center();
             getMainWindow().addWindow(dialog);
         }
 
         {
-            Window dialog = new Window("Dialog - width defined by content");
-            dialog.getContent().setHeight(null);
-            dialog.getContent().setWidth("100%");
+            VerticalLayout layout = new VerticalLayout();
+            layout.setMargin(true);
+            Window dialog = new Window("Dialog - width defined by content",
+                    layout);
+            layout.setHeight(null);
+            layout.setWidth("100%");
 
             TextArea ta = new TextArea();
             ta.setValue("The textfield should fill the window (except margins)."
                     + "\n - Try to resize the window\n");
             ta.setRows(5);
             ta.setWidth("100%");
-            dialog.addComponent(ta);
+            layout.addComponent(ta);
 
             dialog.setPositionX(20);
             dialog.setPositionY(100);
@@ -93,9 +99,12 @@ public class SubWindows extends TestBase {
         }
 
         {
-            Window dialog = new Window("Dialog - size defined by content");
-            dialog.getContent().setHeight("100%");
-            dialog.getContent().setWidth("100%");
+            VerticalLayout layout = new VerticalLayout();
+            layout.setMargin(true);
+            Window dialog = new Window("Dialog - size defined by content",
+                    layout);
+            layout.setHeight("100%");
+            layout.setWidth("100%");
 
             TextArea ta = new TextArea();
             ta.setValue("The textfield should fill the window (except margins)."
@@ -103,7 +112,7 @@ public class SubWindows extends TestBase {
             ta.setWidth("100%");
             ta.setHeight("100%");
             ta.setRows(5);
-            dialog.addComponent(ta);
+            layout.addComponent(ta);
 
             dialog.setPositionX(20);
             dialog.setPositionY(300);
index 03e5988fadcdc327805554040b90aadf254abd38..8349c829110c9b97eb537c65a9cf763cfd89061c 100644 (file)
@@ -19,7 +19,9 @@ public class SubwindowInvalidLayout extends TestBase {
 
     @Override
     protected void setup() {
-        Window window = new Window("Sub window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window window = new Window("Sub window", layout);
         window.center();
 
         VerticalLayout vl = new VerticalLayout();
@@ -27,7 +29,7 @@ public class SubwindowInvalidLayout extends TestBase {
         Button b = new Button("A 100% wide button, invalid");
         b.setWidth("100%");
         vl.addComponent(b);
-        window.addComponent(vl);
+        layout.addComponent(vl);
 
         getMainWindow().addWindow(window);
     }
index 859c1b4b5d458fc1e1d1371b0be28a4f1a7787c5..46845748a3f2708200bc8a3d0852e6f334f4ab0c 100644 (file)
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.window;
 
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class TestTooSmallSubwindowSize extends TestBase {
@@ -18,14 +19,16 @@ public class TestTooSmallSubwindowSize extends TestBase {
 
     @Override
     protected void setup() {
-        Window w = new Window("Scroll");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window w = new Window("Scroll", layout);
         Label desc = new Label(
                 "This is a new child window with a preset"
                         + " width, height and position. Resizing has been"
                         + " disabled for this window. Additionally, this text label"
                         + " is intentionally too large to fit the window. You can"
                         + " use the scrollbars to view different parts of the window content.");
-        w.addComponent(desc);
+        layout.addComponent(desc);
 
         // Set window position
         w.setPositionX(100);
index 12af6ccdae927b77bd133c05ca4274bf9ae99284..8e786533ef67e3d5d741ecf9b8522b7432e85036 100644 (file)
@@ -19,16 +19,19 @@ package com.vaadin.tests.components.window;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class TooltipInWindow extends AbstractTestUI {
 
     @Override
     protected void setup(VaadinRequest request) {
-        Window window = new Window("Window");
-        window.getContent().setSizeUndefined();
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window window = new Window("Window", layout);
+        layout.setSizeUndefined();
         window.center();
-        window.addComponent(createTextField());
+        layout.addComponent(createTextField());
 
         addWindow(window);
         addComponent(createTextField());
index a4120b7d42197ebd4fe129ade941a67e636963ee..00cd580ed800ce2c5b8e4e1429cef7ca8f4b97bf 100644 (file)
@@ -54,7 +54,7 @@ public class WindowClickEvents extends TestBase {
 
         });
         centered.setSizeUndefined();
-        centered.getContent().setSizeUndefined();
+        layout.setSizeUndefined();
         centered.center();
 
         Label l = new Label("This window is centered");
@@ -69,8 +69,8 @@ public class WindowClickEvents extends TestBase {
             }
 
         });
-        centered.addComponent(l);
-        centered.addComponent(b);
+        layout.addComponent(l);
+        layout.addComponent(b);
 
         getMainWindow().addWindow(centered);
         log = new Log(5);
index 57a125bcb7cde78cd3e76d4c9f4d59a7dc3c96f7..e66767dac98fff4b2544580b3dde6481ab61842e 100644 (file)
@@ -8,7 +8,7 @@ import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class WindowResizeListener extends TestBase {
@@ -82,10 +82,11 @@ class ResizeListenerWindow extends Window {
     Label sizeLabel = new Label();
 
     public ResizeListenerWindow() {
-        super("Subwindow");
+        super("Subwindow", new VerticalLayout());
         setWidth("400px");
 
-        Layout hl = (Layout) getContent();
+        VerticalLayout hl = (VerticalLayout) getContent();
+        hl.setMargin(true);
         hl.addComponent(new Label("Current size: "));
         hl.addComponent(sizeLabel);
 
index 12a30cabfcdcccd5d9b5606727245a9a740fbf88..09d03cdd2877e039ba948dbeda29b290b2c948e8 100644 (file)
@@ -52,13 +52,15 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
         getMainWindow().addComponent(horizontalLayout);
         final Component y9 = l;
 
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
         final Window window = new Window();
         window.setHeight("500px");
         window.setWidth("500px");
         window.setPositionX(200);
         window.setPositionY(200);
 
-        window.addComponent(new Button("Scroll mainwin to X9",
+        layout.addComponent(new Button("Scroll mainwin to X9",
                 new ClickListener() {
                     @Override
                     public void buttonClick(ClickEvent event) {
@@ -66,7 +68,7 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
 
                     }
                 }));
-        window.addComponent(new Button("Scroll mainwin to Y9",
+        layout.addComponent(new Button("Scroll mainwin to Y9",
                 new ClickListener() {
                     @Override
                     public void buttonClick(ClickEvent event) {
@@ -82,7 +84,7 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
         panel.setScrollLeft(50);
         panel.setScrollTop(50);
         panelLayout.setSizeUndefined();
-        window.addComponent(l("Spacer", 500, 500));
+        layout.addComponent(l("Spacer", 500, 500));
 
         l2 = null;
         for (int i = 0; i < 10; i++) {
@@ -119,7 +121,7 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
                     }
                 }), 0);
 
-        window.addComponent(panel);
+        layout.addComponent(panel);
         getMainWindow().addWindow(window);
 
     }
index 5ba6999da46a7f468061056e1320aa9586f61dd5..2122e8e982445991fe2f1b29a446730200756ee0 100644 (file)
@@ -46,6 +46,7 @@ import com.vaadin.ui.Table;
 import com.vaadin.ui.Tree;
 import com.vaadin.ui.Tree.TreeDragMode;
 import com.vaadin.ui.Tree.TreeTargetDetails;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class DDTest6 extends TestBase {
@@ -256,9 +257,11 @@ public class DDTest6 extends TestBase {
         // ATM supports only images.
         if (file.getType().equals("image/png")) {
             Embedded embedded = new Embedded(file.getName(), file.getResource());
-            Window w = new Window(file.getName());
-            w.addComponent(embedded);
-            w.getContent().setSizeUndefined();
+            VerticalLayout layout = new VerticalLayout();
+            layout.setMargin(true);
+            Window w = new Window(file.getName(), layout);
+            layout.addComponent(embedded);
+            layout.setSizeUndefined();
             getMainWindow().addWindow(w);
         } else if (file.getType().equals("text/csv")) {
             showSpreadsheet(file);
@@ -281,10 +284,12 @@ public class DDTest6 extends TestBase {
             String[] split = rows[i].split(",");
             table.addItem(split, "" + i);
         }
-        Window w = new Window(file.getName());
-        w.getContent().setSizeUndefined();
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window w = new Window(file.getName(), layout);
+        layout.setSizeUndefined();
         table.setEditable(true);
-        w.addComponent(table);
+        layout.addComponent(table);
         getMainWindow().addWindow(w);
 
     }
index d52e38ca407d45e812c0946645db482a37b040d8..8a8df937426816cd10432f334d6925e43f337e73 100644 (file)
@@ -407,20 +407,24 @@ public class LiferayThemeDemo extends LegacyApplication {
         final CssLayout l = new CssLayout();
         l.setCaption("Windows");
 
-        final Window w = new Window("Normal window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        final Window w = new Window("Normal window", layout);
         w.setWidth("280px");
         w.setHeight("180px");
         w.setPositionX(40);
         w.setPositionY(160);
 
-        final Window w2 = new Window("Window, no resize");
+        VerticalLayout layout2 = new VerticalLayout();
+        layout2.setMargin(true);
+        final Window w2 = new Window("Window, no resize", layout2);
         w2.setResizable(false);
         w2.setWidth("280px");
         w2.setHeight("180px");
         w2.setPositionX(350);
         w2.setPositionY(160);
-        w2.addComponent(new Label("<code>Window.setResizable(false)</code>",
-                ContentMode.HTML));
+        layout2.addComponent(new Label(
+                "<code>Window.setResizable(false)</code>", ContentMode.HTML));
 
         tabs.addListener(new TabSheet.SelectedTabChangeListener() {
             @Override
index 177471e3c80bdc5a4da3d842ebb30878d4e4250e..674287312d041e333ccdd4ddd4087a3530772c9a 100644 (file)
@@ -26,6 +26,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.Layout;
 import com.vaadin.ui.NativeSelect;
 import com.vaadin.ui.TextArea;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class TestAbsoluteLayout extends TestBase {
@@ -132,8 +133,11 @@ public class TestAbsoluteLayout extends TestBase {
             componentChooser.addListener(new Button.ClickListener() {
                 @Override
                 public void buttonClick(ClickEvent event) {
-                    final Window chooser = new Window("Choose component");
-                    chooser.getContent().setSizeUndefined();
+                    VerticalLayout layout = new VerticalLayout();
+                    layout.setMargin(true);
+                    final Window chooser = new Window("Choose component",
+                            layout);
+                    layout.setSizeUndefined();
                     chooser.setModal(true);
 
                     NativeSelect select = new NativeSelect(
@@ -176,7 +180,7 @@ public class TestAbsoluteLayout extends TestBase {
 
                     });
 
-                    chooser.addComponent(select);
+                    layout.addComponent(select);
 
                     getMainWindow().addWindow(chooser);
 
@@ -189,9 +193,11 @@ public class TestAbsoluteLayout extends TestBase {
             addComp.addListener(new Button.ClickListener() {
                 @Override
                 public void buttonClick(ClickEvent event) {
+                    VerticalLayout layout = new VerticalLayout();
+                    layout.setMargin(true);
                     final Window chooser = new Window(
-                            "Choose component type to add");
-                    chooser.getContent().setSizeUndefined();
+                            "Choose component type to add", layout);
+                    layout.setSizeUndefined();
                     chooser.setModal(true);
 
                     NativeSelect select = new NativeSelect(
@@ -261,7 +267,7 @@ public class TestAbsoluteLayout extends TestBase {
 
                     });
 
-                    chooser.addComponent(select);
+                    layout.addComponent(select);
 
                     getMainWindow().addWindow(chooser);
 
index f129f01c63cc2592e23711487c12dbc8acd193e3..522fbe7670e6c086ff6c6f325f80362d010a2665 100644 (file)
@@ -6,6 +6,7 @@ import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Notification;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class Ticket1465ModalNotification extends LegacyApplication {
@@ -17,7 +18,9 @@ public class Ticket1465ModalNotification extends LegacyApplication {
                 "ButtonPanel containing a table test");
         setMainWindow(mainWin);
 
-        final Window modal = new Window("Modal window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        final Window modal = new Window("Modal window", layout);
         modal.setModal(true);
 
         Button b = new Button("click to show notification",
@@ -31,7 +34,7 @@ public class Ticket1465ModalNotification extends LegacyApplication {
 
                     }
                 });
-        modal.addComponent(b);
+        layout.addComponent(b);
 
         b = new Button("click to warning notification",
                 new Button.ClickListener() {
@@ -43,7 +46,7 @@ public class Ticket1465ModalNotification extends LegacyApplication {
                                 Notification.TYPE_WARNING_MESSAGE);
                     }
                 });
-        modal.addComponent(b);
+        layout.addComponent(b);
 
         b = new Button("click to Humanized notification",
                 new Button.ClickListener() {
@@ -55,7 +58,7 @@ public class Ticket1465ModalNotification extends LegacyApplication {
                                 Notification.TYPE_HUMANIZED_MESSAGE);
                     }
                 });
-        modal.addComponent(b);
+        layout.addComponent(b);
 
         b = new Button("click to test modality!", new Button.ClickListener() {
 
@@ -66,7 +69,7 @@ public class Ticket1465ModalNotification extends LegacyApplication {
             }
         });
 
-        modal.addComponent(b);
+        layout.addComponent(b);
 
         mainWin.addWindow(modal);
 
index f4516f767afe5475051c58d52f8ec758faf4fca5..bf648b0d9292262a8573874dcb959bdf8ce33ca2 100644 (file)
@@ -109,7 +109,7 @@ public class Ticket1804 extends com.vaadin.server.LegacyApplication {
                 Window w = new Window("Status of the fields");
                 w.setModal(true);
                 w.setHeight("80%");
-                w.addComponent(new Label(msg.toString(), ContentMode.HTML));
+                w.setContent(new Label(msg.toString(), ContentMode.HTML));
                 main.addWindow(w);
             }
         });
index 1cb122a23e146a00381d603ef3d4551d84f0d560..e8f23da3d1febdca82d6fc013986f5c7b760b7f5 100644 (file)
@@ -72,7 +72,7 @@ public class Ticket1811 extends com.vaadin.server.LegacyApplication {
                 }
                 Window w = new Window("Status of the fields");
                 w.setModal(true);
-                w.addComponent(new Label(msg.toString(), ContentMode.HTML));
+                w.setContent(new Label(msg.toString(), ContentMode.HTML));
                 main.addWindow(w);
             }
         });
index b24eec115edbaf0135aa9be8ff68cb11d700de3c..b9a0060ce0ec6d6cedd3f27ed27e17abd46a8dc0 100644 (file)
@@ -58,7 +58,7 @@ public class Ticket1819 extends com.vaadin.server.LegacyApplication {
                 }
                 Window w = new Window("Status of the fields");
                 w.setModal(true);
-                w.addComponent(new Label(msg.toString(), ContentMode.HTML));
+                w.setContent(new Label(msg.toString(), ContentMode.HTML));
                 main.addWindow(w);
             }
         });
index b4ef678efe01c14b0c48ffc87af9b87d8f70b83f..4dc69ec4701f82f51de815a4ebfaf4091362b819 100644 (file)
@@ -100,6 +100,9 @@ public class Ticket2009 extends com.vaadin.server.LegacyApplication {
         Button done = new Button("Done");
 
         PropertyEditor(ItemClickEvent event) {
+            VerticalLayout layout = new VerticalLayout();
+            layout.setMargin(true);
+            setContent(layout);
             c = (Container) event.getSource();
 
             propertyid = event.getPropertyId();
@@ -109,8 +112,8 @@ public class Ticket2009 extends com.vaadin.server.LegacyApplication {
 
             editor.setPropertyDataSource(c.getContainerProperty(itemid,
                     propertyid));
-            addComponent(editor);
-            addComponent(done);
+            layout.addComponent(editor);
+            layout.addComponent(done);
 
             setWidth(W + "px");
             setHeight(H + "px");
index 9a736360677a88b25e9217f26f3d37495527258b..c6cbdbfa94e58748b980f059d5a8bcda53788eb9 100644 (file)
@@ -6,7 +6,6 @@ import com.vaadin.ui.AbstractOrderedLayout;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.ComponentContainer;
 import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Layout;
@@ -31,12 +30,12 @@ public class Ticket2021 extends LegacyApplication {
         w.setContent(new GridLayout(2, 2));
         setMainWindow(w);
 
-        Panel p = new Panel();
+        VerticalLayout layout = new VerticalLayout();
+        Panel p = new Panel(layout);
         p.setCaption("ExpandLayout");
         p.setWidth("500px");
         p.setHeight("500px");
-        p.setContent(new VerticalLayout());
-        p.getContent().setSizeFull();
+        layout.setSizeFull();
 
         w.addComponent(p);
 
@@ -45,19 +44,19 @@ public class Ticket2021 extends LegacyApplication {
         tf1.setSizeFull();
         tf1.setValue(contents);
         tf1.setCaption("TextField caption");
-        ((ComponentContainer) p.getContent()).addComponent(tf1);
+        layout.addComponent(tf1);
 
         /*
          * 
          * OrderedLayout
          */
 
-        Panel p2 = new Panel();
+        VerticalLayout layout2 = new VerticalLayout();
+        Panel p2 = new Panel(layout2);
         p2.setCaption("OrderedLayout");
         p2.setWidth("500px");
         p2.setHeight("500px");
-        p2.setContent(new VerticalLayout());
-        p2.getContent().setSizeFull();
+        layout2.setSizeFull();
 
         w.addComponent(p2);
 
@@ -66,7 +65,7 @@ public class Ticket2021 extends LegacyApplication {
         tf2.setSizeFull();
         tf2.setValue(contents);
         tf2.setCaption("TextField caption");
-        ((ComponentContainer) p2.getContent()).addComponent(tf2);
+        layout2.addComponent(tf2);
 
         /*
          * 
index 8b5d329977ad255a6804e09d548a88dbd99c5c95..0dc65cc25e848f73ebc1371de1459bb198fd295c 100644 (file)
@@ -73,7 +73,7 @@ public class Ticket2099 extends LegacyApplication {
         // l1.setVisible(false);
         // ts.setSelectedTab(l3);
 
-        w.addComponent(ts);
+        w.setContent(ts);
 
         return w;
     }
index 6ccb2d8494eab8b73b0ae7b655c6671f6b0ce5d9..e32b66ffc0c66d7279616f0f39cef97e967e6046 100644 (file)
@@ -23,7 +23,6 @@ import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.HorizontalSplitPanel;
 import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.RichTextArea;
@@ -168,7 +167,9 @@ public class Ticket2204 extends LegacyApplication {
             textArea.setSizeFull();
         }
         if (c == Panel.class) {
-            Layout layout = (Layout) ((Panel) cc).getContent();
+            VerticalLayout layout = new VerticalLayout();
+            layout.setMargin(true);
+            ((Panel) cc).setContent(layout);
             containerToComponent.put(cc, layout);
             layout.setVisible(false);
             textArea.setVisible(true);
index f2ea5146d2ffc3d5ba6364de4678b5a1547a1920..d9bbde52aa2dd6570e6ed874e506bdc45ee7f1db 100644 (file)
@@ -3,6 +3,7 @@ package com.vaadin.tests.tickets;
 import com.vaadin.server.LegacyApplication;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class Ticket2323 extends LegacyApplication {
@@ -12,11 +13,13 @@ public class Ticket2323 extends LegacyApplication {
         LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
         setMainWindow(w);
 
-        Window subWindow = new Window("");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window subWindow = new Window("", layout);
         subWindow.setSizeUndefined();
         subWindow.getContent().setSizeUndefined();
         subWindow.center();
-        subWindow.addComponent(new RichTextArea());
+        subWindow.setContent(new RichTextArea());
         w.addWindow(subWindow);
     }