diff options
author | Henri Sara <hesara@vaadin.com> | 2012-11-14 13:49:47 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2012-11-14 13:49:47 +0200 |
commit | aca92f4937cc54f122b20c4bfb6288ee007c9e47 (patch) | |
tree | 7d7ee8e0cfa760e5f6b1da15ea8fe088f542540f /uitest/src/com | |
parent | 1b7a4a1ee9e03f445cbfcbb520a5ac970ccf47de (diff) | |
download | vaadin-framework-aca92f4937cc54f122b20c4bfb6288ee007c9e47.tar.gz vaadin-framework-aca92f4937cc54f122b20c4bfb6288ee007c9e47.zip |
Panel and Window based on AbstractSingleComponentContainer (#2924)
Change-Id: I9eb1f40a02dcad0f756ad2518d86ef1c52aa69c2
Diffstat (limited to 'uitest/src/com')
91 files changed, 732 insertions, 451 deletions
diff --git a/uitest/src/com/vaadin/tests/CustomLayoutDemo.java b/uitest/src/com/vaadin/tests/CustomLayoutDemo.java index ea4cb9564c..cb731b803d 100644 --- a/uitest/src/com/vaadin/tests/CustomLayoutDemo.java +++ b/uitest/src/com/vaadin/tests/CustomLayoutDemo.java @@ -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)); } /** diff --git a/uitest/src/com/vaadin/tests/LayoutDemo.java b/uitest/src/com/vaadin/tests/LayoutDemo.java index b0492c22c1..bcbff24acd 100644 --- a/uitest/src/com/vaadin/tests/LayoutDemo.java +++ b/uitest/src/com/vaadin/tests/LayoutDemo.java @@ -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, " diff --git a/uitest/src/com/vaadin/tests/Parameters.java b/uitest/src/com/vaadin/tests/Parameters.java index 4dca5d1860..1ea02699ce 100644 --- a/uitest/src/com/vaadin/tests/Parameters.java +++ b/uitest/src/com/vaadin/tests/Parameters.java @@ -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 diff --git a/uitest/src/com/vaadin/tests/RandomLayoutStress.java b/uitest/src/com/vaadin/tests/RandomLayoutStress.java index bc8ea14fd7..1cfc0d0026 100644 --- a/uitest/src/com/vaadin/tests/RandomLayoutStress.java +++ b/uitest/src/com/vaadin/tests/RandomLayoutStress.java @@ -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." diff --git a/uitest/src/com/vaadin/tests/TestBench.java b/uitest/src/com/vaadin/tests/TestBench.java index 04472be847..d18ce04f64 100644 --- a/uitest/src/com/vaadin/tests/TestBench.java +++ b/uitest/src/com/vaadin/tests/TestBench.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/TestCaptionWrapper.java b/uitest/src/com/vaadin/tests/TestCaptionWrapper.java index bac83f9504..a5f7b83c32 100644 --- a/uitest/src/com/vaadin/tests/TestCaptionWrapper.java +++ b/uitest/src/com/vaadin/tests/TestCaptionWrapper.java @@ -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++); diff --git a/uitest/src/com/vaadin/tests/TestComponentAddAndRecursion.java b/uitest/src/com/vaadin/tests/TestComponentAddAndRecursion.java index 1a93de387a..d431562c8e 100644 --- a/uitest/src/com/vaadin/tests/TestComponentAddAndRecursion.java +++ b/uitest/src/com/vaadin/tests/TestComponentAddAndRecursion.java @@ -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()); diff --git a/uitest/src/com/vaadin/tests/TestContainerChanges.java b/uitest/src/com/vaadin/tests/TestContainerChanges.java index 87251c0d65..0e03606cd8 100644 --- a/uitest/src/com/vaadin/tests/TestContainerChanges.java +++ b/uitest/src/com/vaadin/tests/TestContainerChanges.java @@ -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; } } diff --git a/uitest/src/com/vaadin/tests/TestForBasicApplicationLayout.java b/uitest/src/com/vaadin/tests/TestForBasicApplicationLayout.java index 1d28a0a1b4..6714a01da1 100644 --- a/uitest/src/com/vaadin/tests/TestForBasicApplicationLayout.java +++ b/uitest/src/com/vaadin/tests/TestForBasicApplicationLayout.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/TestForContainerFilterable.java b/uitest/src/com/vaadin/tests/TestForContainerFilterable.java index eb51ba6a52..321025903d 100644 --- a/uitest/src/com/vaadin/tests/TestForContainerFilterable.java +++ b/uitest/src/com/vaadin/tests/TestForContainerFilterable.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/TestForPreconfiguredComponents.java b/uitest/src/com/vaadin/tests/TestForPreconfiguredComponents.java index d01879f769..8e8783e158 100644 --- a/uitest/src/com/vaadin/tests/TestForPreconfiguredComponents.java +++ b/uitest/src/com/vaadin/tests/TestForPreconfiguredComponents.java @@ -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); } } diff --git a/uitest/src/com/vaadin/tests/TestForStyledUpload.java b/uitest/src/com/vaadin/tests/TestForStyledUpload.java index 6532d3acc8..cff3ca2420 100644 --- a/uitest/src/com/vaadin/tests/TestForStyledUpload.java +++ b/uitest/src/com/vaadin/tests/TestForStyledUpload.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/TestForTrees.java b/uitest/src/com/vaadin/tests/TestForTrees.java index c0d8ec3845..01cd3c2650 100644 --- a/uitest/src/com/vaadin/tests/TestForTrees.java +++ b/uitest/src/com/vaadin/tests/TestForTrees.java @@ -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())); } }); diff --git a/uitest/src/com/vaadin/tests/TestForUpload.java b/uitest/src/com/vaadin/tests/TestForUpload.java index a78e86a85e..e6ac86c213 100644 --- a/uitest/src/com/vaadin/tests/TestForUpload.java +++ b/uitest/src/com/vaadin/tests/TestForUpload.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java b/uitest/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java index a4e8d184f4..355499117c 100644 --- a/uitest/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java +++ b/uitest/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java @@ -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; } diff --git a/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java b/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java index a50eeafb13..8ad0a5da4f 100644 --- a/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java +++ b/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java @@ -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) { diff --git a/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java b/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java index 7d9cdd86f2..56ed6d53a4 100644 --- a/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java +++ b/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java @@ -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; diff --git a/uitest/src/com/vaadin/tests/TreeFilesystem.java b/uitest/src/com/vaadin/tests/TreeFilesystem.java index e67ee28b75..d127095c6f 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystem.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystem.java @@ -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 diff --git a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java index f7ca6b1ea2..00f3b15fd0 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/UsingCustomNewItemHandlerInSelect.java b/uitest/src/com/vaadin/tests/UsingCustomNewItemHandlerInSelect.java index b91fd65842..2df65a5b98 100644 --- a/uitest/src/com/vaadin/tests/UsingCustomNewItemHandlerInSelect.java +++ b/uitest/src/com/vaadin/tests/UsingCustomNewItemHandlerInSelect.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java b/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java index 4d0c7536cb..d38235f001 100644 --- a/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java +++ b/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java b/uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java index 9fe13c457a..dd95ff6842 100644 --- a/uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java +++ b/uitest/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java @@ -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; } diff --git a/uitest/src/com/vaadin/tests/components/TouchScrollables.java b/uitest/src/com/vaadin/tests/components/TouchScrollables.java index 6c340804af..e80a8801a2 100644 --- a/uitest/src/com/vaadin/tests/components/TouchScrollables.java +++ b/uitest/src/com/vaadin/tests/components/TouchScrollables.java @@ -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; } diff --git a/uitest/src/com/vaadin/tests/components/abstractcomponent/EnableState.java b/uitest/src/com/vaadin/tests/components/abstractcomponent/EnableState.java index 49a4d258bd..b299490d03 100644 --- a/uitest/src/com/vaadin/tests/components/abstractcomponent/EnableState.java +++ b/uitest/src/com/vaadin/tests/components/abstractcomponent/EnableState.java @@ -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() { diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutInForm.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutInForm.java index 165827eb6b..e8261ec183 100644 --- a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutInForm.java +++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutInForm.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/components/label/LabelStyles.java b/uitest/src/com/vaadin/tests/components/label/LabelStyles.java index 6bf08f4ef6..9b8fc28844 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelStyles.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelStyles.java @@ -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; diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWithEmptyLabel.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWithEmptyLabel.java index 6f094dc150..45477b10aa 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWithEmptyLabel.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWithEmptyLabel.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/components/panel/BasicPanelTest.java b/uitest/src/com/vaadin/tests/components/panel/BasicPanelTest.java index b3eac5c82e..d9a9c14425 100644 --- a/uitest/src/com/vaadin/tests/components/panel/BasicPanelTest.java +++ b/uitest/src/com/vaadin/tests/components/panel/BasicPanelTest.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.java b/uitest/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.java index 40f6d5ea33..1dad8d44b0 100644 --- a/uitest/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.java +++ b/uitest/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.java @@ -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 diff --git a/uitest/src/com/vaadin/tests/components/panel/PanelConcurrentModificationException.java b/uitest/src/com/vaadin/tests/components/panel/PanelConcurrentModificationException.java index 9235eb3cfc..e05678b7c8 100644 --- a/uitest/src/com/vaadin/tests/components/panel/PanelConcurrentModificationException.java +++ b/uitest/src/com/vaadin/tests/components/panel/PanelConcurrentModificationException.java @@ -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", diff --git a/uitest/src/com/vaadin/tests/components/panel/PanelShouldNotScroll.java b/uitest/src/com/vaadin/tests/components/panel/PanelShouldNotScroll.java index 9b0f8beefe..15ca0d521e 100644 --- a/uitest/src/com/vaadin/tests/components/panel/PanelShouldNotScroll.java +++ b/uitest/src/com/vaadin/tests/components/panel/PanelShouldNotScroll.java @@ -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)); diff --git a/uitest/src/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java b/uitest/src/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java index 5ca5c5135f..d0a86cd67f 100644 --- a/uitest/src/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java +++ b/uitest/src/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java @@ -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() { diff --git a/uitest/src/com/vaadin/tests/components/panel/PanelTest.java b/uitest/src/com/vaadin/tests/components/panel/PanelTest.java index 29d93ce86c..2992f1a85c 100644 --- a/uitest/src/com/vaadin/tests/components/panel/PanelTest.java +++ b/uitest/src/com/vaadin/tests/components/panel/PanelTest.java @@ -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 diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.java index 03f4a072b7..9e214e2598 100644 --- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.java +++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java index e775bf6aca..ae9ba302c6 100644 --- a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java @@ -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"); diff --git a/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java index 08e602241f..eb1fee145d 100644 --- a/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java +++ b/uitest/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java @@ -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); + } } diff --git a/uitest/src/com/vaadin/tests/components/table/SafariRenderingBugWhiteSpace.java b/uitest/src/com/vaadin/tests/components/table/SafariRenderingBugWhiteSpace.java index 6f4436880a..b1dd628bf2 100644 --- a/uitest/src/com/vaadin/tests/components/table/SafariRenderingBugWhiteSpace.java +++ b/uitest/src/com/vaadin/tests/components/table/SafariRenderingBugWhiteSpace.java @@ -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(); diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java index e3867cff9f..09e34307c0 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java @@ -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 " diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java index 452384a8e4..4299336f74 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java b/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java index 1fa73ccd6d..ef378b420a 100644 --- a/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java +++ b/uitest/src/com/vaadin/tests/components/tree/TreeHorizontalResize.java @@ -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 diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java index b3ab5c2b01..ba128025cd 100644 --- a/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java +++ b/uitest/src/com/vaadin/tests/components/tree/TreeScrollingOnSelection.java @@ -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"); diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/LayoutsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/LayoutsCssTest.java index 454fec7eaf..0ef37bf5c4 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/components/LayoutsCssTest.java +++ b/uitest/src/com/vaadin/tests/components/uitest/components/LayoutsCssTest.java @@ -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++); diff --git a/uitest/src/com/vaadin/tests/components/window/ExecuteJavaScript.java b/uitest/src/com/vaadin/tests/components/window/ExecuteJavaScript.java index 4beec68085..8184d10d85 100644 --- a/uitest/src/com/vaadin/tests/components/window/ExecuteJavaScript.java +++ b/uitest/src/com/vaadin/tests/components/window/ExecuteJavaScript.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/components/window/FullSizedWindow.java b/uitest/src/com/vaadin/tests/components/window/FullSizedWindow.java index 6d0dc74e93..4557ba71cc 100644 --- a/uitest/src/com/vaadin/tests/components/window/FullSizedWindow.java +++ b/uitest/src/com/vaadin/tests/components/window/FullSizedWindow.java @@ -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"); } diff --git a/uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java b/uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java index c9b0d725bf..12a30cabfc 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java @@ -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( diff --git a/uitest/src/com/vaadin/tests/components/window/WindowTest.java b/uitest/src/com/vaadin/tests/components/window/WindowTest.java index ae3b0f22df..2639e257f5 100644 --- a/uitest/src/com/vaadin/tests/components/window/WindowTest.java +++ b/uitest/src/com/vaadin/tests/components/window/WindowTest.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java b/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java index b399857b3b..e418116cd5 100644 --- a/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java +++ b/uitest/src/com/vaadin/tests/fieldgroup/BasicPersonForm.java @@ -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)); } } diff --git a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java index 45a32dd53a..d52e38ca40 100644 --- a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java +++ b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java @@ -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; diff --git a/uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java b/uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java index e119b91b82..643612d254 100644 --- a/uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java +++ b/uitest/src/com/vaadin/tests/layouts/DeepComponentTrees.java @@ -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!"); diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java index e200c40744..524799ab3c 100644 --- a/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java +++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java b/uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java index 57c6173895..4e50f0d83b 100644 --- a/uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java +++ b/uitest/src/com/vaadin/tests/layouts/LayoutPerformanceTests.java @@ -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); } })); diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java index 69aa100542..28f6dfdbc4 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java @@ -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")); diff --git a/uitest/src/com/vaadin/tests/themes/LiferayThemeTest.java b/uitest/src/com/vaadin/tests/themes/LiferayThemeTest.java index c1324a0751..0132a1a0aa 100644 --- a/uitest/src/com/vaadin/tests/themes/LiferayThemeTest.java +++ b/uitest/src/com/vaadin/tests/themes/LiferayThemeTest.java @@ -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 diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1397.java b/uitest/src/com/vaadin/tests/tickets/Ticket1397.java index 49bdc51b0d..40ffd78740 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1397.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1397.java @@ -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"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1435.java b/uitest/src/com/vaadin/tests/tickets/Ticket1435.java index 42b6b90c49..c530db7aec 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1435.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1435.java @@ -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); } } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java b/uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java index 5f36427733..b59b7f8e5e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1572.java b/uitest/src/com/vaadin/tests/tickets/Ticket1572.java index bce5891afa..5233a9dd6f 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1572.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1572.java @@ -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(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1710.java b/uitest/src/com/vaadin/tests/tickets/Ticket1710.java index 7115a1c80e..e4687b6e37 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1710.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1710.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1737.java b/uitest/src/com/vaadin/tests/tickets/Ticket1737.java index 4e346d03f3..c893bc1e34 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1737.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1737.java @@ -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.")); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java b/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java index 7d37eac5a2..ce08350977 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java @@ -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 + ".................................................................................................................")); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1868.java b/uitest/src/com/vaadin/tests/tickets/Ticket1868.java index 20e63d4c7c..4cce9188b7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1868.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1868.java @@ -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"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1878.java b/uitest/src/com/vaadin/tests/tickets/Ticket1878.java index 4a7ef18049..6078320b61 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1878.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1878.java @@ -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( diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1919.java b/uitest/src/com/vaadin/tests/tickets/Ticket1919.java index 31e0422ca1..086313823e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1919.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1919.java @@ -53,7 +53,7 @@ public class Ticket1919 extends com.vaadin.server.LegacyApplication { toggleStyleName(); } }); - p.addComponent(b); + p.setContent(b); return p; } } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1923.java b/uitest/src/com/vaadin/tests/tickets/Ticket1923.java index 949acb6281..d9c8a34592 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1923.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1923.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966.java index 00d37d1a51..2023094458 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java index 0ac7e9e5c5..2088e64d9a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java index 6b21035424..421bea27f9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java @@ -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"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java index 3efc1d1e1c..b4ef678efe 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2014.java b/uitest/src/com/vaadin/tests/tickets/Ticket2014.java index c5f7db21cf..7fdd56df67 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2014.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2014.java @@ -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() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2021.java b/uitest/src/com/vaadin/tests/tickets/Ticket2021.java index 938df7befc..9a73636067 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2021.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2021.java @@ -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(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2029.java b/uitest/src/com/vaadin/tests/tickets/Ticket2029.java index db3334d570..6c2418c387 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2029.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2029.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2048.java b/uitest/src/com/vaadin/tests/tickets/Ticket2048.java index b2a6e64cd2..8fa7c296d0 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2048.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2048.java @@ -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); } } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java b/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java index 2246ebec2e..22c7471282 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java b/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java index d472886244..e6255d71c7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2083.java b/uitest/src/com/vaadin/tests/tickets/Ticket2083.java index 7d82dcab56..a94dafafcb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2083.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2083.java @@ -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); } } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2157.java b/uitest/src/com/vaadin/tests/tickets/Ticket2157.java index 6b2cae773b..89676605ff 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2157.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2157.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2178.java b/uitest/src/com/vaadin/tests/tickets/Ticket2178.java index 21bb4244ca..bae6d72974 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2178.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2178.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2186.java b/uitest/src/com/vaadin/tests/tickets/Ticket2186.java index 0f06711a83..8a467d385e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2186.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2186.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2215.java b/uitest/src/com/vaadin/tests/tickets/Ticket2215.java index 387f9465cc..42db5d0efb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2215.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2215.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2221.java b/uitest/src/com/vaadin/tests/tickets/Ticket2221.java index 692b5ad86b..80aaf55845 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2221.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2221.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2304.java b/uitest/src/com/vaadin/tests/tickets/Ticket2304.java index 9ddca3d8c8..83e36eaf13 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2304.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2304.java @@ -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")); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2310.java b/uitest/src/com/vaadin/tests/tickets/Ticket2310.java index 2a526b9d0c..fb0d399d94 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2310.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2310.java @@ -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"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2319.java b/uitest/src/com/vaadin/tests/tickets/Ticket2319.java index 6534ffe37d..fbe1796b32 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2319.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2319.java @@ -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); + } + } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2365.java b/uitest/src/com/vaadin/tests/tickets/Ticket2365.java index 6a9d9e6b1a..b9e96c2f37 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2365.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2365.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2425.java b/uitest/src/com/vaadin/tests/tickets/Ticket2425.java index 73dee813e2..097a91929d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2425.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2425.java @@ -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); + } + } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket34.java b/uitest/src/com/vaadin/tests/tickets/Ticket34.java index dfeb83987d..920ca76e37 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket34.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket34.java @@ -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 diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket5157.java b/uitest/src/com/vaadin/tests/tickets/Ticket5157.java index 19f367846e..47cc7e1c4d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket5157.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket5157.java @@ -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) { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket677.java b/uitest/src/com/vaadin/tests/tickets/Ticket677.java index e32c25ff48..44ec3d10da 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket677.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket677.java @@ -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); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket736.java b/uitest/src/com/vaadin/tests/tickets/Ticket736.java index 0c64133f83..6acd43c312 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket736.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket736.java @@ -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); diff --git a/uitest/src/com/vaadin/tests/util/SampleDirectory.java b/uitest/src/com/vaadin/tests/util/SampleDirectory.java index 2f21026118..74b5dfe5e8 100644 --- a/uitest/src/com/vaadin/tests/util/SampleDirectory.java +++ b/uitest/src/com/vaadin/tests/util/SampleDirectory.java @@ -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 diff --git a/uitest/src/com/vaadin/tests/validation/EmptyFieldErrorIndicators.java b/uitest/src/com/vaadin/tests/validation/EmptyFieldErrorIndicators.java index 379ab2cfcd..a62eb62e71 100644 --- a/uitest/src/com/vaadin/tests/validation/EmptyFieldErrorIndicators.java +++ b/uitest/src/com/vaadin/tests/validation/EmptyFieldErrorIndicators.java @@ -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); |