]> source.dussan.org Git - vaadin-framework.git/commitdiff
Panel and Window based on AbstractSingleComponentContainer (#2924) 65/265/1
authorHenri Sara <hesara@vaadin.com>
Wed, 14 Nov 2012 11:49:47 +0000 (13:49 +0200)
committerHenri Sara <hesara@vaadin.com>
Wed, 14 Nov 2012 11:49:47 +0000 (13:49 +0200)
Change-Id: I9eb1f40a02dcad0f756ad2518d86ef1c52aa69c2

93 files changed:
server/src/com/vaadin/ui/Panel.java
server/src/com/vaadin/ui/Window.java
uitest/src/com/vaadin/tests/CustomLayoutDemo.java
uitest/src/com/vaadin/tests/LayoutDemo.java
uitest/src/com/vaadin/tests/Parameters.java
uitest/src/com/vaadin/tests/RandomLayoutStress.java
uitest/src/com/vaadin/tests/TestBench.java
uitest/src/com/vaadin/tests/TestCaptionWrapper.java
uitest/src/com/vaadin/tests/TestComponentAddAndRecursion.java
uitest/src/com/vaadin/tests/TestContainerChanges.java
uitest/src/com/vaadin/tests/TestForBasicApplicationLayout.java
uitest/src/com/vaadin/tests/TestForContainerFilterable.java
uitest/src/com/vaadin/tests/TestForPreconfiguredComponents.java
uitest/src/com/vaadin/tests/TestForStyledUpload.java
uitest/src/com/vaadin/tests/TestForTrees.java
uitest/src/com/vaadin/tests/TestForUpload.java
uitest/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java
uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java
uitest/src/com/vaadin/tests/TestSizeableIncomponents.java
uitest/src/com/vaadin/tests/TreeFilesystem.java
uitest/src/com/vaadin/tests/TreeFilesystemContainer.java
uitest/src/com/vaadin/tests/UsingCustomNewItemHandlerInSelect.java
uitest/src/com/vaadin/tests/UsingObjectsInSelect.java
uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java
uitest/src/com/vaadin/tests/components/TouchScrollables.java
uitest/src/com/vaadin/tests/components/abstractcomponent/EnableState.java
uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutInForm.java
uitest/src/com/vaadin/tests/components/label/LabelStyles.java
uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWithEmptyLabel.java
uitest/src/com/vaadin/tests/components/panel/BasicPanelTest.java
uitest/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.java
uitest/src/com/vaadin/tests/components/panel/PanelConcurrentModificationException.java
uitest/src/com/vaadin/tests/components/panel/PanelShouldNotScroll.java
uitest/src/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java
uitest/src/com/vaadin/tests/components/panel/PanelTest.java
uitest/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.java
uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java
uitest/src/com/vaadin/tests/components/table/SafariRenderingBugWhiteSpace.java
uitest/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java
uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java
uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java
uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java
uitest/src/com/vaadin/tests/components/uitest/components/LayoutsCssTest.java
uitest/src/com/vaadin/tests/components/window/ExecuteJavaScript.java
uitest/src/com/vaadin/tests/components/window/FullSizedWindow.java
uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java
uitest/src/com/vaadin/tests/components/window/WindowTest.java
uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java
uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java
uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java
uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java
uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java
uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java
uitest/src/com/vaadin/tests/themes/LiferayThemeTest.java
uitest/src/com/vaadin/tests/tickets/Ticket1397.java
uitest/src/com/vaadin/tests/tickets/Ticket1435.java
uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java
uitest/src/com/vaadin/tests/tickets/Ticket1572.java
uitest/src/com/vaadin/tests/tickets/Ticket1710.java
uitest/src/com/vaadin/tests/tickets/Ticket1737.java
uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java
uitest/src/com/vaadin/tests/tickets/Ticket1868.java
uitest/src/com/vaadin/tests/tickets/Ticket1878.java
uitest/src/com/vaadin/tests/tickets/Ticket1919.java
uitest/src/com/vaadin/tests/tickets/Ticket1923.java
uitest/src/com/vaadin/tests/tickets/Ticket1966.java
uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java
uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java
uitest/src/com/vaadin/tests/tickets/Ticket2009.java
uitest/src/com/vaadin/tests/tickets/Ticket2014.java
uitest/src/com/vaadin/tests/tickets/Ticket2021.java
uitest/src/com/vaadin/tests/tickets/Ticket2029.java
uitest/src/com/vaadin/tests/tickets/Ticket2048.java
uitest/src/com/vaadin/tests/tickets/Ticket2061b.java
uitest/src/com/vaadin/tests/tickets/Ticket2061c.java
uitest/src/com/vaadin/tests/tickets/Ticket2083.java
uitest/src/com/vaadin/tests/tickets/Ticket2157.java
uitest/src/com/vaadin/tests/tickets/Ticket2178.java
uitest/src/com/vaadin/tests/tickets/Ticket2186.java
uitest/src/com/vaadin/tests/tickets/Ticket2215.java
uitest/src/com/vaadin/tests/tickets/Ticket2221.java
uitest/src/com/vaadin/tests/tickets/Ticket2304.java
uitest/src/com/vaadin/tests/tickets/Ticket2310.java
uitest/src/com/vaadin/tests/tickets/Ticket2319.java
uitest/src/com/vaadin/tests/tickets/Ticket2365.java
uitest/src/com/vaadin/tests/tickets/Ticket2425.java
uitest/src/com/vaadin/tests/tickets/Ticket34.java
uitest/src/com/vaadin/tests/tickets/Ticket5157.java
uitest/src/com/vaadin/tests/tickets/Ticket677.java
uitest/src/com/vaadin/tests/tickets/Ticket736.java
uitest/src/com/vaadin/tests/util/SampleDirectory.java
uitest/src/com/vaadin/tests/validation/EmptyFieldErrorIndicators.java

index 521c3e3d27281822f62e9e4dcf773f07b7ea6ea2..b5cfe044072432834b11112240ee71c624f868fd 100644 (file)
@@ -16,8 +16,6 @@
 
 package com.vaadin.ui;
 
-import java.util.Collections;
-import java.util.Iterator;
 import java.util.Map;
 
 import com.vaadin.event.Action;
@@ -41,15 +39,8 @@ import com.vaadin.ui.Component.Focusable;
  * @since 3.0
  */
 @SuppressWarnings("serial")
-public class Panel extends AbstractComponentContainer implements Scrollable,
-        ComponentContainer.ComponentAttachListener,
-        ComponentContainer.ComponentDetachListener, Action.Notifier, Focusable,
-        LegacyComponent {
-
-    /**
-     * Content of the panel.
-     */
-    private ComponentContainer content;
+public class Panel extends AbstractSingleComponentContainer implements
+        Scrollable, Action.Notifier, Focusable, LegacyComponent {
 
     /**
      * Keeps track of the Actions added to this component, and manages the
@@ -122,75 +113,6 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
         super.setCaption(caption);
     }
 
-    /**
-     * Returns the content of the Panel.
-     * 
-     * @return
-     */
-    public ComponentContainer getContent() {
-        return content;
-    }
-
-    /**
-     * 
-     * Set the content of the Panel. If null is given as the new content then a
-     * layout is automatically created and set as the content.
-     * 
-     * @param content
-     *            The new content
-     */
-    public void setContent(ComponentContainer newContent) {
-
-        // If the content is null we create the default content
-        if (newContent == null) {
-            newContent = createDefaultContent();
-        }
-
-        // if (newContent == null) {
-        // throw new IllegalArgumentException("Content cannot be null");
-        // }
-
-        if (newContent == content) {
-            // don't set the same content twice
-            return;
-        }
-
-        // detach old content if present
-        if (content != null) {
-            content.setParent(null);
-            content.removeListener((ComponentContainer.ComponentAttachListener) this);
-            content.removeListener((ComponentContainer.ComponentDetachListener) this);
-        }
-
-        // Sets the panel to be parent for the content
-        newContent.setParent(this);
-
-        // Sets the new content
-        content = newContent;
-
-        // Adds the event listeners for new content
-        newContent
-                .addListener((ComponentContainer.ComponentAttachListener) this);
-        newContent
-                .addListener((ComponentContainer.ComponentDetachListener) this);
-
-        content = newContent;
-        markAsDirty();
-    }
-
-    /**
-     * Create a ComponentContainer which is added by default to the Panel if
-     * user does not specify any content.
-     * 
-     * @return
-     */
-    private ComponentContainer createDefaultContent() {
-        VerticalLayout layout = new VerticalLayout();
-        // Force margins by default
-        layout.setMargin(true);
-        return layout;
-    }
-
     /*
      * (non-Javadoc)
      * 
@@ -204,46 +126,6 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
         }
     }
 
-    /**
-     * Adds the component into this container.
-     * 
-     * @param c
-     *            the component to be added.
-     * @see com.vaadin.ui.AbstractComponentContainer#addComponent(com.vaadin.ui.Component)
-     */
-    @Override
-    public void addComponent(Component c) {
-        content.addComponent(c);
-        // No repaint request is made as we except the underlying container to
-        // request repaints
-    }
-
-    /**
-     * Removes the component from this container.
-     * 
-     * @param c
-     *            The component to be removed.
-     * @see com.vaadin.ui.AbstractComponentContainer#removeComponent(com.vaadin.ui.Component)
-     */
-    @Override
-    public void removeComponent(Component c) {
-        content.removeComponent(c);
-        // No repaint request is made as we except the underlying container to
-        // request repaints
-    }
-
-    /**
-     * Gets the component container iterator for going through all the
-     * components in the container.
-     * 
-     * @return the Iterator of the components inside the container.
-     * @see com.vaadin.ui.ComponentContainer#getComponentIterator()
-     */
-    @Override
-    public Iterator<Component> iterator() {
-        return Collections.singleton((Component) content).iterator();
-    }
-
     /**
      * Called when one or more variables handled by the implementing class are
      * changed.
@@ -251,7 +133,6 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
      * @see com.vaadin.server.VariableOwner#changeVariables(Object, Map)
      */
     @Override
-    @SuppressWarnings("unchecked")
     public void changeVariables(Object source, Map<String, Object> variables) {
         // Get new size
         final Integer newWidth = (Integer) variables.get("width");
@@ -332,47 +213,6 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
         getState().scrollTop = scrollTop;
     }
 
-    /* Documented in superclass */
-    @Override
-    public void replaceComponent(Component oldComponent, Component newComponent) {
-
-        content.replaceComponent(oldComponent, newComponent);
-    }
-
-    /**
-     * A new component is attached to container.
-     * 
-     * @see com.vaadin.ui.ComponentContainer.ComponentAttachListener#componentAttachedToContainer(com.vaadin.ui.ComponentContainer.ComponentAttachEvent)
-     */
-    @Override
-    public void componentAttachedToContainer(ComponentAttachEvent event) {
-        if (event.getContainer() == content) {
-            fireComponentAttachEvent(event.getAttachedComponent());
-        }
-    }
-
-    /**
-     * A component has been detached from container.
-     * 
-     * @see com.vaadin.ui.ComponentContainer.ComponentDetachListener#componentDetachedFromContainer(com.vaadin.ui.ComponentContainer.ComponentDetachEvent)
-     */
-    @Override
-    public void componentDetachedFromContainer(ComponentDetachEvent event) {
-        if (event.getContainer() == content) {
-            fireComponentDetachEvent(event.getDetachedComponent());
-        }
-    }
-
-    /**
-     * Removes all components from this container.
-     * 
-     * @see com.vaadin.ui.ComponentContainer#removeAllComponents()
-     */
-    @Override
-    public void removeAllComponents() {
-        content.removeAllComponents();
-    }
-
     /*
      * ACTIONS
      */
@@ -490,17 +330,6 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
         super.focus();
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.ComponentContainer#getComponentCount()
-     */
-    @Override
-    public int getComponentCount() {
-        // This is so wrong... (#2924)
-        return content.getComponentCount();
-    }
-
     @Override
     protected PanelState getState() {
         return (PanelState) super.getState();
index b09ef1349735b4e5a8c3b82e54892724c57ef3eb..7e9fecbdc59a6dd40117b45e9d7fc9cb07132701 100644 (file)
@@ -105,20 +105,38 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
         setSizeUndefined();
     }
 
-    /*
-     * (non-Javadoc)
+    /**
+     * 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.
      * 
-     * @see com.vaadin.ui.Panel#addComponent(com.vaadin.ui.Component)
+     * @param c
+     *            component to add
+     * 
+     * @deprecated use Window.setContent(Component) instead
      */
-
-    @Override
+    @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.");
         }
-        super.addComponent(c);
+
+        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 ea4cb9564c2e2ef360089048b59fad14e6f32c9e..cb731b803d8411669bb9a2286c540585daa54cd0 100644 (file)
@@ -29,6 +29,7 @@ import com.vaadin.ui.Panel;
 import com.vaadin.ui.PasswordField;
 import com.vaadin.ui.TextField;
 import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
 
 /**
  * This example demonstrates custom layout. All components created here are
@@ -43,8 +44,8 @@ import com.vaadin.ui.Tree;
  * @since 4.0.0
  * 
  */
-public class CustomLayoutDemo extends com.vaadin.server.LegacyApplication implements
-        Listener {
+public class CustomLayoutDemo extends com.vaadin.server.LegacyApplication
+        implements Listener {
 
     private CustomLayout mainLayout = null;
 
@@ -79,9 +80,12 @@ public class CustomLayoutDemo extends com.vaadin.server.LegacyApplication implem
         // Create custom layout, themes/example/layout/mainLayout.html
         mainLayout = new CustomLayout("mainLayout");
         // wrap custom layout inside a panel
+        VerticalLayout customLayoutPanelLayout = new VerticalLayout();
+        customLayoutPanelLayout.setMargin(true);
         final Panel customLayoutPanel = new Panel(
-                "Panel containing custom layout (mainLayout.html)");
-        customLayoutPanel.addComponent(mainLayout);
+                "Panel containing custom layout (mainLayout.html)",
+                customLayoutPanelLayout);
+        customLayoutPanelLayout.addComponent(mainLayout);
 
         // Login components
         mainLayout.addComponent(username, "loginUser");
@@ -135,9 +139,11 @@ public class CustomLayoutDemo extends com.vaadin.server.LegacyApplication implem
      * 
      */
     public void setBody(String customLayout) {
+        VerticalLayout bodyLayout = new VerticalLayout();
+        bodyLayout.setMargin(true);
+        bodyLayout.addComponent(new CustomLayout(customLayout));
+        bodyPanel.setContent(bodyLayout);
         bodyPanel.setCaption(customLayout + ".html");
-        bodyPanel.removeAllComponents();
-        bodyPanel.addComponent(new CustomLayout(customLayout));
     }
 
     /**
index b0492c22c159cccaffdeac16858bc65fc1b6588c..bcbff24acd67937be767e06eda4385fc7af250fa 100644 (file)
@@ -128,9 +128,11 @@ public class LayoutDemo extends com.vaadin.server.LegacyApplication {
     }
 
     private Component getExampleComponent(String caption) {
-        final Panel panel = new Panel();
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        final Panel panel = new Panel(layout);
         panel.setCaption("Panel component " + caption);
-        panel.addComponent(new Label(
+        layout.addComponent(new Label(
                 "Panel is a container for other components, by default it draws a frame around it's "
                         + "extremities and may have a caption to clarify the nature of the contained components' purpose."
                         + " Panel contains an layout where the actual contained components are added, "
index 4dca5d186050276cd2912833ab9043dbd35818c2..1ea02699ce39dc18cf5e897beaa3b84e51b385fe 100644 (file)
@@ -27,7 +27,6 @@ import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinResponse;
 import com.vaadin.server.VaadinServiceSession;
 import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout.MarginHandler;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Link;
 import com.vaadin.ui.Panel;
@@ -78,22 +77,24 @@ public class Parameters extends com.vaadin.server.LegacyApplication implements
         }
 
         // URI
-        final Panel panel1 = new Panel("URI Handler");
+        final VerticalLayout panel1Layout = new VerticalLayout();
+        panel1Layout.setMargin(true);
+        final Panel panel1 = new Panel("URI Handler", panel1Layout);
         context.setCaption("Last URI handler context");
-        panel1.addComponent(context);
+        panel1Layout.addComponent(context);
         relative.setCaption("Last relative URI");
-        panel1.addComponent(relative);
+        panel1Layout.addComponent(relative);
         layout.addComponent(panel1);
 
         params.addContainerProperty("Key", String.class, "");
         params.addContainerProperty("Value", String.class, "");
-        final Panel panel2 = new Panel("Parameter Handler");
+        final VerticalLayout panel2Layout = new VerticalLayout();
+        panel2Layout.setMargin(true);
+        final Panel panel2 = new Panel("Parameter Handler", panel2Layout);
         params.setSizeFull();
-        panel2.setContent(new VerticalLayout());
-        ((MarginHandler) panel2.getContent()).setMargin(true);
 
         params.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID);
-        panel2.addComponent(params);
+        panel2Layout.addComponent(params);
         layout.addComponent(panel2);
 
         // expand parameter panel and its table
index bc8ea14fd735038cc000849df3f2d04afd10beaa..1cfc0d0026058285e328533651ac131fc54e1c62 100644 (file)
@@ -64,32 +64,38 @@ public class RandomLayoutStress extends com.vaadin.server.LegacyApplication {
         setMainWindow(mainWindow);
 
         // Create horizontal ordered layout
+        VerticalLayout panelALayout = new VerticalLayout();
+        panelALayout.setMargin(true);
         final Panel panelA = new Panel(
-                "Panel containing horizontal ordered layout");
+                "Panel containing horizontal ordered layout", panelALayout);
         HorizontalLayout layoutA = new HorizontalLayout();
         // Add 4 random components
         fillLayout(layoutA, componentCountA);
         // Add layout to panel
-        panelA.addComponent(layoutA);
+        panelALayout.addComponent(layoutA);
 
         // Create vertical ordered layout
+        VerticalLayout panelBLayout = new VerticalLayout();
+        panelBLayout.setMargin(true);
         final Panel panelB = new Panel(
-                "Panel containing vertical ordered layout");
+                "Panel containing vertical ordered layout", panelBLayout);
         VerticalLayout layoutB = new VerticalLayout();
         // Add 4 random components
         fillLayout(layoutB, componentCountB);
         // Add layout to panel
-        panelB.addComponent(layoutB);
+        panelBLayout.addComponent(layoutB);
 
         // Create grid layout
         final int gridSize = (int) java.lang.Math.sqrt(componentCountC);
+        VerticalLayout panelGLayout = new VerticalLayout();
+        panelGLayout.setMargin(true);
         final Panel panelG = new Panel("Panel containing grid layout ("
-                + gridSize + " x " + gridSize + ")");
+                + gridSize + " x " + gridSize + ")", panelGLayout);
         GridLayout layoutG = new GridLayout(gridSize, gridSize);
         // Add 12 random components
         fillLayout(layoutG, componentCountC);
         // Add layout to panel
-        panelG.addComponent(layoutG);
+        panelGLayout.addComponent(layoutG);
 
         // Create TabSheet
         final TabSheet tabsheet = new TabSheet();
@@ -108,12 +114,15 @@ public class RandomLayoutStress extends com.vaadin.server.LegacyApplication {
         tabsheet.addTab(layoutG, "Grid layout (4 x 2)", null);
 
         // Create custom layout
-        final Panel panelC = new Panel("Custom layout with style exampleStyle");
+        VerticalLayout panelCLayout = new VerticalLayout();
+        panelCLayout.setMargin(true);
+        final Panel panelC = new Panel("Custom layout with style exampleStyle",
+                panelCLayout);
         final CustomLayout layoutC = new CustomLayout("exampleStyle");
         // Add 4 random components
         fillLayout(layoutC, componentCountD);
         // Add layout to panel
-        panelC.addComponent(layoutC);
+        panelCLayout.addComponent(layoutC);
 
         // Add demo panels (layouts) to main window
         mainWindow.addComponent(panelA);
@@ -157,9 +166,11 @@ public class RandomLayoutStress extends com.vaadin.server.LegacyApplication {
             break;
         case 5:
             // Link
-            result = new Panel();
+            VerticalLayout panelLayout = new VerticalLayout();
+            panelLayout.setMargin(true);
+            result = new Panel(panelLayout);
             result.setCaption("Panel component " + caption);
-            ((Panel) result)
+            panelLayout
                     .addComponent(new Label(
                             "Panel is a container for other components, by default it draws a frame around it's "
                                     + "extremities and may have a caption to clarify the nature of the contained components' purpose."
index 04472be847559f9a0c1b3c92972f8ba80034d21a..d18ce04f64ca1a8f8d4588f42229b39b22f9bddf 100644 (file)
@@ -67,7 +67,7 @@ public class TestBench extends com.vaadin.server.LegacyApplication implements
 
     Tree menu;
 
-    Panel bodyLayout = new Panel();
+    VerticalLayout bodyLayout = new VerticalLayout();
 
     // TODO this could probably be a simple Set
     HashMap<Class<?>, String> itemCaptions = new HashMap<Class<?>, String>();
@@ -208,11 +208,11 @@ public class TestBench extends com.vaadin.server.LegacyApplication implements
 
         mainLayout.addComponent(lo);
 
-        bodyLayout.addStyleName("light");
-        bodyLayout.setSizeFull();
-        bodyLayout.setContent(new VerticalLayout());
+        Panel bodyPanel = new Panel(bodyLayout);
+        bodyPanel.addStyleName("light");
+        bodyPanel.setSizeFull();
 
-        mainLayout.addComponent(bodyLayout);
+        mainLayout.addComponent(bodyPanel);
 
         mainLayout.setSplitPosition(30);
 
index bac83f9504a82126cbfce567fda2577acd1c79f6..a5f7b83c32dd115f98161835cc491f081eb50aef 100644 (file)
@@ -81,9 +81,11 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
         test(main);
         populateLayout(main);
 
-        final Panel panel = new Panel("Panel");
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        final Panel panel = new Panel("Panel", panelLayout);
         test(panel);
-        populateLayout((Layout) panel.getContent());
+        populateLayout(panelLayout);
 
         final TabSheet tabsheet = new TabSheet();
         test(tabsheet);
@@ -124,7 +126,9 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
         final Embedded emb = new Embedded("Embedded " + count++);
         test(layout, emb);
 
-        final Panel panel = new Panel("Panel " + count++);
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        final Panel panel = new Panel("Panel " + count++, panelLayout);
         test(layout, panel);
 
         final Label label = new Label("Label " + count++);
index 1a93de387a71776eab44581c0feb379b19d91d02..d431562c8ea97d4ae74c29750a1e0cffc93f6323 100644 (file)
@@ -19,10 +19,13 @@ import com.vaadin.ui.VerticalLayout;
  */
 public class TestComponentAddAndRecursion extends CustomComponent {
     Panel p;
+    VerticalLayout pl;
     Panel p2;
+    VerticalLayout p2l;
     Label l;
     Label l2;
     Panel p3;
+    VerticalLayout p3l;
 
     public TestComponentAddAndRecursion() {
 
@@ -31,15 +34,21 @@ public class TestComponentAddAndRecursion extends CustomComponent {
 
         l = new Label("A");
         l2 = new Label("B");
-        p = new Panel("p");
-        p.addComponent(l);
-        p.addComponent(l2);
+        pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("p", pl);
+        pl.addComponent(l);
+        pl.addComponent(l2);
         main.addComponent(p);
-        p2 = new Panel("p2");
-        p2.addComponent(l);
+        p2l = new VerticalLayout();
+        p2l.setMargin(true);
+        p2 = new Panel("p2", p2l);
+        p2l.addComponent(l);
         main.addComponent(p2);
-        p3 = new Panel("p3");
-        p2.addComponent(p3);
+        p3l = new VerticalLayout();
+        p3l.setMargin(true);
+        p3 = new Panel("p3", p3l);
+        p2l.addComponent(p3);
 
         Button b = new Button("use gridlayout", new Button.ClickListener() {
 
@@ -67,7 +76,7 @@ public class TestComponentAddAndRecursion extends CustomComponent {
 
             @Override
             public void buttonClick(ClickEvent event) {
-                p2.addComponent(l2);
+                p2l.addComponent(l2);
             }
 
         });
@@ -76,7 +85,7 @@ public class TestComponentAddAndRecursion extends CustomComponent {
 
             @Override
             public void buttonClick(ClickEvent event) {
-                p3.addComponent(p);
+                p3l.addComponent(p);
             }
 
         });
@@ -86,8 +95,8 @@ public class TestComponentAddAndRecursion extends CustomComponent {
             @Override
             public void buttonClick(ClickEvent event) {
                 Label l = new Label("both");
-                p.addComponent(l);
-                p2.addComponent(l);
+                pl.addComponent(l);
+                p2l.addComponent(l);
             }
 
         });
@@ -97,7 +106,7 @@ public class TestComponentAddAndRecursion extends CustomComponent {
             @Override
             public void buttonClick(ClickEvent event) {
                 try {
-                    p3.addComponent(p2);
+                    p3l.addComponent(p2);
                     new Notification("ERROR", "This should have failed",
                             Notification.TYPE_ERROR_MESSAGE).show(Page
                             .getCurrent());
@@ -114,10 +123,11 @@ public class TestComponentAddAndRecursion extends CustomComponent {
 
             @Override
             public void buttonClick(ClickEvent event) {
-                Panel p = new Panel("dynamic");
-                p.addComponent(p2);
+                VerticalLayout layout = new VerticalLayout();
+                Panel p = new Panel("dynamic", layout);
+                layout.addComponent(p2);
                 try {
-                    p3.addComponent(p);
+                    p3l.addComponent(p);
                     new Notification("ERROR", "This should have failed",
                             Notification.TYPE_ERROR_MESSAGE).show(Page
                             .getCurrent());
index 87251c0d65763b6ff330ff77410ab5f1df61ac62..0e03606cd8345816a78d774b4463a7a55abd074c 100644 (file)
@@ -177,21 +177,23 @@ public class TestContainerChanges extends CustomComponent {
                 });
         buttons.addComponent(b);
 
-        Panel p = new Panel("Tree");
+        VerticalLayout pl = createPanelLayout();
+        Panel p = new Panel("Tree", pl);
         p.setStyleName(Reindeer.PANEL_LIGHT);
         h.addComponent(p);
         Tree tree = new Tree("ITEM_CAPTION_MODE_PROPERTY");
         tree.setContainerDataSource(ordered);
         tree.setItemCaptionPropertyId("Asd");
         tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);
-        p.addComponent(tree);
+        pl.addComponent(tree);
         tree = new Tree("ITEM_CAPTION_MODE_ITEM");
         // nonhierarchical container will get wrapped
         tree.setContainerDataSource(ordered);
         tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_ITEM);
-        p.addComponent(tree);
+        pl.addComponent(tree);
 
-        p = new Panel("ComboBox");
+        pl = createPanelLayout();
+        p = new Panel("ComboBox", pl);
         p.setStyleName(Reindeer.PANEL_LIGHT);
         h.addComponent(p);
         ComboBox c = new ComboBox("ITEM_CAPTION_MODE_PROPERTY");
@@ -199,24 +201,31 @@ public class TestContainerChanges extends CustomComponent {
         c.setContainerDataSource(cont);
         c.setItemCaptionPropertyId("Asd");
         c.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_PROPERTY);
-        p.addComponent(c);
+        pl.addComponent(c);
         c = new ComboBox("ITEM_CAPTION_MODE_ITEM");
         c.setImmediate(true);
         c.setContainerDataSource(cont);
         c.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_ITEM);
-        p.addComponent(c);
+        pl.addComponent(c);
 
-        p = new Panel("ListBox");
+        pl = createPanelLayout();
+        p = new Panel("ListBox", pl);
         p.setStyleName(Reindeer.PANEL_LIGHT);
         h.addComponent(p);
         ListSelect l = new ListSelect("ITEM_CAPTION_MODE_PROPERTY");
         l.setContainerDataSource(cont);
         l.setItemCaptionPropertyId("Asd");
         l.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_PROPERTY);
-        p.addComponent(l);
+        pl.addComponent(l);
         l = new ListSelect("ITEM_CAPTION_MODE_ITEM");
         l.setContainerDataSource(cont);
         l.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_ITEM);
-        p.addComponent(l);
+        pl.addComponent(l);
+    }
+
+    private VerticalLayout createPanelLayout() {
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        return pl;
     }
 }
index 1d28a0a1b43811eaa8ed9936cbff2a2448c75fd3..6714a01da1a143f3370eb37215e15a962656c8dd 100644 (file)
@@ -64,25 +64,27 @@ public class TestForBasicApplicationLayout extends CustomComponent {
         final HorizontalSplitPanel sp2 = new HorizontalSplitPanel();
         sp2.setSplitPosition(255, Sizeable.UNITS_PIXELS);
 
-        final Panel p = new Panel("Accordion Panel");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        final Panel p = new Panel("Accordion Panel", pl);
         p.setSizeFull();
 
         tab = new TabSheet();
         tab.setSizeFull();
 
-        final Panel report = new Panel("Monthly Program Runs",
-                new VerticalLayout());
-        final VerticalLayout controls = new VerticalLayout();
+        VerticalLayout reportLayout = new VerticalLayout();
+        final Panel report = new Panel("Monthly Program Runs", reportLayout);
+        final VerticalLayout controls = reportLayout;
         controls.setMargin(true);
         controls.addComponent(new Label("Report tab"));
         controls.addComponent(click);
         controls.addComponent(click2);
-        report.addComponent(controls);
+        reportLayout.addComponent(controls);
         final DateField cal = new DateField();
         cal.setResolution(DateField.RESOLUTION_DAY);
         cal.setLocale(new Locale("en", "US"));
-        report.addComponent(cal);
-        ((VerticalLayout) report.getContent()).setExpandRatio(controls, 1);
+        reportLayout.addComponent(cal);
+        reportLayout.setExpandRatio(controls, 1);
         report.addStyleName(Reindeer.PANEL_LIGHT);
         report.setHeight(100, Sizeable.UNITS_PERCENTAGE);
 
index eb51ba6a5267068d13c08d7d01be978d99dea07d..321025903d7f99dc0614511022f0fa348384a252 100644 (file)
@@ -52,17 +52,18 @@ public class TestForContainerFilterable extends CustomComponent {
         }
 
         // Init filtering view
-        final Panel filterPanel = new Panel("Filter", new HorizontalLayout());
+        final HorizontalLayout filterLayout = new HorizontalLayout();
+        final Panel filterPanel = new Panel("Filter", filterLayout);
         filterPanel.setWidth(100, Panel.UNITS_PERCENTAGE);
         lo.addComponent(filterPanel);
-        filterPanel.addComponent(fooFilter);
-        filterPanel.addComponent(barFilter);
-        filterPanel.addComponent(filterButton);
+        filterLayout.addComponent(fooFilter);
+        filterLayout.addComponent(barFilter);
+        filterLayout.addComponent(filterButton);
         fooFilter
                 .setDescription("Filters foo column in case-sensitive contains manner.");
         barFilter
                 .setDescription("Filters bar column in case-insensitive prefix manner.");
-        filterPanel.addComponent(count);
+        filterLayout.addComponent(count);
 
         // Table
         lo.addComponent(t);
index d01879f769d5a73a465b5cb4de1df1304d71fb33..8e8783e1580a8f119147144ffc76658e3434cc86 100644 (file)
@@ -16,8 +16,6 @@
 
 package com.vaadin.tests;
 
-import com.vaadin.event.Action;
-import com.vaadin.event.Action.Handler;
 import com.vaadin.ui.AbstractSelect;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
@@ -37,8 +35,7 @@ import com.vaadin.ui.VerticalLayout;
 /**
  * @author Vaadin Ltd.
  */
-public class TestForPreconfiguredComponents extends CustomComponent implements
-        Handler {
+public class TestForPreconfiguredComponents extends CustomComponent {
 
     private static final String[] firstnames = new String[] { "John", "Mary",
             "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
@@ -49,13 +46,6 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
 
     private final VerticalLayout main = new VerticalLayout();
 
-    private final Action[] actions = new Action[] { new Action("edit"),
-            new Action("delete") };
-
-    private Panel al;
-
-    private Tree contextTree;
-
     public TestForPreconfiguredComponents() {
 
         setCompositionRoot(main);
@@ -150,25 +140,25 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
     }
 
     public Panel createTestBench(Component t) {
-        final Panel ol = new Panel();
-        ol.setContent(new HorizontalLayout());
+        final HorizontalLayout ol = new HorizontalLayout();
 
         ol.addComponent(t);
 
         final HorizontalLayout ol2 = new HorizontalLayout();
-        final Panel status = new Panel("Events");
+        final VerticalLayout statusLayout = new VerticalLayout();
+        final Panel status = new Panel("Events", statusLayout);
         final Button clear = new Button("clear event log");
-        clear.addListener(new ClickListener() {
+        clear.addClickListener(new ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
-                status.removeAllComponents();
-                status.addComponent(ol2);
+                statusLayout.removeAllComponents();
+                statusLayout.addComponent(ol2);
             }
         });
         ol2.addComponent(clear);
         final Button commit = new Button("commit changes");
         ol2.addComponent(commit);
-        status.addComponent(ol2);
+        statusLayout.addComponent(ol2);
 
         status.setHeight("300px");
         status.setWidth("400px");
@@ -178,29 +168,14 @@ public class TestForPreconfiguredComponents extends CustomComponent implements
         t.addListener(new Listener() {
             @Override
             public void componentEvent(Event event) {
-                status.addComponent(new Label(event.getClass().getName()));
+                statusLayout
+                        .addComponent(new Label(event.getClass().getName()));
                 // TODO should not use Field.toString()
-                status.addComponent(new Label("selected: "
+                statusLayout.addComponent(new Label("selected: "
                         + event.getSource().toString()));
             }
         });
 
-        return ol;
-    }
-
-    @Override
-    public Action[] getActions(Object target, Object sender) {
-        return actions;
-    }
-
-    @Override
-    public void handleAction(Action action, Object sender, Object target) {
-        if (action == actions[1]) {
-            al.addComponent(new Label("Delete selected on " + target));
-            contextTree.removeItem(target);
-
-        } else {
-            al.addComponent(new Label("Edit selected on " + target));
-        }
+        return new Panel(ol);
     }
 }
index 6532d3acc876258b4549477bec17be94f41536ba..cff3ca2420b17af49d9f8cb2a7dc3e1d3ce9b47a 100644 (file)
@@ -56,7 +56,8 @@ public class TestForStyledUpload extends LegacyApplication implements
 
     TmpFileBuffer buffer = new TmpFileBuffer();
 
-    Panel status = new Panel("Uploaded file:");
+    VerticalLayout statusLayout = new VerticalLayout();
+    Panel status = new Panel("Uploaded file:", statusLayout);
 
     private final Upload up;
 
@@ -122,6 +123,7 @@ public class TestForStyledUpload extends LegacyApplication implements
         memoryStatus = new Label();
         main.addComponent(memoryStatus);
 
+        statusLayout.setMargin(true);
         status.setVisible(false);
         main.addComponent(status);
 
@@ -175,21 +177,22 @@ public class TestForStyledUpload extends LegacyApplication implements
 
     @Override
     public void uploadFinished(FinishedEvent event) {
-        status.removeAllComponents();
+        statusLayout.removeAllComponents();
         final InputStream stream = buffer.getStream();
         if (stream == null) {
-            status.addComponent(new Label(
+            statusLayout.addComponent(new Label(
                     "Upload finished, but output buffer is null!!"));
         } else {
-            status.addComponent(new Label(
-                    "<b>Name:</b> " + event.getFilename(), ContentMode.HTML));
-            status.addComponent(new Label("<b>Mimetype:</b> "
+            statusLayout.addComponent(new Label("<b>Name:</b> "
+                    + event.getFilename(), ContentMode.HTML));
+            statusLayout.addComponent(new Label("<b>Mimetype:</b> "
                     + event.getMIMEType(), ContentMode.HTML));
-            status.addComponent(new Label("<b>Size:</b> " + event.getLength()
-                    + " bytes.", ContentMode.HTML));
+            statusLayout.addComponent(new Label("<b>Size:</b> "
+                    + event.getLength() + " bytes.", ContentMode.HTML));
 
-            status.addComponent(new Link("Download " + buffer.getFileName(),
-                    new StreamResource(buffer, buffer.getFileName())));
+            statusLayout.addComponent(new Link("Download "
+                    + buffer.getFileName(), new StreamResource(buffer, buffer
+                    .getFileName())));
 
             status.setVisible(true);
         }
index c0d8ec3845486a79f01c0701aca9ecf4eef8f618..01cd3c2650c5b12afd485efa40071ffdb54fe4b4 100644 (file)
@@ -49,7 +49,7 @@ public class TestForTrees extends CustomComponent implements Handler {
     private final Action[] actions = new Action[] { new Action("edit"),
             new Action("delete") };
 
-    private Panel al;
+    private VerticalLayout al;
 
     private Tree contextTree;
 
@@ -93,8 +93,9 @@ public class TestForTrees extends CustomComponent implements Handler {
         t.setImmediate(true);
         t.addActionHandler(this);
         final AbstractOrderedLayout ol = (AbstractOrderedLayout) createTestBench(t);
-        al = new Panel("action log");
-        ol.addComponent(al);
+        al = new VerticalLayout();
+        al.setMargin(true);
+        ol.addComponent(new Panel("action log", al));
         main.addComponent(ol);
         contextTree = t;
 
@@ -141,16 +142,18 @@ public class TestForTrees extends CustomComponent implements Handler {
 
         ol.addComponent(t);
 
-        final Panel status = new Panel("Events");
+        final VerticalLayout statusLayout = new VerticalLayout();
+        statusLayout.setMargin(true);
+        final Panel status = new Panel("Events", statusLayout);
         final Button clear = new Button("c");
-        clear.addListener(new ClickListener() {
+        clear.addClickListener(new ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
-                status.removeAllComponents();
-                status.addComponent(clear);
+                statusLayout.removeAllComponents();
+                statusLayout.addComponent(clear);
             }
         });
-        status.addComponent(clear);
+        statusLayout.addComponent(clear);
 
         status.setHeight("300px");
         status.setWidth("400px");
@@ -160,9 +163,10 @@ public class TestForTrees extends CustomComponent implements Handler {
         t.addListener(new Listener() {
             @Override
             public void componentEvent(Event event) {
-                status.addComponent(new Label(event.getClass().getName()));
+                statusLayout
+                        .addComponent(new Label(event.getClass().getName()));
                 // TODO should not use Field.toString()
-                status.addComponent(new Label("selected: "
+                statusLayout.addComponent(new Label("selected: "
                         + event.getSource().toString()));
             }
         });
index a78e86a85e29c5c89d22818e5bf205a8e5be5702..e6ac86c213dc0d0e63c68950a279829b060df839 100644 (file)
@@ -59,7 +59,8 @@ public class TestForUpload extends CustomComponent implements
 
     Buffer buffer = new MemoryBuffer();
 
-    Panel status = new Panel("Uploaded file:");
+    VerticalLayout statusLayout = new VerticalLayout();
+    Panel status = new Panel("Uploaded file:", statusLayout);
 
     private final Upload up;
 
@@ -146,24 +147,24 @@ public class TestForUpload extends CustomComponent implements
                     l.setValue("Finished with unknow event");
                 }
 
-                status.removeAllComponents();
+                statusLayout.removeAllComponents();
                 final InputStream stream = buffer.getStream();
                 if (stream == null) {
-                    status.addComponent(new Label(
+                    statusLayout.addComponent(new Label(
                             "Upload finished, but output buffer is null"));
                 } else {
-                    status.addComponent(new Label("<b>Name:</b> "
+                    statusLayout.addComponent(new Label("<b>Name:</b> "
                             + event.getFilename(), ContentMode.HTML));
-                    status.addComponent(new Label("<b>Mimetype:</b> "
+                    statusLayout.addComponent(new Label("<b>Mimetype:</b> "
                             + event.getMIMEType(), ContentMode.HTML));
-                    status.addComponent(new Label("<b>Size:</b> "
+                    statusLayout.addComponent(new Label("<b>Size:</b> "
                             + event.getLength() + " bytes.", ContentMode.HTML));
 
-                    status.addComponent(new Link("Download "
+                    statusLayout.addComponent(new Link("Download "
                             + buffer.getFileName(), new StreamResource(buffer,
                             buffer.getFileName())));
 
-                    status.setVisible(true);
+                    statusLayout.setVisible(true);
                 }
 
                 setBuffer();
@@ -237,6 +238,7 @@ public class TestForUpload extends CustomComponent implements
         memoryStatus = new Label();
         main.addComponent(memoryStatus);
 
+        statusLayout.setMargin(true);
         status.setVisible(false);
         main.addComponent(status);
 
index a4e8d184f4389b8c4336a0bea9b185ab46034dfc..355499117cf029e216a1d29ecad0a57cdd31b71d 100644 (file)
@@ -21,6 +21,7 @@ import java.util.Vector;
 
 import com.vaadin.ui.AbstractOrderedLayout;
 import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
 import com.vaadin.ui.CustomComponent;
 import com.vaadin.ui.DateField;
 import com.vaadin.ui.Panel;
@@ -47,30 +48,32 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent {
         root.addComponent(getSelect());
         root.addComponent(getDateField());
 
-        final Panel p1 = getPanel();
+        final VerticalLayout p1Layout = createPanelLayout();
+        final Panel p1 = getPanel(p1Layout);
+        p1.setContent(p1Layout);
         root.addComponent(p1);
 
-        p1.addComponent(getSelect());
-        p1.addComponent(getDateField());
-        p1.addComponent(getSelect());
-        p1.addComponent(getDateField());
+        p1Layout.addComponent(getSelect());
+        p1Layout.addComponent(getDateField());
+        p1Layout.addComponent(getSelect());
+        p1Layout.addComponent(getDateField());
 
         final AbstractOrderedLayout l1 = getOrderedLayout();
-        p1.addComponent(l1);
+        p1Layout.addComponent(l1);
 
         l1.addComponent(getSelect());
         l1.addComponent(getDateField());
         l1.addComponent(getSelect());
         l1.addComponent(getDateField());
 
-        final Panel p2 = getPanel();
+        final VerticalLayout p2Layout = createPanelLayout();
+        final Panel p2 = getPanel(p2Layout);
         l1.addComponent(p2);
 
-        p2.addComponent(getSelect());
-        p2.addComponent(getDateField());
-        p2.addComponent(getSelect());
-        p2.addComponent(getDateField());
-
+        p2Layout.addComponent(getSelect());
+        p2Layout.addComponent(getDateField());
+        p2Layout.addComponent(getSelect());
+        p2Layout.addComponent(getDateField());
     }
 
     VerticalLayout getOrderedLayout() {
@@ -79,8 +82,14 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent {
         return l;
     }
 
-    Panel getPanel() {
-        final Panel panel = new Panel();
+    private VerticalLayout createPanelLayout() {
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        return layout;
+    }
+
+    Panel getPanel(ComponentContainer content) {
+        final Panel panel = new Panel(content);
         panel.setCaption(getCaption("panel"));
         return panel;
     }
index a50eeafb138572a6460a595bb39bf1c9c3e21f05..8ad0a5da4f7b88695bf5cdbc402445889f7554f2 100644 (file)
@@ -19,11 +19,14 @@ package com.vaadin.tests;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 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.Panel;
+import com.vaadin.ui.VerticalLayout;
 
-public class TestSetVisibleAndCaching extends com.vaadin.server.LegacyApplication {
+public class TestSetVisibleAndCaching extends
+        com.vaadin.server.LegacyApplication {
 
     Panel panelA = new Panel("Panel A");
     Panel panelB = new Panel("Panel B");
@@ -39,12 +42,12 @@ public class TestSetVisibleAndCaching extends com.vaadin.server.LegacyApplicatio
                 "TestSetVisibleAndCaching");
         setMainWindow(mainWindow);
 
-        panelA.addComponent(new Label(
-                "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
-        panelB.addComponent(new Label(
-                "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"));
-        panelC.addComponent(new Label(
-                "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"));
+        panelA.setContent(wrapInPanelLayout(new Label(
+                "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")));
+        panelB.setContent(wrapInPanelLayout(new Label(
+                "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")));
+        panelC.setContent(wrapInPanelLayout(new Label(
+                "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")));
 
         mainWindow
                 .addComponent(new Label(
@@ -73,6 +76,13 @@ public class TestSetVisibleAndCaching extends com.vaadin.server.LegacyApplicatio
 
     }
 
+    private VerticalLayout wrapInPanelLayout(Component component) {
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        layout.addComponent(component);
+        return layout;
+    }
+
     private void selectPanel(int selectedPanel) {
         System.err.println("Selecting panel " + selectedPanel);
         switch (selectedPanel) {
index 7d9cdd86f2c3852ce5dca833f406cd5532e10b41..56ed6d53a4aff7f955f754d1ef24b0bf230ad21e 100644 (file)
@@ -48,6 +48,7 @@ public class TestSizeableIncomponents extends LegacyApplication {
     private ComboBox select;
     private Button prev;
     private Button next;
+    private VerticalLayout testPanelLayout;
     private Panel testPanel;
 
     @Override
@@ -112,11 +113,11 @@ public class TestSizeableIncomponents extends LegacyApplication {
             public void valueChange(ValueChangeEvent event) {
                 Testable t = (Testable) select.getValue();
                 if (t != null) {
-                    testPanel.removeAllComponents();
+                    testPanelLayout.removeAllComponents();
                     try {
                         Component c = t.getComponent();
                         if (c != null) {
-                            testPanel.addComponent(c);
+                            testPanelLayout.addComponent(c);
                         }
                     } catch (InstantiationException e) {
                         // TODO Auto-generated catch block
@@ -129,9 +130,9 @@ public class TestSizeableIncomponents extends LegacyApplication {
             }
         });
 
-        testPanel = new Panel();
+        testPanelLayout = new VerticalLayout();
+        testPanel = new Panel(testPanelLayout);
         testPanel.setSizeFull();
-        testPanel.setContent(new VerticalLayout());
         testPanel.setStyleName("testable");
         main.addComponent(testPanel);
         main.setExpandRatio(testPanel, 1);
@@ -190,12 +191,14 @@ public class TestSizeableIncomponents extends LegacyApplication {
 
                                 Component c = super.getComponent();
 
+                                VerticalLayout pl = new VerticalLayout();
+                                pl.setMargin(true);
                                 Panel p = new Panel(
-                                        "Wrapper panel (400px*400px)");
+                                        "Wrapper panel (400px*400px)", pl);
                                 p.setContent(new VerticalLayout());
                                 p.setWidth("400px");
                                 p.setHeight("400px");
-                                p.addComponent(c);
+                                pl.addComponent(c);
                                 p.addStyleName("testablew");
                                 p.addStyleName("testable");
                                 return p;
index e67ee28b7570f89996b214f2b4ac94e0e1761946..d127095c6fd09f8731c1b466b7d914bf3ff02bf4 100644 (file)
@@ -27,6 +27,7 @@ import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Tree;
 import com.vaadin.ui.Tree.ExpandEvent;
+import com.vaadin.ui.VerticalLayout;
 
 /**
  * Browsable file explorer using Vaadin Tree component. Demonstrates: how to add
@@ -37,8 +38,8 @@ import com.vaadin.ui.Tree.ExpandEvent;
  * @since 4.0.0
  * 
  */
-public class TreeFilesystem extends com.vaadin.server.LegacyApplication implements
-        Tree.ExpandListener {
+public class TreeFilesystem extends com.vaadin.server.LegacyApplication
+        implements Tree.ExpandListener {
 
     // Filesystem explorer panel and it's components
     private final Panel explorerPanel = new Panel("Filesystem explorer");
@@ -54,8 +55,11 @@ public class TreeFilesystem extends com.vaadin.server.LegacyApplication implemen
         main.addComponent(new Label("<h2>Tree demo</h2>", ContentMode.HTML));
 
         // configure file structure panel
+        VerticalLayout explorerLayout = new VerticalLayout();
+        explorerLayout.setMargin(true);
+        explorerPanel.setContent(explorerLayout);
         main.addComponent(explorerPanel);
-        explorerPanel.addComponent(tree);
+        explorerLayout.addComponent(tree);
         explorerPanel.setHeight("400px");
 
         // "this" handles tree's expand event
index f7ca6b1ea2a985ee339b8b3abfd43522742fe04f..00f3b15fd0ef51c2647443f8bfd37e17f13189b7 100644 (file)
@@ -41,8 +41,8 @@ import com.vaadin.ui.VerticalLayout;
  * @since 4.0.0
  * 
  */
-public class TreeFilesystemContainer extends com.vaadin.server.LegacyApplication
-        implements Listener {
+public class TreeFilesystemContainer extends
+        com.vaadin.server.LegacyApplication implements Listener {
 
     // Filesystem explorer panel and it's components
     private final Panel explorerPanel = new Panel("Filesystem explorer");
@@ -70,10 +70,16 @@ public class TreeFilesystemContainer extends com.vaadin.server.LegacyApplication
         main.setExpandRatio(explorerPanel, 1);
 
         // Explorer panel contains tree
-        explorerPanel.addComponent(filesystem);
+        VerticalLayout explorerLayout = new VerticalLayout();
+        explorerLayout.setMargin(true);
+        explorerPanel.setContent(explorerLayout);
+        explorerLayout.addComponent(filesystem);
 
         // Property panel contains label
-        propertyPanel.addComponent(fileProperties);
+        VerticalLayout propertyLayout = new VerticalLayout();
+        propertyLayout.setMargin(true);
+        propertyPanel.setContent(propertyLayout);
+        propertyLayout.addComponent(fileProperties);
         fileProperties.setCaption("No file selected.");
         propertyPanel.setEnabled(false);
 
index b91fd65842931073b16fd6004556e184db701b84..2df65a5b98f1ed6f50dedf6adf2512fa719d6905 100644 (file)
@@ -23,6 +23,7 @@ import com.vaadin.ui.AbstractSelect;
 import com.vaadin.ui.CustomComponent;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
 
 public class UsingCustomNewItemHandlerInSelect extends CustomComponent {
 
@@ -34,8 +35,10 @@ public class UsingCustomNewItemHandlerInSelect extends CustomComponent {
 
     public UsingCustomNewItemHandlerInSelect() {
 
-        final Panel panel = new Panel("Select demo");
-        panel.addComponent(select);
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        final Panel panel = new Panel("Select demo", pl);
+        pl.addComponent(select);
 
         select.setCaption("Select component");
         select.setImmediate(true);
index 4d0c7536cba3d599484338f2b112540223736b92..d38235f001133a26fd4e0c6ef5be948bab09e13e 100644 (file)
@@ -26,6 +26,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
 
 public class UsingObjectsInSelect extends com.vaadin.server.LegacyApplication
         implements ValueChangeListener {
@@ -43,10 +44,14 @@ public class UsingObjectsInSelect extends com.vaadin.server.LegacyApplication
         final LegacyWindow main = new LegacyWindow("Select demo");
         setMainWindow(main);
 
-        final Panel panel = new Panel("Select demo");
-        panel.addComponent(select);
-        final Panel panel2 = new Panel("Selection");
-        panel2.addComponent(selectedTask);
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        final Panel panel = new Panel("Select demo", panelLayout);
+        panelLayout.addComponent(select);
+        VerticalLayout panel2Layout = new VerticalLayout();
+        panel2Layout.setMargin(true);
+        final Panel panel2 = new Panel("Selection", panel2Layout);
+        panel2Layout.addComponent(selectedTask);
 
         select.setCaption("Select component");
         select.addListener(this);
index 9fe13c457a09d91cb8b03c4c96ddd77dcee49d52..dd95ff68423fe7c6b4a227d6004f0517eb92e17d 100644 (file)
@@ -49,7 +49,9 @@ public class CustomComponentwithUndefinedSize extends TestBase {
 
         public Layout buildLayout() {
             VerticalLayout layout = new VerticalLayout();
-            final Panel widePanel = new Panel("too big");
+            VerticalLayout panelLayout = new VerticalLayout();
+            panelLayout.setMargin(true);
+            final Panel widePanel = new Panel("too big", panelLayout);
             widePanel.setSizeUndefined();
             widePanel.setWidth("2000px");
             widePanel.setHeight("200px");
@@ -76,7 +78,7 @@ public class CustomComponentwithUndefinedSize extends TestBase {
 
                         }
                     });
-            widePanel.addComponent(button);
+            panelLayout.addComponent(button);
             layout.setSizeUndefined();
             return layout;
         }
index 6c340804af311ddc4b04b50d006a7ce4345bff38..e80a8801a238f269c88104effde87720df344f32 100644 (file)
@@ -65,12 +65,14 @@ public class TouchScrollables extends TestBase {
         Layout cssLayout = new CssLayout();
         cssLayout.setCaption("Panel");
 
-        final Panel p = new Panel();
+        final VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        final Panel p = new Panel(pl);
         p.setHeight("400px");
         Label l50 = null;
         for (int i = 0; i < 100; i++) {
             Label c = new Label("Label" + i);
-            p.addComponent(c);
+            pl.addComponent(c);
             if (i == 50) {
                 l50 = c;
             }
index 49a4d258bdff5cd21f27b1d7e5f4e466bce3ecdc..b299490d034bb77aec4f5ac228dd473926bb3f9c 100644 (file)
@@ -7,15 +7,18 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class EnableState extends AbstractTestCase {
     @Override
     public void init() {
         LegacyWindow mainWindow = new LegacyWindow("Helloworld Application");
 
-        final Panel panel = new Panel("Test");
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        final Panel panel = new Panel("Test", panelLayout);
         final Button button = new Button("ablebutton");
-        panel.addComponent(button);
+        panelLayout.addComponent(button);
 
         CheckBox enable = new CheckBox("Toggle button enabled", true);
         enable.addListener(new Property.ValueChangeListener() {
index 165827eb6b8d8e3bb7eb3ad0668824daad7c5500..e8261ec183fb37171102d5e03a29a832250a6507 100644 (file)
@@ -11,6 +11,7 @@ import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Form;
 import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class GridLayoutInForm extends TestBase {
 
@@ -37,8 +38,10 @@ public class GridLayoutInForm extends TestBase {
 
         form.setSizeUndefined();
 
-        Panel panel = new Panel();
-        panel.addComponent(form);
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel panel = new Panel(panelLayout);
+        panelLayout.addComponent(form);
         panel.setHeight("500px");
 
         addComponent(panel);
index 6bf08f4ef6373a6067a7dc2a97a8e43772f64b98..9b8fc2884452c4cd92fb6376ace0cfc471f15640 100644 (file)
@@ -42,17 +42,18 @@ public class LabelStyles extends AbstractTestUI {
         if (styleName != null) {
             p.setCaption(styleName);
         }
-        p.setContent(new GridLayout());
+        GridLayout layout = new GridLayout();
+        p.setContent(layout);
         // ((VerticalLayout) p.getContent()).setMargin(false);
         p.setSizeUndefined();
-        p.getContent().setSizeUndefined();
+        layout.setSizeUndefined();
 
         for (int i = 0; i < labels; i++) {
             Label l = new Label("Label " + i);
             if (styleName != null) {
                 l.setStyleName(styleName);
             }
-            p.addComponent(l);
+            layout.addComponent(l);
         }
 
         return p;
index 6f094dc15082ebf82452436e44a4adbb79ce7742..45477b10aaa0b5c2e3e3db44ebaf5f6e2d02f93a 100644 (file)
@@ -106,7 +106,9 @@ public class VerticalLayoutWithEmptyLabel extends AbstractTestUI {
     }
 
     protected Component buildRootSeparator() {
-        Panel panel = new Panel();
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Panel panel = new Panel(layout);
         panel.addStyleName("pexp-separator");
         panel.setWidth("100%");
         panel.setHeight(3.0f, Sizeable.Unit.PIXELS);
index b3eac5c82e4330d5dd8bc51159a08624a74f686a..d9a9c144253fb58786463988256127a94db2946c 100644 (file)
@@ -11,6 +11,7 @@ import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.TextArea;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.Reindeer;
 
 public class BasicPanelTest extends TestBase {
@@ -34,6 +35,10 @@ public class BasicPanelTest extends TestBase {
         actions.addComponent(scrollPosition);
         actions.addComponent(new Button("Sync"));
 
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        panel.setContent(panelLayout);
+
         final CheckBox heightSelection = new CheckBox("Undefined height");
         heightSelection.setImmediate(true);
         heightSelection.addListener(new ValueChangeListener() {
@@ -52,12 +57,12 @@ public class BasicPanelTest extends TestBase {
         panel.setHeight("100%");
         panel.setStyleName(Reindeer.PANEL_LIGHT);
 
-        panel.getContent().setCaption("Content caption");
+        panelLayout.setCaption("Content caption");
 
         TextArea textArea = new TextArea("TextArea caption");
         textArea.setWidth("300px");
         textArea.setHeight("500px");
-        panel.addComponent(textArea);
+        panelLayout.addComponent(textArea);
 
         getLayout().addComponent(actions);
         getLayout().addComponent(panel);
index 40f6d5ea33bd0d0eb16e3efe19f293d02c75e6cf..1dad8d44b05ea94a09d96295c122ed4057e1793d 100644 (file)
@@ -4,12 +4,15 @@ import com.vaadin.event.MouseEvents.ClickEvent;
 import com.vaadin.event.MouseEvents.ClickListener;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class PanelClickListenerRelativeCoordinates extends TestBase {
 
     @Override
     protected void setup() {
-        Panel panel = new Panel("Panel's caption");
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel panel = new Panel("Panel's caption", panelLayout);
         panel.addListener(new ClickListener() {
 
             @Override
index 9235eb3cfcecab7510b4cace42f11ac0d3146638..e05678b7c87ea3ea2eb41ee7dc8e21606397a6ec 100644 (file)
@@ -3,22 +3,25 @@ package com.vaadin.tests.components.panel;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.ComponentContainer;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Notification;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class PanelConcurrentModificationException extends TestBase {
 
-    private final ComponentContainer panel = new Panel();
+    private final VerticalLayout panelLayout = new VerticalLayout();
+    private final Panel panel = new Panel(panelLayout);
 
     @Override
     protected void setup() {
+        panelLayout.setMargin(true);
+
         addComponent(new Button("Click here for exception",
                 new Button.ClickListener() {
                     @Override
                     public void buttonClick(ClickEvent event) {
-                        panel.addComponent(new Label("Label"));
+                        panelLayout.addComponent(new Label("Label"));
                     }
                 }));
         addComponent(new Button("Or click here first",
index 9b0f8beefe139f90f38d0bacb10719d452a22340..15ca0d521ed8c638d65deb031c476a7ea29223ac 100644 (file)
@@ -17,27 +17,30 @@ public class PanelShouldNotScroll extends TestBase {
 
     @Override
     protected void setup() {
-        final Panel p = new Panel(new CssLayout());
+        final CssLayout pl = new CssLayout();
+        final Panel p = new Panel(pl);
         p.setSizeFull();
         p.setHeight("600px");
-        p.addComponent(foo());
+        pl.addComponent(foo());
         addMore = new Button("Add");
         addMore.addListener(new ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
-                p.removeComponent(addMore);
-                p.addComponent(foo());
-                p.addComponent(addMore);
+                pl.removeComponent(addMore);
+                pl.addComponent(foo());
+                pl.addComponent(addMore);
             }
         });
-        p.addComponent(addMore);
+        pl.addComponent(addMore);
         addComponent(p);
         ((VerticalLayout) getMainWindow().getContent()).setSizeFull();
     }
 
     private Component foo() {
-        Panel panel = new Panel();
-        panel.addComponent(new Label(
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Panel panel = new Panel(layout);
+        layout.addComponent(new Label(
                 "fooooooooo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>"
                         + "foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>foo<br/>",
                 ContentMode.HTML));
index 5ca5c5135f5df1e15196a0fc97b6ae049b26c671..d0a86cd67f7c3369ab7f46755eb5e9975738a0ba 100644 (file)
@@ -12,6 +12,7 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 
 public class PanelShouldRemoveActionHandler extends TestBase {
 
@@ -29,8 +30,10 @@ public class PanelShouldRemoveActionHandler extends TestBase {
 
     @Override
     protected void setup() {
-        panel = new Panel("A panel");
-        panel.addComponent(new TextField());
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        panel = new Panel("A panel", layout);
+        layout.addComponent(new TextField());
         Button add = new Button("Add an action handler",
                 new Button.ClickListener() {
 
index 29d93ce86cdba28d9353e7ecd37fbb8da64e6130..2992f1a85cda51fb6b13d6a454a9c03f14efaa8b 100644 (file)
@@ -1,10 +1,9 @@
 package com.vaadin.tests.components.panel;
 
-import com.vaadin.tests.components.AbstractComponentContainerTest;
+import com.vaadin.tests.components.AbstractComponentTest;
 import com.vaadin.ui.Panel;
 
-public class PanelTest<T extends Panel> extends
-        AbstractComponentContainerTest<T> {
+public class PanelTest<T extends Panel> extends AbstractComponentTest<T> {
 
     @SuppressWarnings("unchecked")
     @Override
index 03f4a072b75fbd32969fc22108a89f7d76116a18..9e214e2598b32c587b06a1e05d56a04f7e1077cf 100644 (file)
@@ -75,7 +75,7 @@ public class PopupViewOffScreen extends TestBase {
                         + "'>" + LoremIpsum.get(2000) + "</div>",
                 ContentMode.HTML);
         l.setSizeFull();
-        p.addComponent(l);
+        vl.addComponent(l);
         PopupView pv = new PopupView("Click here to popup", p);
 
         popupViews.add(pv);
index e775bf6aca99225318625916a66b5cb5eb60ed69..ae9ba302c676f7807e0073571cc3666652ff1d6d 100644 (file)
@@ -10,6 +10,7 @@ import com.vaadin.ui.Component;
 import com.vaadin.ui.Notification;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 @SuppressWarnings("serial")
@@ -51,9 +52,11 @@ public class RichTextAreaWithKeyboardShortcuts extends TestBase {
         getLayout().getUI().addActionHandler(actionHandler);
         getLayout().addComponent(createRichTextArea("InMainLayout"));
 
-        Panel panel = new Panel("RTA Panel");
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel panel = new Panel("RTA Panel", panelLayout);
         panel.addActionHandler(actionHandler);
-        panel.getContent().addComponent(createRichTextArea("InPanel"));
+        panelLayout.addComponent(createRichTextArea("InPanel"));
         getLayout().addComponent(panel);
 
         Window w = new Window("SubWindow");
index 08e602241f32c055205569b123e84c0f9c828804..eb1fee145d01c3c3f1d009c32eca0cba7ce9526f 100644 (file)
@@ -6,6 +6,7 @@ import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.HorizontalSplitPanel;
 import com.vaadin.ui.Notification;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.VerticalSplitPanel;
 
 public class SplitPanelSplitterWidth extends TestBase {
@@ -26,10 +27,10 @@ public class SplitPanelSplitterWidth extends TestBase {
         split.setWidth("200px");
         split.setHeight("200px");
         split.setLocked(true);
-        Panel p = new Panel("Left");
+        Panel p = buildPanel("Left");
         p.setSizeFull();
         split.addComponent(p);
-        p = new Panel("Right");
+        p = buildPanel("Right");
         p.setSizeFull();
         split.addComponent(p);
 
@@ -37,10 +38,10 @@ public class SplitPanelSplitterWidth extends TestBase {
         split2.setWidth("200px");
         split2.setHeight("200px");
         split2.setLocked(true);
-        p = new Panel("Top");
+        p = buildPanel("Top");
         p.setSizeFull();
         split2.addComponent(p);
-        p = new Panel("Bottom");
+        p = buildPanel("Bottom");
         p.setSizeFull();
         split2.addComponent(p);
 
@@ -62,4 +63,10 @@ public class SplitPanelSplitterWidth extends TestBase {
         getLayout().addComponent(split2);
 
     }
+
+    private Panel buildPanel(String caption) {
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        return new Panel(caption, pl);
+    }
 }
index 6f4436880a662aaaaec55947cbad84d1656a417c..b1dd628bf283086f9310841880b26a0e0e1b3288 100644 (file)
@@ -7,6 +7,7 @@ import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.HorizontalSplitPanel;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
 
 public class SafariRenderingBugWhiteSpace extends TestBase {
 
@@ -45,7 +46,9 @@ public class SafariRenderingBugWhiteSpace extends TestBase {
 
         split.setFirstComponent(table);
         split.setSplitPosition(100, Sizeable.UNITS_PERCENTAGE);
-        Panel editor = new Panel("Editor");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel editor = new Panel("Editor", pl);
         editor.setSizeFull();
         split.setSecondComponent(editor);
         getLayout().setSizeFull();
index e3867cff9fdac1abc4b99e8896a66f6051f02900..09e34307c02e9d5ed2e183e979aacef156cb71cc 100644 (file)
@@ -10,6 +10,7 @@ import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
 
 public class TabSheetCaptions extends TestBase {
 
@@ -34,14 +35,17 @@ public class TabSheetCaptions extends TestBase {
         final Date date = new Date();
         date.setTime((long) 1000000000000.0);
 
-        panel1 = new Panel("Panel initial caption (should also be tab caption)");
+        VerticalLayout layout1 = new VerticalLayout();
+        layout1.setMargin(true);
+        layout1.setSizeFull();
+        panel1 = new Panel(
+                "Panel initial caption (should also be tab caption)", layout1);
         panel1.setSizeFull();
-        panel1.getContent().setSizeFull();
-        panel1.addComponent(new Label("This is a panel"));
+        layout1.addComponent(new Label("This is a panel"));
         tabSheet.addTab(panel1);
 
         Button button = new Button("Update tab caption");
-        button.addListener(new Button.ClickListener() {
+        button.addClickListener(new Button.ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
                 tabSheet.getTab(panel1).setCaption(
@@ -51,7 +55,7 @@ public class TabSheetCaptions extends TestBase {
         });
 
         Button button2 = new Button("Update panel caption");
-        button2.addListener(new Button.ClickListener() {
+        button2.addClickListener(new Button.ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
                 panel1.setCaption("This is a new panel caption "
index 452384a8e4eae85c1f6a9e51a79a3343ced870b2..4299336f7477a18f21f7c924562715061313610c 100644 (file)
@@ -3,7 +3,6 @@ package com.vaadin.tests.components.textfield;
 import com.vaadin.server.LegacyApplication;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.LegacyWindow;
-import com.vaadin.ui.Panel;
 import com.vaadin.ui.Table;
 import com.vaadin.ui.TextField;
 import com.vaadin.ui.VerticalLayout;
@@ -19,8 +18,6 @@ public class TextFieldInLayoutInTable extends LegacyApplication {
 
         final Table table = new Table();
         table.addContainerProperty("column1", Component.class, null);
-        final Panel panel = new Panel("Panel");
-        ((VerticalLayout) panel.getContent()).setMargin(false);
         VerticalLayout vl = new VerticalLayout();
         final TextField textField = new TextField();
         vl.addComponent(textField);
index 1fa73ccd6d8c694b9427d2beb0435e1ed25abf15..ef378b420a8ec880aea17c4b854492d6771c08b6 100644 (file)
@@ -8,6 +8,7 @@ import com.vaadin.server.ThemeResource;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
 
 public class TreeHorizontalResize extends TestBase {
 
@@ -23,10 +24,12 @@ public class TreeHorizontalResize extends TestBase {
 
     @Override
     protected void setup() {
-        Panel treePanel = new Panel();
+        VerticalLayout treeLayout = new VerticalLayout();
+        treeLayout.setMargin(true);
+        treeLayout.setSizeUndefined();
+        Panel treePanel = new Panel(treeLayout);
         treePanel.setHeight("500px");
         treePanel.setWidth(null);
-        treePanel.getContent().setSizeUndefined();
         addComponent(treePanel);
 
         Tree tree = new Tree();
@@ -35,7 +38,7 @@ public class TreeHorizontalResize extends TestBase {
         for (Iterator<?> it = tree.rootItemIds().iterator(); it.hasNext();) {
             tree.expandItemsRecursively(it.next());
         }
-        treePanel.addComponent(tree);
+        treeLayout.addComponent(tree);
     }
 
     @Override
index b3ab5c2b0178132e3867102eb071342f7882f432..ba128025cd463ad9d13ee43655f5382326399da8 100644 (file)
@@ -7,6 +7,7 @@ import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
 
 public class TreeScrollingOnSelection extends TestBase {
     private static final long serialVersionUID = 4082075610259697145L;
@@ -36,8 +37,10 @@ public class TreeScrollingOnSelection extends TestBase {
         });
         tree.setImmediate(true);
 
-        Panel panel = new Panel();
-        panel.addComponent(tree);
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel panel = new Panel(panelLayout);
+        panelLayout.addComponent(tree);
         panel.setWidth("200px");
         panel.setHeight("300px");
 
index 454fec7eafbc416280fb363d3acaed7b01babf4d..0ef37bf5c4fa550e33b9799a2676d17ed443e955 100644 (file)
@@ -133,8 +133,10 @@ public class LayoutsCssTest extends GridLayout {
      * Helper to create panels for different theme variants...
      */
     private Panel createPanelWith(String caption, String styleName) {
-        Panel panel = new Panel(caption);
-        panel.addComponent(new Label("Some content"));
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel panel = new Panel(caption, panelLayout);
+        panelLayout.addComponent(new Label("Some content"));
         panel.setIcon(new ThemeResource(parent.ICON_URL));
         panel.setComponentError(new UserError("A error message..."));
         panel.setId("layout" + debugIdCounter++);
index 4beec6808511faaf44b6b7429b8c4b6856b088eb..8184d10d85627971a0ddfaa637ec8d14244e3fbf 100644 (file)
@@ -5,6 +5,7 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class ExecuteJavaScript extends AbstractTestCase {
 
@@ -15,8 +16,10 @@ public class ExecuteJavaScript extends AbstractTestCase {
 
         for (final String script : new String[] { "alert('foo');",
                 "window.print()", "document.write('foo')" }) {
-            Panel p = new Panel("Example: " + script);
-            p.addComponent(createScriptButton(script));
+            VerticalLayout pl = new VerticalLayout();
+            pl.setMargin(true);
+            Panel p = new Panel("Example: " + script, pl);
+            pl.addComponent(createScriptButton(script));
             mainWindow.addComponent(p);
         }
 
index 6d0dc74e939e7b42ff6004a62dc7a78a4c5ecc9e..4557ba71cc8d0697747721af461cb97e2e67320e 100644 (file)
@@ -2,18 +2,21 @@ 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 FullSizedWindow extends TestBase {
 
     @Override
     protected void setup() {
-        Window w = new Window("full sized window");
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        Window w = new Window("full sized window", layout);
         w.setSizeFull();
-        w.getContent().setSizeFull();
+        layout.setSizeFull();
         NativeButton b = new NativeButton("A large button");
         b.setSizeFull();
-        w.getContent().addComponent(b);
+        layout.addComponent(b);
         getMainWindow().addWindow(w);
         setTheme("runo");
     }
index c9b0d725bf41e51e34b62a8121a35d76ba2cda3d..12a30cabfcdcccd5d9b5606727245a9a740fbf88 100644 (file)
@@ -75,17 +75,19 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
                     }
                 }));
 
-        Panel panel = new Panel("scrollable panel");
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel panel = new Panel("scrollable panel", panelLayout);
         panel.setHeight(400, Panel.UNITS_PIXELS);
         panel.setScrollLeft(50);
         panel.setScrollTop(50);
-        panel.getContent().setSizeUndefined();
+        panelLayout.setSizeUndefined();
         window.addComponent(l("Spacer", 500, 500));
 
         l2 = null;
         for (int i = 0; i < 10; i++) {
             l2 = l("X" + i);
-            panel.addComponent(l2);
+            panelLayout.addComponent(l2);
         }
 
         final Component x29 = l2;
@@ -97,7 +99,7 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
             l = l("Y" + i);
             horizontalLayout.addComponent(l);
         }
-        panel.addComponent(horizontalLayout);
+        panelLayout.addComponent(horizontalLayout);
         final Component y29 = l;
 
         ((VerticalLayout) getMainWindow().getContent()).addComponent(
index ae3b0f22dfc4558ba7e414381d768fa7d6a91327..2639e257f562de611fd3d78441746c4a0331e41e 100644 (file)
@@ -1,6 +1,7 @@
 package com.vaadin.tests.components.window;
 
 import com.vaadin.tests.components.panel.PanelTest;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 
 public class WindowTest extends PanelTest<Window> {
@@ -12,6 +13,9 @@ public class WindowTest extends PanelTest<Window> {
 
     @Override
     protected void addTestComponent(Window c) {
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        c.setContent(layout);
         getMainWindow().addWindow(c);
         getTestComponents().add(c);
     }
index b399857b3b492e904087904425efb388e5b56ce0..e418116cd5e6d4e81abe65561d40d2454fd43103 100644 (file)
@@ -18,11 +18,13 @@ import com.vaadin.tests.data.bean.Sex;
 import com.vaadin.tests.util.Log;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComponentContainer;
 import com.vaadin.ui.Notification;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Table;
 import com.vaadin.ui.TextArea;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 
 public class BasicPersonForm extends TestBase {
 
@@ -61,7 +63,8 @@ public class BasicPersonForm extends TestBase {
     private class ConfigurationPanel extends Panel {
 
         public ConfigurationPanel() {
-            super("Configuration");
+            super("Configuration", new VerticalLayout());
+            ((VerticalLayout) getContent()).setMargin(true);
             BeanItem<Configuration> bi = new BeanItem<BasicPersonForm.Configuration>(
                     configuration);
             FieldGroup confFieldGroup = new FieldGroup(bi);
@@ -69,7 +72,8 @@ public class BasicPersonForm extends TestBase {
             confFieldGroup.setBuffered(false);
 
             for (Object propertyId : bi.getItemPropertyIds()) {
-                addComponent(confFieldGroup.buildAndBind(propertyId));
+                ((ComponentContainer) getContent()).addComponent(confFieldGroup
+                        .buildAndBind(propertyId));
             }
 
         }
index 45a32dd53aacf1c0c293b3df3804cdb469e07045..d52e38ca407d45e812c0946645db482a37b040d8 100644 (file)
@@ -346,18 +346,22 @@ public class LiferayThemeDemo extends LegacyApplication {
 
         l.addComponent(new Label("Normal Panel", ContentMode.HTML));
 
-        Panel p = new Panel("Normal Panel");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel("Normal Panel", pl);
         p.setHeight("100px");
-        p.addComponent(new Label("Panel content"));
+        pl.addComponent(new Label("Panel content"));
         l.addComponent(p);
 
         l.addComponent(new Label(
                 "Light Style (<code>LiferayTheme.PANEL_LIGHT</code>)",
                 ContentMode.HTML));
 
-        Panel p2 = new Panel("Light Style Panel");
+        VerticalLayout p2l = new VerticalLayout();
+        p2l.setMargin(true);
+        Panel p2 = new Panel("Light Style Panel", p2l);
         p2.setStyleName(LiferayTheme.PANEL_LIGHT);
-        p2.addComponent(new Label("Panel content"));
+        p2l.addComponent(new Label("Panel content"));
         l.addComponent(p2);
 
         return l;
index e119b91b8244f943c8fb64016913934115008c4d..643612d254d12b7a3be95a2c121b7ea7943c4f50 100644 (file)
@@ -38,7 +38,9 @@ public class DeepComponentTrees extends TestBase {
         Label l = new Label(
                 "This is a nice game to guess how many Layouts your FF2 (or any other browser) can deal with. Due to the worldwide attempt to decrease energy consumption, playing this game is only allowed above 60° longitude betwheen August and May (as excess energy consumed by you CPU is used to heat your room). It is considered wise to save all your work before starting the game.");
 
-        root = new Panel("Test box");
+        VerticalLayout rootLayout = new VerticalLayout();
+        rootLayout.setMargin(true);
+        root = new Panel("Test box", rootLayout);
         root.setWidth("600px");
         root.setHeight("200px");
         final Button b = new Button("Go try your luck with " + i + " layouts!");
index e200c40744b8788bff7877c6860a846cef2247d8..524799ab3ca46bfece5c3ab007c495a9863a3295 100644 (file)
@@ -3,8 +3,8 @@ package com.vaadin.tests.layouts;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout.MarginHandler;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class GridLayoutInsidePanel extends TestBase {
 
@@ -26,12 +26,14 @@ public class GridLayoutInsidePanel extends TestBase {
             gl.addComponent(new Label(
                     "A label which defines the size of the GL"));
 
-            Panel p = new Panel("Panel 1");
-            ((MarginHandler) p.getContent()).setMargin(false);
+            VerticalLayout pl = new VerticalLayout();
+            pl.setMargin(true);
+            pl.setSizeUndefined();
+            Panel p = new Panel("Panel 1", pl);
+            pl.setMargin(false);
             p.setSizeUndefined();
-            p.getContent().setSizeUndefined();
 
-            p.addComponent(gl);
+            pl.addComponent(gl);
             addComponent(p);
         }
         {
@@ -41,9 +43,9 @@ public class GridLayoutInsidePanel extends TestBase {
                     "A label which defines the size of the GL"));
 
             Panel p = new Panel("Panel 2", gl);
-            ((MarginHandler) p.getContent()).setMargin(false);
+            gl.setMargin(false);
             p.setSizeUndefined();
-            p.getContent().setSizeUndefined();
+            gl.setSizeUndefined();
 
             addComponent(p);
         }
index 57c6173895e251c5b6858a24d8cb9a0e167e09bf..4e50f0d83b0d547927126cd8d6872808119792ac 100644 (file)
@@ -241,9 +241,10 @@ public class LayoutPerformanceTests extends TestBase {
                 if (wrapped) {
                     Panel panel = new Panel(container);
                     panel.setSizeFull();
-                    container = panel;
+                    setTestLayout(panel);
+                } else {
+                    setTestLayout(container);
                 }
-                setTestLayout(container);
             }
         }));
 
index 69aa1005421fd22a137e357ea033448dae545c47..28f6dfdbc4a2b921622230218d3f5297b89aaa10 100644 (file)
@@ -372,7 +372,9 @@ public class GridLayoutTests extends AbstractLayoutTests {
         row3.setIcon(icons[1]);
 
         glo.replaceComponent(x3, x3 = new CheckBox("CHECKBOX"));
-        glo.replaceComponent(x22, x22 = new Panel("PANEL"));
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        glo.replaceComponent(x22, x22 = new Panel("PANEL", pl));
         x22.setIcon(new ThemeResource(CALENDAR_32_PNG));
 
         x3.setIcon(icons[0]);
@@ -553,7 +555,9 @@ public class GridLayoutTests extends AbstractLayoutTests {
         row3.setCaption("long test caption bewucbwuebco or bmort b cbwecubw wbeucwe asdasd asdasda asdasd");
 
         glo.replaceComponent(x3, x3 = new CheckBox("CHECKBOX"));
-        glo.replaceComponent(x22, x22 = new Panel("PANEL"));
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        glo.replaceComponent(x22, x22 = new Panel("PANEL", pl));
 
         x3.setComponentError(new UserError("component error, user error"));
         x22.setComponentError(new UserError("component error, user error"));
index c1324a075117c420e8fd560601b8b28016dd3c4c..0132a1a0aa7a61a52d4a466df4213f2673a75d9e 100644 (file)
@@ -5,6 +5,7 @@ import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.LiferayTheme;
 
 @Theme("liferay")
@@ -12,14 +13,18 @@ public class LiferayThemeTest extends AbstractTestUI {
 
     @Override
     protected void setup(VaadinRequest request) {
-        Panel p = new Panel("Panel");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel("Panel", pl);
         addComponent(p);
-        p.addComponent(new Label("Panel content"));
+        pl.addComponent(new Label("Panel content"));
 
-        p = new Panel("Light Panel");
+        pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("Light Panel", pl);
         p.addStyleName(LiferayTheme.PANEL_LIGHT);
         addComponent(p);
-        p.addComponent(new Label("Panel content"));
+        pl.addComponent(new Label("Panel content"));
     }
 
     @Override
index 49bdc51b0d2a4ae725f3f053ff6a2397ad768522..40ffd78740bd4032071aac0ec3b2e571d7850825 100644 (file)
@@ -13,6 +13,7 @@ import com.vaadin.ui.Panel;
 import com.vaadin.ui.PopupView;
 import com.vaadin.ui.Table;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 
 public class Ticket1397 extends LegacyApplication {
 
@@ -23,7 +24,9 @@ public class Ticket1397 extends LegacyApplication {
         setTheme("runo");
         main = new LegacyWindow("PopupView test");
         setMainWindow(main);
-        Panel panel = new Panel("PopupTest");
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel panel = new Panel("PopupTest", panelLayout);
 
         // First test component
         final ObjectProperty<String> prop = new ObjectProperty<String>(
@@ -43,12 +46,12 @@ public class Ticket1397 extends LegacyApplication {
 
         PopupView pe = new PopupView(content);
         pe.setDescription("Click to edit");
-        panel.addComponent(pe);
+        panelLayout.addComponent(pe);
 
         // Second test component
         PopupView pe2 = new PopupView("fooLabel", new Label("Foooooooooo..."));
         pe2.setDescription("Click to view");
-        panel.addComponent(pe2);
+        panelLayout.addComponent(pe2);
 
         // Third test component
         final ObjectProperty<StringBuffer> prop2 = new ObjectProperty<StringBuffer>(
@@ -68,8 +71,10 @@ public class Ticket1397 extends LegacyApplication {
             }
         }
 
-        final Panel panel2 = new Panel("Editor with a button");
-        panel2.addComponent(new myButton());
+        VerticalLayout panel2Layout = new VerticalLayout();
+        panel2Layout.setMargin(true);
+        final Panel panel2 = new Panel("Editor with a button", panel2Layout);
+        panel2Layout.addComponent(new myButton());
         PopupView.Content content2 = new PopupView.Content() {
             @Override
             public String getMinimizedValueAsHTML() {
@@ -83,15 +88,18 @@ public class Ticket1397 extends LegacyApplication {
         };
 
         PopupView p3 = new PopupView(content2);
-        panel.addComponent(p3);
+        panelLayout.addComponent(p3);
 
         // Fourth test component
-        final Panel panel3 = new Panel("Editor popup for a property");
+        VerticalLayout panel3Layout = new VerticalLayout();
+        panel3Layout.setMargin(true);
+        final Panel panel3 = new Panel("Editor popup for a property",
+                panel3Layout);
         TextField tf2 = new TextField("TextField for editing a property");
         final ObjectProperty<String> op = new ObjectProperty<String>(
                 "This is property text.");
         tf2.setPropertyDataSource(op);
-        panel3.addComponent(tf2);
+        panel3Layout.addComponent(tf2);
         PopupView.Content content3 = new PopupView.Content() {
 
             @Override
@@ -106,7 +114,7 @@ public class Ticket1397 extends LegacyApplication {
 
         };
         PopupView p4 = new PopupView(content3);
-        panel.addComponent(p4);
+        panelLayout.addComponent(p4);
 
         // Fifth test component
         Table table = new Table("Table for testing purposes");
index 42b6b90c490d9e0d3d76f2f3d8c9f196fa99cf1f..c530db7aec61f06e2810f6b0f962a6b1dd47a987 100644 (file)
@@ -10,7 +10,6 @@ import com.vaadin.ui.CustomComponent;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Layout;
-import com.vaadin.ui.Layout.MarginHandler;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Table;
@@ -52,7 +51,8 @@ public class Ticket1435 extends LegacyApplication {
         HorizontalLayout header = new HorizontalLayout();
 
         // This is where the actual data is put.
-        Panel container = new Panel();
+        VerticalLayout containerLayout = new VerticalLayout();
+        Panel container = new Panel(containerLayout);
 
         // Last known height before the panel was collapsed
         private float lastHeight = -1;
@@ -67,6 +67,8 @@ public class Ticket1435 extends LegacyApplication {
 
             initHeader(labelString);
 
+            containerLayout.setMargin(true);
+
             initContainer();
         }
 
@@ -118,7 +120,7 @@ public class Ticket1435 extends LegacyApplication {
             buttonContainer.addComponent(collapse);
 
             collapse.setStyleName("collapse");
-            collapse.addListener(new Button.ClickListener() {
+            collapse.addClickListener(new Button.ClickListener() {
                 @Override
                 public void buttonClick(Button.ClickEvent event) {
                     if (useWorkaround) {
@@ -144,7 +146,7 @@ public class Ticket1435 extends LegacyApplication {
             });
 
             if (useWorkaround) {
-                expand.addListener(new Button.ClickListener() {
+                expand.addClickListener(new Button.ClickListener() {
 
                     @Override
                     public void buttonClick(ClickEvent event) {
@@ -160,8 +162,8 @@ public class Ticket1435 extends LegacyApplication {
         private void initContainer() {
             container.setStyleName("custompanel");
             container.setSizeFull();
-            ((MarginHandler) container.getContent()).setMargin(false);
-            container.getContent().setSizeFull();
+            containerLayout.setMargin(false);
+            containerLayout.setSizeFull();
             root.addComponent(container);
             root.setExpandRatio(container, 1);
         }
@@ -197,8 +199,8 @@ public class Ticket1435 extends LegacyApplication {
         }
 
         public void setPanelComponent(Component component) {
-            container.removeAllComponents();
-            container.addComponent(component);
+            containerLayout.removeAllComponents();
+            containerLayout.addComponent(component);
         }
     }
 
index 5f36427733344e806d706f91b15b2fe12fdaaf6e..b59b7f8e5e73ae4a24b8fbc9d5c1d9762f0cf41f 100644 (file)
@@ -7,6 +7,7 @@ import com.vaadin.ui.Button;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
 
 /**
  * @author Efecte R&D
@@ -15,18 +16,22 @@ import com.vaadin.ui.Select;
 public class Ticket1506_Panel extends Panel {
 
     public Ticket1506_Panel() {
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        setContent(layout);
+
         ObjectProperty<String> property1 = new ObjectProperty<String>(null,
                 String.class);
-        addComponent(initSelect(new Ticket1506_TestContainer(), "Test select",
-                property1));
-        addComponent(initButton(property1));
-        addComponent(initSelect(new Ticket1506_TestContainer2(),
+        layout.addComponent(initSelect(new Ticket1506_TestContainer(),
+                "Test select", property1));
+        layout.addComponent(initButton(property1));
+        layout.addComponent(initSelect(new Ticket1506_TestContainer2(),
                 "Test select 2", new ObjectProperty<String>(null, String.class)));
     }
 
     private Component initButton(final ObjectProperty<?> property) {
         Button button = new Button("Clear select");
-        button.addListener(new Button.ClickListener() {
+        button.addClickListener(new Button.ClickListener() {
             @Override
             public void buttonClick(Button.ClickEvent event) {
                 property.setValue(null);
index bce5891afa9b6b9aeae6c7da946d925ffbf21a8c..5233a9dd6f24525611602d4f9081e099bd57d48e 100644 (file)
@@ -22,20 +22,19 @@ public class Ticket1572 extends com.vaadin.server.LegacyApplication {
                 .substring(getClass().getName().lastIndexOf(".") + 1));
         setMainWindow(main);
 
-        Panel p = new Panel("Test wrapper for gridlayout margin/spacing");
-
-        p.setContent(new HorizontalLayout());
+        HorizontalLayout pl = new HorizontalLayout();
+        Panel p = new Panel("Test wrapper for gridlayout margin/spacing", pl);
 
         gl = new GridLayout(3, 3);
         gl.setMargin(true);
         for (int i = 0; i < 3 * 3; i++) {
             gl.addComponent(new Button("test"));
         }
-        p.addComponent(gl);
-        p.addComponent(new Label("| next component"));
+        pl.addComponent(gl);
+        pl.addComponent(new Label("| next component"));
 
         Button b = new Button("next margin state");
-        b.addListener(new Button.ClickListener() {
+        b.addClickListener(new Button.ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
                 nextMarginState();
@@ -49,7 +48,7 @@ public class Ticket1572 extends com.vaadin.server.LegacyApplication {
         main.addComponent(b);
 
         Button b2 = new Button("next spacing state");
-        b2.addListener(new Button.ClickListener() {
+        b2.addClickListener(new Button.ClickListener() {
             @Override
             public void buttonClick(ClickEvent event) {
                 nextSpacingState();
index 7115a1c80e2681d6263b31bde3e77ac48f795b9d..e4687b6e3794cd322fbb7e58bbe00181e29ba002 100644 (file)
@@ -122,13 +122,15 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
         cl.addComponent(new Label("<<< Add customlayout testcase here >>>"));
 
         // Form
-        Panel formPanel = new Panel("Form");
+        VerticalLayout formPanelLayout = new VerticalLayout();
+        formPanelLayout.setMargin(true);
+        Panel formPanel = new Panel("Form", formPanelLayout);
         cb = new CheckBox("Form", new MethodProperty<Boolean>(formPanel,
                 "visible"));
         cb.setImmediate(true);
         hidingControls.addComponent(cb);
         formPanel.setVisible(false);
-        formPanel.addComponent(getFormPanelExample());
+        formPanelLayout.addComponent(getFormPanelExample());
         lo.addComponent(formPanel);
 
         for (Iterator<Component> i = hidingControls.getComponentIterator(); i
@@ -250,8 +252,10 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
             setContent(internalLayout);
             testedLayout = layout;
             testPanelLayout.setWidth("100%");
-            Panel controlWrapper = new Panel();
-            controlWrapper.addComponent(controls);
+            VerticalLayout controlWrapperLayout = new VerticalLayout();
+            controlWrapperLayout.setMargin(true);
+            Panel controlWrapper = new Panel(controlWrapperLayout);
+            controlWrapperLayout.addComponent(controls);
             controlWrapper.setWidth("100%");
             controlWrapper.setStyleName("controls");
             internalLayout.addComponent(controlWrapper);
index 4e346d03f369260f7a0f9ef599f11e0e5edd5c4a..c893bc1e340f2a5ada8a7008c4a16648ce93c771 100644 (file)
@@ -34,10 +34,12 @@ public class Ticket1737 extends LegacyApplication {
         VerticalLayout el = new VerticalLayout();
         main.setContent(el);
 
-        Panel p = new Panel("Test panel");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel("Test panel", pl);
         p.setSizeFull();
 
-        p.addComponent(new Label(
+        pl.addComponent(new Label(
                 "Second component is embedded with a slow resource "
                         + "and thus should break layout if Embedded cannot"
                         + " request re-layout after load."));
index 7d37eac5a2af8a4c705954dce08c0dba4b99fcc7..ce083509770557fd6fa25d19b74ec9945e661e6d 100644 (file)
@@ -7,14 +7,17 @@ import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
-public class Ticket1834PanelScrolling extends com.vaadin.server.LegacyApplication {
+public class Ticket1834PanelScrolling extends
+        com.vaadin.server.LegacyApplication {
 
     private static final int ROWS = 50;
 
     private Label state = new Label("State");
 
     private Panel p;
+    private VerticalLayout pl;
 
     @Override
     public void init() {
@@ -55,7 +58,7 @@ public class Ticket1834PanelScrolling extends com.vaadin.server.LegacyApplicatio
 
             @Override
             public void buttonClick(ClickEvent event) {
-                p.addComponent(new Label("new Row" + ++i));
+                pl.addComponent(new Label("new Row" + ++i));
             }
         });
 
@@ -71,10 +74,12 @@ public class Ticket1834PanelScrolling extends com.vaadin.server.LegacyApplicatio
 
         main.addComponent(b);
 
-        p = new Panel("TestPanel");
+        pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("TestPanel", pl);
 
         for (int i = 0; i < ROWS; i++) {
-            p.addComponent(new Label(
+            pl.addComponent(new Label(
                     "Label"
                             + i
                             + "................................................................................................................."));
index 20e63d4c7ce11836db571613e138d378ca3f304f..4cce9188b78066d3a90acd50385e65395ad45bd0 100644 (file)
@@ -2,6 +2,7 @@ package com.vaadin.tests.tickets;
 
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class Ticket1868 extends com.vaadin.server.LegacyApplication {
 
@@ -10,8 +11,11 @@ public class Ticket1868 extends com.vaadin.server.LegacyApplication {
 
         setMainWindow(new LegacyWindow("#1868"));
 
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
         Panel p = new Panel(
-                "This is a really long caption for the panel, too long in fact!");
+                "This is a really long caption for the panel, too long in fact!",
+                pl);
         p.setWidth("300px");
         p.setHeight("300px");
 
index 4a7ef18049ea1c46312cc1d313bbf23360877cb9..6078320b61400c418f36f935ccd58aea10511eba 100644 (file)
@@ -226,15 +226,16 @@ public class Ticket1878 extends LegacyApplication {
         FormLayout formLayout = new FormLayout();
         Form form = new Form(formLayout);
 
-        Panel p = new Panel("Form " + w + "x" + h);
+        VerticalLayout vl = new VerticalLayout();
+        vl.setMargin(true);
+        vl.setSizeFull();
+        Panel p = new Panel("Form " + w + "x" + h, vl);
 
         p.setWidth(w);
         p.setHeight(h);
 
-        p.getContent().setSizeFull();
-
         parentLayout.addComponent(p);
-        p.addComponent(form);
+        vl.addComponent(form);
         formLayout.setSizeFull();
 
         return form;
@@ -258,9 +259,9 @@ public class Ticket1878 extends LegacyApplication {
         createLayout(parentLayout, newLayout, w, h, null, null, align);
     }
 
-    private static void createLayout(GridLayout parentLayout, Layout newLayout,
-            String w, String h, String componentWidth, String componentHeight,
-            boolean align) {
+    private static void createLayout(GridLayout parentLayout,
+            final Layout newLayout, String w, String h, String componentWidth,
+            String componentHeight, boolean align) {
         String dirText = "V";
         String type;
         if (newLayout instanceof VerticalLayout) {
@@ -306,7 +307,7 @@ public class Ticket1878 extends LegacyApplication {
                         tf.setValue(tf.getValue() + " h:" + componentHeight);
                     }
 
-                    p.addComponent(tf);
+                    newLayout.addComponent(tf);
 
                     if (align) {
                         ((AlignmentHandler) newLayout).setComponentAlignment(
index 31e0422ca172a37b21981b261a040bf867981032..086313823e3ea2149ea903ac1cfb8a4048bdc297 100644 (file)
@@ -53,7 +53,7 @@ public class Ticket1919 extends com.vaadin.server.LegacyApplication {
                 toggleStyleName();
             }
         });
-        p.addComponent(b);
+        p.setContent(b);
         return p;
     }
 }
index 949acb628101f28716e07bae67c8703588fb0129..d9c8a34592015d31c9d24f43c1a861c3eb9a06bf 100644 (file)
@@ -17,11 +17,13 @@ public class Ticket1923 extends com.vaadin.server.LegacyApplication {
                 .substring(getClass().getName().lastIndexOf(".") + 1));
         setMainWindow(main);
 
-        p = new Panel("TestPanel 250x300");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("TestPanel 250x300", pl);
         // p.getLayout().setWidth("100%");
         // p.setContent(new GridLayout(1, 100));
         for (int i = 0; i < ROWS; i++) {
-            p.addComponent(new Label(
+            pl.addComponent(new Label(
                     "Label"
                             + i
                             + " 5067w09adsfasdjfahlsdfjhalfjhaldjfhalsjdfhlajdhflajhdfljahdslfjahldsjfhaljdfhaljfdhlajsdhflajshdflkajhsdlfkjahsldfkjahsldfhalskjfdhlksjfdh857idifhaljsdfhlajsdhflajhdflajhdfljahldfjhaljdfhalsjdfhalkjdhflkajhdfljahsdlfjahlsdjfhaldjfhaljfdhlajdhflajshdfljahsdlfjhalsjdfhalskjhfdlhusfglksuhdflgjshflgjhslfghslfjghsljfglsjhfglsjhfgljshfgljshflgjhslfghsljfgsljdfglsdjhfglsjhflgkjshfldjgh"));
@@ -38,40 +40,47 @@ public class Ticket1923 extends com.vaadin.server.LegacyApplication {
         main.addComponent(p);
 
         VerticalLayout ol = new VerticalLayout();
-        p = new Panel("a");
-        p.addComponent(new Label("Longer than caption"));
+        pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("a", pl);
+        pl.addComponent(new Label("Longer than caption"));
         ol.addComponent(p);
 
         main.addComponent(ol);
 
         ol = new VerticalLayout();
-        p = new Panel("captionasdfjahsdjfh this should be clipped god damn it");
+        pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("captionasdfjahsdjfh this should be clipped god damn it",
+                pl);
         // p.getLayout().setSizeFull();
         p.setWidth("50px");
         p.setHeight("100px");
-        p.addComponent(new Label(
+        pl.addComponent(new Label(
                 "aasdfaasdfja dslkfj lakfdj lakjdf lkaj dflkaj ldfkj alsdfj laksdj flkajs dflkj sdfsadfasdfasd"));
         ol.addComponent(p);
 
         main.addComponent(ol);
 
         ol = new VerticalLayout();
-        p = new Panel("300x-1");
+        pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("300x-1", pl);
         // p.getLayout().setSizeFull();
         p.setWidth("300px");
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
-        p.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
+        pl.addComponent(new Label("Short"));
         ol.addComponent(p);
 
         main.addComponent(ol);
index 00d37d1a51d1aa8738ea514ac142e10d3114f74e..2023094458b80e4febf8fd17adf42f9bd990806d 100644 (file)
@@ -34,6 +34,7 @@ public class Ticket1966 extends LegacyApplication {
         layout.addComponent(p);
 
         GridLayout gl = new GridLayout(1, 4);
+        gl.setMargin(true);
         gl.setCaption("Horizontal");
         Button b;
 
@@ -43,11 +44,12 @@ public class Ticket1966 extends LegacyApplication {
 
         addButtons(gl);
 
-        p.addComponent(gl);
+        p.setContent(gl);
 
         /* VERTICAL */
 
         gl = new GridLayout(4, 1);
+        gl.setMargin(true);
         gl.setCaption("Vertical");
 
         addButtons(gl);
@@ -56,7 +58,7 @@ public class Ticket1966 extends LegacyApplication {
         b.setHeight("200px");
         gl.addComponent(b);
 
-        p.addComponent(gl);
+        p.setContent(gl);
 
     }
 
@@ -65,6 +67,7 @@ public class Ticket1966 extends LegacyApplication {
         layout.addComponent(p);
 
         AbstractOrderedLayout ol = new VerticalLayout();
+        ol.setMargin(true);
         ol.setCaption("Horizontal");
         // ol.setWidth("100%");
 
@@ -75,11 +78,12 @@ public class Ticket1966 extends LegacyApplication {
         ol.addComponent(b);
 
         addButtons(ol);
-        p.addComponent(ol);
+        p.setContent(ol);
 
         /* VERTICAL */
 
         ol = new HorizontalLayout();
+        ol.setMargin(true);
         ol.setCaption("Vertical");
 
         addButtons(ol);
@@ -87,7 +91,7 @@ public class Ticket1966 extends LegacyApplication {
         b.setHeight("200px");
         ol.addComponent(b);
 
-        p.addComponent(ol);
+        p.setContent(ol);
 
     }
 
index 0ac7e9e5c5393214bb79c75fe7cd9c3ae62f7b8e..2088e64d9a3de006278013bfd010a1c84c5a05b0 100644 (file)
@@ -49,13 +49,16 @@ public class Ticket1966_2 extends LegacyApplication {
     }
 
     private void gridLayout(Layout layout) {
-        Panel p = new Panel("GridLayout");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel("GridLayout", pl);
         p.setWidth("500px");
         p.setHeight("500px");
-        p.getContent().setSizeFull();
+        pl.setSizeFull();
         layout.addComponent(p);
 
         GridLayout gl = new GridLayout(1, 4);
+        gl.setMargin(true);
         gl.setCaption("Horizontal");
         gl.setWidth("100%");
 
@@ -67,11 +70,12 @@ public class Ticket1966_2 extends LegacyApplication {
 
         addButtons(gl);
 
-        p.addComponent(gl);
+        p.setContent(gl);
 
         /* VERTICAL */
 
         gl = new GridLayout(4, 1);
+        gl.setMargin(true);
         // gl.setCaption("Vertical");
         gl.setHeight("100%");
         addButtons(gl);
@@ -80,41 +84,47 @@ public class Ticket1966_2 extends LegacyApplication {
         // b.setHeight(200);
         // gl.addComponent(b);
 
-        p.addComponent(gl);
+        p.setContent(gl);
 
     }
 
     private void orderedLayout(Layout layout) {
-        Panel p = new Panel("OrderedLayout");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel("OrderedLayout", pl);
         p.setWidth("500px");
         p.setHeight("500px");
-        p.getContent().setWidth("100%");
+        pl.setWidth("100%");
         layout.addComponent(p);
 
         AbstractOrderedLayout ol = new VerticalLayout();
+        ol.setMargin(true);
         // ol.setCaption("Horizontal");
         ol.setWidth("100%");
         addButtons(ol);
-        p.addComponent(ol);
+        pl.addComponent(ol);
 
         /* VERTICAL */
 
         ol = new HorizontalLayout();
+        ol.setMargin(true);
         // ol.setCaption("Vertical");
         ol.setHeight("200px");
         addButtons(ol);
         // Button b = new Button("High button");
         // b.setHeight(200);
         // ol.addComponent(b);
-        p.addComponent(ol);
+        pl.addComponent(ol);
 
     }
 
     private void expandLayout(Layout layout) {
-        Panel p = new Panel("ExpandLayout");
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel p = new Panel("ExpandLayout", panelLayout);
         layout.addComponent(p);
-        p.getContent().setWidth("500");
-        p.getContent().setHeight("400");
+        panelLayout.setWidth("500");
+        panelLayout.setHeight("400");
 
         AbstractOrderedLayout el = new VerticalLayout();
         // el.setCaption("Horizontal");
@@ -130,7 +140,7 @@ public class Ticket1966_2 extends LegacyApplication {
         // el.addComponent(b);
 
         addButtons(el);
-        p.addComponent(el);
+        panelLayout.addComponent(el);
 
         /* VERTICAL */
 
@@ -145,7 +155,7 @@ public class Ticket1966_2 extends LegacyApplication {
         // b.setHeight(100);
         // el.addComponent(b);
 
-        p.addComponent(el);
+        panelLayout.addComponent(el);
 
     }
 
index 6b2103542448093f5331f09b5d9aace4dff79afb..421bea27f960ea14e04e3a6cc877e19a9aeb5c18 100644 (file)
@@ -27,7 +27,7 @@ public class Ticket1966_3 extends LegacyApplication {
         Panel p = new Panel(ol);
         p.setWidth("300px");
         p.setHeight("300px");
-        p.getContent().setSizeFull();
+        ol.setSizeFull();
 
         TextField tf = new TextField("Long caption, longer than 100 pixels");
         tf.setWidth("100px");
index 3efc1d1e1c0a045569234dec7f40dbf3be032b10..b4ef678efe01c14b0c48ffc87af9b87d8f70b83f 100644 (file)
@@ -29,7 +29,9 @@ public class Ticket2009 extends com.vaadin.server.LegacyApplication {
         main.setContent(ol);
         ol.setSizeFull();
 
-        Panel p = new Panel("Tree test");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel("Tree test", pl);
         p.setSizeFull();
 
         Tree t = new Tree();
@@ -52,10 +54,12 @@ public class Ticket2009 extends com.vaadin.server.LegacyApplication {
         });
 
         main.addComponent(p);
-        p.addComponent(t);
-        p.addComponent(events);
+        pl.addComponent(t);
+        pl.addComponent(events);
 
-        Panel p2 = new Panel("Table test (try dbl click also)");
+        VerticalLayout p2l = new VerticalLayout();
+        p2l.setMargin(true);
+        Panel p2 = new Panel("Table test (try dbl click also)", p2l);
         p2.setSizeFull();
 
         final VerticalLayout events2 = new VerticalLayout();
@@ -76,8 +80,8 @@ public class Ticket2009 extends com.vaadin.server.LegacyApplication {
 
             }
         });
-        p2.addComponent(table);
-        p2.addComponent(events2);
+        p2l.addComponent(table);
+        p2l.addComponent(events2);
 
         main.addComponent(p2);
 
index c5f7db21cf477833dc7fbd1f1088d5e4b8f3ae20..7fdd56df677617263a2b293dc47fb4dcb2e207c7 100644 (file)
@@ -10,6 +10,7 @@ import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class Ticket2014 extends LegacyApplication {
 
@@ -43,12 +44,14 @@ public class Ticket2014 extends LegacyApplication {
     }
 
     private void createPanel(GridLayout layout) {
-        panel = new Panel("panel caption");
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        panel = new Panel("panel caption", panelLayout);
         layout.addComponent(panel);
 
         innerLayout1 = new HorizontalLayout();
         innerLayout1.setSpacing(true);
-        panel.addComponent(innerLayout1);
+        panelLayout.addComponent(innerLayout1);
 
         b1 = new Button("Button inside orderedLayout", new ClickListener() {
 
index 938df7befc157692daa3af0bfccd9ab1a3221527..9a736360677a88b25e9217f26f3d37495527258b 100644 (file)
@@ -6,10 +6,10 @@ 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;
-import com.vaadin.ui.Layout.MarginHandler;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.TextArea;
@@ -45,7 +45,7 @@ public class Ticket2021 extends LegacyApplication {
         tf1.setSizeFull();
         tf1.setValue(contents);
         tf1.setCaption("TextField caption");
-        p.getContent().addComponent(tf1);
+        ((ComponentContainer) p.getContent()).addComponent(tf1);
 
         /*
          * 
@@ -66,25 +66,27 @@ public class Ticket2021 extends LegacyApplication {
         tf2.setSizeFull();
         tf2.setValue(contents);
         tf2.setCaption("TextField caption");
-        p2.getContent().addComponent(tf2);
+        ((ComponentContainer) p2.getContent()).addComponent(tf2);
 
         /*
          * 
          * GridLayout
          */
 
-        Panel p3 = new Panel();
+        VerticalLayout p3l = new VerticalLayout();
+        p3l.setMargin(true);
+        Panel p3 = new Panel(p3l);
         p3.setCaption("GridLayout");
         p3.setWidth("500px");
         p3.setHeight("500px");
         // p3.setContent(new GridLayout());
-        p3.getContent().setSizeFull();
-        ((MarginHandler) p3.getContent()).setMargin(false);
+        p3l.setSizeFull();
+        p3l.setMargin(false);
 
         GridLayout gl = new GridLayout();
         gl.setSizeFull();
         gl.setMargin(false);
-        p3.getContent().addComponent(gl);
+        p3l.addComponent(gl);
         w.addComponent(p3);
 
         tf3 = new TextArea();
index db3334d570b77e2c79d137e0045d26476d509577..6c2418c387de920b44e1d9dd7281ed47ce93f8be 100644 (file)
@@ -44,7 +44,7 @@ public class Ticket2029 extends LegacyApplication {
 
         HorizontalLayout layout = new HorizontalLayout();
         p.setContent(layout);
-        p.getContent().setSizeFull();
+        layout.setSizeFull();
 
         for (int i = 0; i < COMPONENTS; i++) {
             TextField tf = new TextField();
@@ -59,7 +59,7 @@ public class Ticket2029 extends LegacyApplication {
             }
             tf.setWidth("100%");
             layout.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-            p.addComponent(tf);
+            layout.addComponent(tf);
 
         }
 
@@ -74,7 +74,7 @@ public class Ticket2029 extends LegacyApplication {
 
         GridLayout layout = new GridLayout(COMPONENTS, 1);
         p.setContent(layout);
-        p.getContent().setSizeFull();
+        layout.setSizeFull();
 
         for (int i = 0; i < COMPONENTS; i++) {
             TextField tf = new TextField();
@@ -99,7 +99,7 @@ public class Ticket2029 extends LegacyApplication {
             }
             tf.setWidth("100%");
             layout.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
-            p.addComponent(tf);
+            layout.addComponent(tf);
 
         }
 
@@ -113,7 +113,7 @@ public class Ticket2029 extends LegacyApplication {
 
         VerticalLayout layout = new VerticalLayout();
         p.setContent(layout);
-        p.getContent().setSizeFull();
+        layout.setSizeFull();
 
         for (int i = 0; i < COMPONENTS; i++) {
             TextArea tf = new TextArea();
@@ -131,7 +131,7 @@ public class Ticket2029 extends LegacyApplication {
             tf.setSizeFull();
 
             layout.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-            p.addComponent(tf);
+            layout.addComponent(tf);
 
         }
 
index b2a6e64cd205a22bbb1d980989e985533e097a20..8fa7c296d06387c2ff8f6479f6dde0fd3d05b476 100644 (file)
@@ -62,7 +62,7 @@ public class Ticket2048 extends LegacyApplication {
         p.setSizeFull();
         Label l = new Label("Spacer");
         l.setHeight("400px");
-        p.addComponent(l);
+        ol.addComponent(l);
 
         embedded = new Embedded(null, new ThemeResource(
                 "icons/64/folder-add.png"));
@@ -81,7 +81,7 @@ public class Ticket2048 extends LegacyApplication {
                     }
 
                 });
-        p.addComponent(b);
+        ol.addComponent(b);
 
         b = new Button("Change image source (is fine)", new ClickListener() {
 
@@ -98,7 +98,7 @@ public class Ticket2048 extends LegacyApplication {
 
         });
 
-        p.addComponent(b);
+        ol.addComponent(b);
         layout.addComponent(p);
     }
 }
index 2246ebec2e77489b5d371de675ba21537861ff38..22c7471282ce8db81dfe383fb0bc5a89df14a7b0 100644 (file)
@@ -41,12 +41,14 @@ public class Ticket2061b extends LegacyApplication implements
         sp.setSizeFull();
         sp.setSplitPosition(20, Sizeable.UNITS_PIXELS);
 
-        p = new Panel("This is a panel");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("This is a panel", pl);
         p.setSizeFull();
         Label label1 = new Label("This is a table!");
         label1.setHeight("1500px");
         label1.setWidth("1500px");
-        p.addComponent(label1);
+        pl.addComponent(label1);
         p.setScrollTop(50);
         // MyTable table1 = new MyTable(24, "table1");
         // table1.loadTable(1000);
@@ -80,17 +82,21 @@ public class Ticket2061b extends LegacyApplication implements
         // sp.addComponent(new Label("Filler"));
         // sp.addComponent(tab);
 
-        p = new Panel("This is a panel");
+        pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("This is a panel", pl);
         p.setWidth("2000px");
         p.setHeight("2000px");
-        Panel p2 = new Panel("This is another panel");
+        VerticalLayout p2l = new VerticalLayout();
+        p2l.setMargin(true);
+        Panel p2 = new Panel("This is another panel", p2l);
         p2.setWidth("2500px");
         p2.setHeight("2500px");
         label1 = new Label("This is a table!");
         label1.setHeight("1500px");
         label1.setWidth("1500px");
-        p2.addComponent(label1);
-        p.addComponent(p2);
+        p2l.addComponent(label1);
+        pl.addComponent(p2);
 
         tab.addTab(p, "Panel with panel", null);
     }
index d4728862446f3a7e9370eaa20e744475526554f9..e6255d71c71632bb47591666cf43f71647f7b25b 100644 (file)
@@ -37,7 +37,9 @@ public class Ticket2061c extends LegacyApplication implements
         VerticalLayout ol2 = new VerticalLayout();
         ol2.setSizeFull();
 
-        p = new Panel("This is a panel");
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        p = new Panel("This is a panel", pl);
         p.setSizeFull();
 
         Label label1 = new Label("This is a table!");
@@ -45,7 +47,7 @@ public class Ticket2061c extends LegacyApplication implements
         label1.setWidth("1500px");
         p.setScrollTop(50);
 
-        p.addComponent(label1);
+        pl.addComponent(label1);
         ol2.addComponent(p);
         ol.addComponent(ol2);
 
index 7d82dcab56a36b8e632f1691c439655ba8fdb77e..a94dafafcb8a430c2a1e837d8b5902c08c965bfd 100644 (file)
@@ -5,6 +5,7 @@ import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class Ticket2083 extends LegacyApplication {
 
@@ -19,10 +20,12 @@ public class Ticket2083 extends LegacyApplication {
     }
 
     private void createUI(GridLayout layout) {
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
         Panel p = new Panel(
-                "This is a panel with a longer caption than it should have");
+                "This is a panel with a longer caption than it should have", pl);
         p.setWidth("100px");
-        p.getContent().addComponent(new Label("Contents"));
+        pl.addComponent(new Label("Contents"));
         layout.addComponent(p);
     }
 }
index 6b2cae773bd1ad634d905290cb42901b805e67f0..89676605ff725f8b8ad16657d8af5980e4eaabf7 100644 (file)
@@ -29,7 +29,7 @@ public class Ticket2157 extends LegacyApplication {
         cb = new ComboBox();
         // cb.setCaption("A combobox");
         // cb.setWidth("100%");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -39,7 +39,7 @@ public class Ticket2157 extends LegacyApplication {
         cb = new ComboBox();
         cb.setCaption("A combobox");
         // cb.setWidth("100px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         //
@@ -50,7 +50,7 @@ public class Ticket2157 extends LegacyApplication {
         cb = new ComboBox();
         // cb.setCaption("A combobox");
         cb.setWidth("100px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -60,7 +60,7 @@ public class Ticket2157 extends LegacyApplication {
         cb = new ComboBox();
         cb.setCaption("A combobox");
         cb.setWidth("100px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -70,7 +70,7 @@ public class Ticket2157 extends LegacyApplication {
         cb = new ComboBox();
         // cb.setCaption("A combobox");
         cb.setWidth("500px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -80,7 +80,7 @@ public class Ticket2157 extends LegacyApplication {
         cb = new ComboBox();
         cb.setCaption("A combobox");
         cb.setWidth("500px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -91,7 +91,7 @@ public class Ticket2157 extends LegacyApplication {
         cb = new ComboBox();
         // cb.setCaption("A combobox");
         cb.setWidth("100%");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -102,7 +102,7 @@ public class Ticket2157 extends LegacyApplication {
         cb = new ComboBox();
         cb.setCaption("A combobox");
         cb.setWidth("100%");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
     }
index 21bb4244caff1b7a1f23ac18bfea9ac2e4e978b7..bae6d7297416dbe6ae77af4df903d7658e68979c 100644 (file)
@@ -29,7 +29,7 @@ public class Ticket2178 extends LegacyApplication {
         cb = new ComboBox();
         // cb.setCaption("A combobox");
         // cb.setWidth("100%");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -39,7 +39,7 @@ public class Ticket2178 extends LegacyApplication {
         cb = new ComboBox();
         cb.setCaption("A combobox");
         // cb.setWidth("100px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -49,7 +49,7 @@ public class Ticket2178 extends LegacyApplication {
         cb = new ComboBox();
         // cb.setCaption("A combobox");
         cb.setWidth("100px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -59,7 +59,7 @@ public class Ticket2178 extends LegacyApplication {
         cb = new ComboBox();
         cb.setCaption("A combobox");
         cb.setWidth("100px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -69,7 +69,7 @@ public class Ticket2178 extends LegacyApplication {
         cb = new ComboBox();
         // cb.setCaption("A combobox");
         cb.setWidth("500px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -79,7 +79,7 @@ public class Ticket2178 extends LegacyApplication {
         cb = new ComboBox();
         cb.setCaption("A combobox");
         cb.setWidth("500px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -91,7 +91,7 @@ public class Ticket2178 extends LegacyApplication {
         // cb.setCaption("A combobox");
         cb.setWidth("100%");
         // cb.setWidth("500px");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
         ol = new VerticalLayout();
@@ -102,7 +102,7 @@ public class Ticket2178 extends LegacyApplication {
         cb = new ComboBox();
         cb.setCaption("A combobox");
         cb.setWidth("100%");
-        p.addComponent(cb);
+        ol.addComponent(cb);
         layout.addComponent(p);
 
     }
index 0f06711a834ff078fdc4b6bf7166cf3bcc631500..8a467d385e1f3c5a56e092730e3c193f40c5be83 100644 (file)
@@ -44,7 +44,7 @@ public class Ticket2186 extends LegacyApplication {
 
         Panel right = new Panel("Panel");
 
-        right.addComponent(new Label("Some basic text might show up here."));
+        right.setContent(new Label("Some basic text might show up here."));
 
         base.addComponent(content);
 
index 387f9465cc89112e288122aa09e2c3dd51078415..42db5d0efbe42415c39a67ba158fcb77e83bbe53 100644 (file)
@@ -14,8 +14,10 @@ public class Ticket2215 extends LegacyApplication {
         setMainWindow(new LegacyWindow());
 
         VerticalLayout ol = new VerticalLayout();
-        Panel p = new Panel("Test");
-        p.addComponent(new Label("Panel1"));
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel("Test", pl);
+        pl.addComponent(new Label("Panel1"));
         p.setHeight("500px");
         p.setWidth("500px");
         p.setStyleName(Reindeer.PANEL_LIGHT);
index 692b5ad86bd95546d0abd1fef6039d0a245f59b6..80aaf55845e25b214d7c777903e8cdc4b9cee703 100644 (file)
@@ -67,22 +67,26 @@ public class Ticket2221 extends LegacyApplication {
             tf.setHeight("1000px");
             tf.setWidth("1000px");
 
-            outerPanel = new Panel();
+            VerticalLayout outerLayout = new VerticalLayout();
+            outerLayout.setMargin(true);
+            outerPanel = new Panel(outerLayout);
             outerPanel.setCaption("A RichTextArea");
             outerPanel.setVisible(false);
             outerPanel.setHeight("1000px");
             outerPanel.setWidth("1000px");
 
-            outerPanel.getContent().setSizeFull();
-            Panel innerPanel = new Panel("Inner panel");
+            outerLayout.setSizeFull();
+            VerticalLayout innerLayout = new VerticalLayout();
+            innerLayout.setMargin(true);
+            Panel innerPanel = new Panel("Inner panel", innerLayout);
             innerPanel.setSizeFull();
-            outerPanel.addComponent(innerPanel);
+            outerLayout.addComponent(innerPanel);
 
             tf2 = new TextField("A 2000x2000 textfield");
             tf2.setWidth("2000px");
             tf2.setHeight("2000px");
 
-            innerPanel.addComponent(tf2);
+            innerLayout.addComponent(tf2);
             main.addComponent(outerPanel);
             main.addComponent(tf);
         }
index 9ddca3d8c836cd16234c81aeb1f8304549f561e8..83e36eaf131dbcd99f5d89045153739cab11b178 100644 (file)
@@ -5,6 +5,7 @@ import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.Reindeer;
 
 public class Ticket2304 extends LegacyApplication {
@@ -15,7 +16,9 @@ public class Ticket2304 extends LegacyApplication {
                 .substring(getClass().getName().lastIndexOf(".") + 1));
         setMainWindow(main);
 
-        Panel p = new Panel();
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel(pl);
         p.setStyleName(Reindeer.PANEL_LIGHT);
         main.addComponent(p);
         p.setHeight("100px");
@@ -23,7 +26,7 @@ public class Ticket2304 extends LegacyApplication {
         Label l = new Label(
                 "a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n");
         l.setContentMode(ContentMode.PREFORMATTED);
-        p.addComponent(l);
+        pl.addComponent(l);
         main.addComponent(new Label(
                 "This text should be right below the panel, w/o spacing"));
     }
index 2a526b9d0c62ccc733c005ec821d9239787f60e7..fb0d399d940bda62527f45da5057822737cabfa9 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.Panel;
+import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.Reindeer;
 
 public class Ticket2310 extends LegacyApplication {
@@ -20,14 +21,16 @@ public class Ticket2310 extends LegacyApplication {
                 + "invisible -> invalid change (with disabled "
                 + "flag) is sent to client. Label is grey when panel is shown."));
 
-        final Panel p = new Panel();
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        final Panel p = new Panel(pl);
         p.setStyleName(Reindeer.PANEL_LIGHT);
         main.addComponent(p);
         p.setHeight("100px");
 
         final Label l = new Label("foobar");
 
-        p.addComponent(l);
+        pl.addComponent(l);
 
         Button b = new Button("change label");
 
index 6534ffe37d0327dd4f94e74f73daf6aa2479d649..fbe1796b3273320c4148dce792cb0779e672c722 100644 (file)
@@ -21,18 +21,18 @@ public class Ticket2319 extends LegacyApplication {
                 "This test has somewhat invalid layouts in it to detect analyzy layout function in debug dialog"));
 
         HorizontalLayout hl = new HorizontalLayout();
-        Panel panel = new Panel("p1");
-        Panel panel2 = new Panel("p2");
+        Panel panel = buildPanel("p1");
+        Panel panel2 = buildPanel("p2");
         hl.addComponent(panel);
         hl.addComponent(panel2);
 
         mainw.addComponent(hl);
 
         hl = new HorizontalLayout();
-        panel = new Panel("p1");
+        panel = buildPanel("p1");
         panel.setSizeUndefined();
         panel.setHeight("100%");
-        panel2 = new Panel("p2");
+        panel2 = buildPanel("p2");
         panel2.setSizeUndefined();
         panel2.setHeight("100%");
 
@@ -63,4 +63,10 @@ public class Ticket2319 extends LegacyApplication {
         mainw.addComponent(new Button("click me to save split panel state"));
     }
 
+    private Panel buildPanel(String caption) {
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        return new Panel(caption, pl);
+    }
+
 }
index 6a9d9e6b1a2eec52ce4a91b0ce74cb89548be64c..b9e96c2f3750f4889eeb26fde2c1fed0a43f084b 100644 (file)
@@ -43,14 +43,18 @@ public class Ticket2365 extends LegacyApplication {
 
     private Panel createMultilevelPanel(int i, Panel panel) {
         if (panel == null) {
-            panel = new Panel("Panel level " + i);
+            VerticalLayout panelLayout = new VerticalLayout();
+            panelLayout.setMargin(true);
+            panel = new Panel("Panel level " + i, panelLayout);
             panel.setSizeFull();
-            panel.getContent().setSizeFull();
+            panelLayout.setSizeFull();
         }
-        Panel p = new Panel("Panel level " + i--);
-        p.getContent().setSizeFull();
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        pl.setSizeFull();
+        Panel p = new Panel("Panel level " + i--, pl);
         p.setSizeFull();
-        panel.addComponent(p);
+        pl.addComponent(p);
         if (i > 0) {
             createMultilevelPanel(i, p);
         }
index 73dee813e286a370c6267230e0d4cf5a44b81d0a..097a91929d0dee316a0e8d31d999ed71f1a02917 100644 (file)
@@ -5,6 +5,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
 
 public class Ticket2425 extends LegacyApplication {
 
@@ -15,10 +16,16 @@ public class Ticket2425 extends LegacyApplication {
 
         w.addComponent(new Label("No scrollbars should be visible anywhere"));
         TabSheet ts = new TabSheet();
-        ts.addTab(new Panel(), "Panel 1", null);
-        ts.addTab(new Panel(), "Panel 2", null);
+        ts.addTab(createPanel(), "Panel 1", null);
+        ts.addTab(createPanel(), "Panel 2", null);
 
         w.addComponent(ts);
     }
 
+    private Panel createPanel() {
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        return new Panel(layout);
+    }
+
 }
index dfeb83987dfd09dd6ec8f39323cd0a0e2eca3b86..920ca76e37971ddf38636ca1c120e4910b3cbbf2 100644 (file)
@@ -66,10 +66,12 @@ public class Ticket34 extends LegacyApplication {
 
     private void buildViews(String[] strings) {
         for (String string : strings) {
-            Panel p = new Panel(string);
+            VerticalLayout pl = new VerticalLayout();
+            pl.setMargin(true);
+            Panel p = new Panel(string, pl);
             p.setSizeFull();
-            ((VerticalLayout) p.getContent()).setSpacing(true);
-            p.addComponent(new Label("This is a simple test case for "
+            pl.setSpacing(true);
+            pl.addComponent(new Label("This is a simple test case for "
                     + "UriFragmentReader that can be used for"
                     + " adding linking, back/forward button "
                     + "and history support for ajax application. "));
@@ -81,14 +83,14 @@ public class Ticket34 extends LegacyApplication {
             }
             sb.append("Application will change to them from uri "
                     + "fragment or server initiated via textfield below.");
-            p.addComponent(new Label(sb.toString()));
+            pl.addComponent(new Label(sb.toString()));
 
             final TextField tf = new TextField(
                     "Type view name (will change to that "
                             + "view and change the uri fragment)");
-            p.addComponent(tf);
+            pl.addComponent(tf);
             Button b = new Button("Go!");
-            p.addComponent(b);
+            pl.addComponent(b);
             b.addListener(new Button.ClickListener() {
 
                 @Override
index 19f367846eebb4665f557884c481be32e836c46b..47cc7e1c4dd0a1faaa29748008205bdd8d5fc386 100644 (file)
@@ -7,6 +7,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 
 /**
  * Key codes were converted to lower case on the server (overlapping special key
@@ -22,14 +23,16 @@ public class Ticket5157 extends LegacyApplication {
                 "Forumtests Application");
         setMainWindow(mainWindow);
 
-        Panel p = new Panel();
+        VerticalLayout pl = new VerticalLayout();
+        pl.setMargin(true);
+        Panel p = new Panel(pl);
         mainWindow.addComponent(p);
 
         Label l = new Label("Panel with F8 bound");
-        p.addComponent(l);
+        pl.addComponent(l);
 
         TextField f = new TextField();
-        p.addComponent(f);
+        pl.addComponent(f);
 
         p.addAction(new ShortcutListener("F8", KeyCode.F8, null) {
 
index e32c25ff480ca7e90332d0d7d41748f40a675bbc..44ec3d10daa240293aa4ae24ae412510641a8f38 100644 (file)
@@ -20,6 +20,7 @@ import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.Table;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
 
 public class Ticket677 extends LegacyApplication {
 
@@ -83,34 +84,43 @@ public class Ticket677 extends LegacyApplication {
             }
         }));
 
-        root.setContent(new GridLayout(2, 3));
+        GridLayout content = new GridLayout(2, 3);
+        root.setContent(content);
         main.addComponent(root);
 
         TextField tf = new TextField("Enabled");
         tf.setImmediate(true);
-        root.addComponent(tf);
+        content.addComponent(tf);
         tf = new TextField("Disabled");
         tf.setImmediate(true);
         tf.setEnabled(false);
-        root.addComponent(tf);
+        content.addComponent(tf);
 
-        root.addComponent(one);
+        VerticalLayout oneLayout = new VerticalLayout();
+        oneLayout.setMargin(true);
+        one.setContent(oneLayout);
+
+        content.addComponent(one);
         tf = new TextField("Enabled");
         tf.setImmediate(true);
-        one.addComponent(tf);
+        oneLayout.addComponent(tf);
         tf = new TextField("Disabled");
         tf.setImmediate(true);
         tf.setEnabled(false);
-        one.addComponent(tf);
+        oneLayout.addComponent(tf);
+
+        VerticalLayout twoLayout = new VerticalLayout();
+        twoLayout.setMargin(true);
+        two.setContent(twoLayout);
 
-        root.addComponent(two);
+        content.addComponent(two);
         tf = new TextField("Enabled");
         tf.setImmediate(true);
-        two.addComponent(tf);
+        twoLayout.addComponent(tf);
         tf = new TextField("Disabled");
         tf.setImmediate(true);
         tf.setEnabled(false);
-        two.addComponent(tf);
+        twoLayout.addComponent(tf);
 
         form = new Form();
         form.setCaption("Enabled");
@@ -126,7 +136,7 @@ public class Ticket677 extends LegacyApplication {
 
         });
         form.setItemDataSource(new BeanItem<MyBean>(new MyBean()));
-        root.addComponent(form);
+        content.addComponent(form);
 
         table = new Table("Enabled");
         table.setPageLength(7);
@@ -154,7 +164,7 @@ public class Ticket677 extends LegacyApplication {
 
         });
         table.setEditable(true);
-        root.addComponent(table);
+        content.addComponent(table);
 
     }
 
index 0c64133f839cd4b20d539600bde05761f9c80be8..6acd43c312e6272a22cbff2b605d058e189a45a1 100644 (file)
@@ -16,6 +16,7 @@ import com.vaadin.ui.Form;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 public class Ticket736 extends LegacyApplication {
 
@@ -75,7 +76,10 @@ public class Ticket736 extends LegacyApplication {
         f.getField("zip").setRequired(true);
 
         // Debug form properties
-        final Panel formProperties = new Panel("Form properties");
+        final VerticalLayout formPropertiesLayout = new VerticalLayout();
+        formPropertiesLayout.setMargin(true);
+        final Panel formProperties = new Panel("Form properties",
+                formPropertiesLayout);
         formProperties.setWidth("200px");
         final String[] visibleProps = { "required", "invalidAllowed",
                 "readOnly", "readThrough", "writeThrough", "invalidCommitted",
@@ -84,7 +88,7 @@ public class Ticket736 extends LegacyApplication {
             CheckBox b = new CheckBox(visibleProps[i],
                     new MethodProperty<Boolean>(f, visibleProps[i]));
             b.setImmediate(true);
-            formProperties.addComponent(b);
+            formPropertiesLayout.addComponent(b);
         }
         mainWin.addComponent(formProperties);
 
index 2f21026118fa03acabf63b550ed8633c12cb1d10..74b5dfe5e84e28800e106a60e10880a56e3fcf2a 100644 (file)
@@ -25,6 +25,7 @@ import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
 
 /**
  * Provides sample directory based on application directory. If this fails then
@@ -77,11 +78,14 @@ public class SampleDirectory {
             return file;
         }
         // Add failure notification as an Panel to main window
-        final Panel errorPanel = new Panel("Demo application error");
+        VerticalLayout errorLayout = new VerticalLayout();
+        errorLayout.setMargin(true);
+        final Panel errorPanel = new Panel("Demo application error",
+                errorLayout);
         errorPanel.setStyleName("strong");
         errorPanel.setComponentError(new SystemError(
                 "Cannot provide sample directory"));
-        errorPanel.addComponent(new Label(errorMessage, ContentMode.HTML));
+        errorLayout.addComponent(new Label(errorMessage, ContentMode.HTML));
         // Remove all components from applications main window
         uI.removeAllComponents();
         // Add error panel
index 379ab2cfcdbb2df89086cfb0a49e605e0f64421a..a62eb62e71275da158ffa3579eaa2d0aa3f57f87 100644 (file)
@@ -8,7 +8,6 @@ import com.vaadin.tests.util.AlwaysFailValidator;
 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.DateField;
 import com.vaadin.ui.Field;
 import com.vaadin.ui.Form;
@@ -31,24 +30,26 @@ public class EmptyFieldErrorIndicators extends TestBase {
         hl.setSizeFull();
         hl.setSpacing(true);
 
-        ComponentContainer part1 = createPart(
-                "Empty required fields validation", true, false);
+        Panel part1 = createPart("Empty required fields validation", true,
+                false);
         part1.setId("emptyFieldPart");
         hl.addComponent(part1);
 
-        ComponentContainer part2 = createPart(
+        Panel part2 = createPart(
                 "Empty required fields with failing validator", true, true);
         part1.setId("validatedFieldPart");
         hl.addComponent(part2);
 
-        Panel panel = new Panel();
+        VerticalLayout panelLayout = new VerticalLayout();
+        panelLayout.setMargin(true);
+        Panel panel = new Panel(panelLayout);
         panel.setSizeFull();
         panel.setStyleName(Reindeer.PANEL_LIGHT);
-        panel.addComponent(hl);
+        panelLayout.addComponent(hl);
         addComponent(panel);
     }
 
-    private ComponentContainer createPart(String caption, boolean required,
+    private Panel createPart(String caption, boolean required,
             boolean failValidator) {
         VerticalLayout part = new VerticalLayout();
         part.setMargin(true);