summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2012-11-14 15:13:21 +0200
committerHenri Sara <hesara@vaadin.com>2012-11-14 15:13:21 +0200
commit259b441265677906631c923d8fe51f549adfc120 (patch)
treebb44a5bc05eb914d3f9538898900d9605c336e9f /uitest/src/com/vaadin
parentaca92f4937cc54f122b20c4bfb6288ee007c9e47 (diff)
downloadvaadin-framework-259b441265677906631c923d8fe51f549adfc120.tar.gz
vaadin-framework-259b441265677906631c923d8fe51f549adfc120.zip
Remove Window.addComponent() (#2924)
Change-Id: Ida3269e3cce906fd4b55c5e1049b24e0ff383289
Diffstat (limited to 'uitest/src/com/vaadin')
-rw-r--r--uitest/src/com/vaadin/tests/ModalWindow.java11
-rw-r--r--uitest/src/com/vaadin/tests/NativeWindowing.java9
-rw-r--r--uitest/src/com/vaadin/tests/TestCaptionWrapper.java6
-rw-r--r--uitest/src/com/vaadin/tests/TestForNativeWindowing.java9
-rw-r--r--uitest/src/com/vaadin/tests/TestForWindowing.java10
-rw-r--r--uitest/src/com/vaadin/tests/components/TouchScrollables.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java8
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxInPopup.java10
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java10
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java5
-rw-r--r--uitest/src/com/vaadin/tests/components/embedded/EmbeddedApplet.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWidthCalculation.java12
-rw-r--r--uitest/src/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java4
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java8
-rw-r--r--uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java5
-rw-r--r--uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java11
-rw-r--r--uitest/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java22
-rw-r--r--uitest/src/com/vaadin/tests/components/window/LazyWindowResize.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/window/SubWindowFocus.java11
-rw-r--r--uitest/src/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/window/SubWindowOrder.java11
-rw-r--r--uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/window/SubWindows.java47
-rw-r--r--uitest/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/window/WindowClickEvents.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/window/WindowResizeListener.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java10
-rw-r--r--uitest/src/com/vaadin/tests/dd/DDTest6.java17
-rw-r--r--uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java12
-rw-r--r--uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java18
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java13
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1804.java2
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1811.java2
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1819.java2
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2009.java7
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2021.java17
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2099.java2
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2204.java5
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2323.java7
45 files changed, 276 insertions, 158 deletions
diff --git a/uitest/src/com/vaadin/tests/ModalWindow.java b/uitest/src/com/vaadin/tests/ModalWindow.java
index 47db1141c0..4793797941 100644
--- a/uitest/src/com/vaadin/tests/ModalWindow.java
+++ b/uitest/src/com/vaadin/tests/ModalWindow.java
@@ -22,6 +22,7 @@ import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Label;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
@@ -77,22 +78,24 @@ public class ModalWindow extends com.vaadin.server.LegacyApplication implements
private void openSubWindow() {
// Modal window
- test = new Window("Modal window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ test = new Window("Modal window", layout);
test.setModal(true);
getMainWindow().addWindow(test);
- test.addComponent(new Label(
+ layout.addComponent(new Label(
"You have to close this window before accessing others."));
// Textfield for modal window
final TextField f = new TextField();
f.setTabIndex(4);
- test.addComponent(f);
+ layout.addComponent(f);
f.focus();
// Modal window button
final Button b = new Button("Test Button in modal window");
b.setTabIndex(5);
b.addListener(this);
- test.addComponent(b);
+ layout.addComponent(b);
}
}
diff --git a/uitest/src/com/vaadin/tests/NativeWindowing.java b/uitest/src/com/vaadin/tests/NativeWindowing.java
index ddd72d7bec..91ed4a4cac 100644
--- a/uitest/src/com/vaadin/tests/NativeWindowing.java
+++ b/uitest/src/com/vaadin/tests/NativeWindowing.java
@@ -25,6 +25,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class NativeWindowing extends LegacyApplication {
@@ -40,8 +41,10 @@ public class NativeWindowing extends LegacyApplication {
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
final Window w = new Window("sw "
- + System.currentTimeMillis());
+ + System.currentTimeMillis(), layout);
main.addWindow(w);
w.setPositionX(100);
w.setPositionY(100);
@@ -59,9 +62,9 @@ public class NativeWindowing extends LegacyApplication {
}
});
- w.addComponent(closebutton);
+ layout.addComponent(closebutton);
- w.addComponent(new Label(
+ layout.addComponent(new Label(
"<p>Lorem ipsum dolor sit amet.</p>"
+ "<p>Lorem ipsum dolor sit amet.</p>"
+ "<p>Lorem ipsum dolor sit amet.</p>"
diff --git a/uitest/src/com/vaadin/tests/TestCaptionWrapper.java b/uitest/src/com/vaadin/tests/TestCaptionWrapper.java
index a5f7b83c32..ec785c953f 100644
--- a/uitest/src/com/vaadin/tests/TestCaptionWrapper.java
+++ b/uitest/src/com/vaadin/tests/TestCaptionWrapper.java
@@ -105,9 +105,11 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
test(gridLayout);
populateLayout(gridLayout);
- final Window window = new Window("TEST: Window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ final Window window = new Window("TEST: Window", layout);
test(window);
- populateLayout((Layout) window.getContent());
+ populateLayout(layout);
}
diff --git a/uitest/src/com/vaadin/tests/TestForNativeWindowing.java b/uitest/src/com/vaadin/tests/TestForNativeWindowing.java
index 95ffe8b706..c4a6a7b605 100644
--- a/uitest/src/com/vaadin/tests/TestForNativeWindowing.java
+++ b/uitest/src/com/vaadin/tests/TestForNativeWindowing.java
@@ -25,6 +25,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class TestForNativeWindowing extends LegacyApplication {
@@ -40,8 +41,10 @@ public class TestForNativeWindowing extends LegacyApplication {
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
final Window w = new Window("sw "
- + System.currentTimeMillis());
+ + System.currentTimeMillis(), layout);
main.addWindow(w);
w.setPositionX(100);
w.setPositionY(100);
@@ -59,9 +62,9 @@ public class TestForNativeWindowing extends LegacyApplication {
}
});
- w.addComponent(closebutton);
+ layout.addComponent(closebutton);
- w.addComponent(new Label(
+ layout.addComponent(new Label(
"<p>Lorem ipsum dolor sit amet.</p>"
+ "<p>Lorem ipsum dolor sit amet.</p>"
+ "<p>Lorem ipsum dolor sit amet.</p>"
diff --git a/uitest/src/com/vaadin/tests/TestForWindowing.java b/uitest/src/com/vaadin/tests/TestForWindowing.java
index 2818862def..2175aa63ba 100644
--- a/uitest/src/com/vaadin/tests/TestForWindowing.java
+++ b/uitest/src/com/vaadin/tests/TestForWindowing.java
@@ -51,7 +51,9 @@ public class TestForWindowing extends CustomComponent {
@Override
public void buttonClick(ClickEvent event) {
- Window w = new Window("Testing Window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Testing Window", layout);
if (asModal.getValue().booleanValue()) {
w.setModal(true);
@@ -85,8 +87,8 @@ public class TestForWindowing extends CustomComponent {
});
- w.addComponent(s1);
- w.addComponent(s2);
+ layout.addComponent(s1);
+ layout.addComponent(s2);
Slider s = new Slider();
s.setCaption("Volume");
@@ -97,7 +99,7 @@ public class TestForWindowing extends CustomComponent {
// s.setOrientation(Slider.ORIENTATION_VERTICAL);
// s.setArrows(false);
- w.addComponent(s);
+ layout.addComponent(s);
UI.getCurrent().addWindow(w);
diff --git a/uitest/src/com/vaadin/tests/components/TouchScrollables.java b/uitest/src/com/vaadin/tests/components/TouchScrollables.java
index e80a8801a2..1af1cc82e9 100644
--- a/uitest/src/com/vaadin/tests/components/TouchScrollables.java
+++ b/uitest/src/com/vaadin/tests/components/TouchScrollables.java
@@ -167,10 +167,12 @@ public class TouchScrollables extends TestBase {
Button b = new Button("Open subwindow", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- Window w = new Window("Subwindow");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Subwindow", layout);
w.center();
w.setHeight("200px");
- w.addComponent(getBigComponent());
+ layout.addComponent(getBigComponent());
getMainWindow().addWindow(w);
}
});
diff --git a/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java b/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
index d0321100dd..3c7a9a40ea 100644
--- a/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
+++ b/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
@@ -8,6 +8,7 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.Notification;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
@SuppressWarnings("serial")
@@ -31,7 +32,10 @@ public class ShortCutListenerModification extends TestBase implements
for (int j = 0; j < 20; j++) {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
Window window = new Window();
+ window.setContent(layout);
getMainWindow().addWindow(window);
Button button1 = new Button("b1 (CTRL-C)");
@@ -43,8 +47,8 @@ public class ShortCutListenerModification extends TestBase implements
button1.setClickShortcut(KeyCode.C, ModifierKey.CTRL);
button2.setClickShortcut(KeyCode.V, ModifierKey.CTRL);
- window.addComponent(button1);
- window.addComponent(button2);
+ layout.addComponent(button1);
+ layout.addComponent(button2);
button1.focus();
button1.setData(prev);
prev = button1;
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInPopup.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInPopup.java
index 393a8ceb6b..209a31708c 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInPopup.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxInPopup.java
@@ -6,15 +6,19 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Component;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class ComboBoxInPopup extends TestBase {
@Override
protected void setup() {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSizeUndefined();
final Window w = new Window();
- w.getContent().setSizeUndefined();
- w.addComponent(createComboBox());
+ w.setContent(layout);
+ layout.addComponent(createComboBox());
Button close = new Button("Close window", new Button.ClickListener() {
@Override
@@ -23,7 +27,7 @@ public class ComboBoxInPopup extends TestBase {
}
});
close.setClickShortcut(KeyCode.ESCAPE, null);
- w.addComponent(close);
+ layout.addComponent(close);
getLayout().getUI().addWindow(w);
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java
index 24aea18314..d1d2f58239 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java
@@ -6,6 +6,7 @@ import com.vaadin.event.FieldEvents;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class ComboBoxSuggestionOnDetach extends TestBase {
@@ -13,6 +14,12 @@ public class ComboBoxSuggestionOnDetach extends TestBase {
@Override
protected void setup() {
final Window popup = new Window();
+
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSizeUndefined();
+ popup.setContent(layout);
+
ComboBox comboBox = new ComboBox("Combo box", Arrays.asList("Option 1",
"Option 2", "Option 3"));
comboBox.addListener(new FieldEvents.FocusListener() {
@@ -21,10 +28,9 @@ public class ComboBoxSuggestionOnDetach extends TestBase {
popup.close();
}
});
- popup.addComponent(comboBox);
+ layout.addComponent(comboBox);
popup.setSizeUndefined();
- popup.getContent().setSizeUndefined();
popup.center();
getMainWindow().addWindow(popup);
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java
index 173f1596a7..d6fbb465e8 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java
@@ -75,9 +75,10 @@ public class DateFieldInSubWindow extends AbstractTestCase {
}
protected void initWindow() {
- VerticalLayout layout = (VerticalLayout) getContent();
+ VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
+ setContent(layout);
/**
* This causes the window to add the .v-readonly style!
@@ -97,7 +98,7 @@ public class DateFieldInSubWindow extends AbstractTestCase {
generalForm.setVisibleItemProperties(new String[] { "myDate",
"myString" });
generalForm.setValidationVisible(true);
- addComponent(generalForm);
+ layout.addComponent(generalForm);
}
HorizontalLayout buttons = new HorizontalLayout();
diff --git a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedApplet.java b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedApplet.java
index 4b318c3890..fec2fb1447 100644
--- a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedApplet.java
+++ b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedApplet.java
@@ -6,6 +6,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class EmbeddedApplet extends TestBase {
@@ -36,8 +37,10 @@ public class EmbeddedApplet extends TestBase {
}
}));
- Window window = new Window("Testwindow");
- window.addComponent(new Label("I am inside the window"));
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window window = new Window("Testwindow", layout);
+ layout.addComponent(new Label("I am inside the window"));
applet.getUI().addWindow(window);
}
}
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWidthCalculation.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWidthCalculation.java
index f558285224..9557137c8a 100644
--- a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWidthCalculation.java
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalLayoutWidthCalculation.java
@@ -37,18 +37,20 @@ public class VerticalLayoutWidthCalculation extends AbstractTestCase {
vlTF2.addComponent(tf2);
hl.addComponent(vlTF2);
- Window wnd = new Window("Test");
- wnd.getContent().setSizeUndefined();
- wnd.addComponent(hl);
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSizeUndefined();
+ Window wnd = new Window("Test", layout);
+ layout.addComponent(hl);
Button btn = new Button("Show/hide");
- btn.addListener(new Button.ClickListener() {
+ btn.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
tf2.setVisible(!tf2.isVisible());
}
});
- wnd.addComponent(btn);
+ layout.addComponent(btn);
return wnd;
}
diff --git a/uitest/src/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java b/uitest/src/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java
index ba4fe93b68..a5441f38b1 100644
--- a/uitest/src/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java
+++ b/uitest/src/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java
@@ -27,8 +27,8 @@ public class PopupViewClickShortcut extends TestBase {
addComponent(new PopupView("Show popup table", makeTable("Popup",
KeyCode.P)));
addComponent(makeTable("Main window", KeyCode.M));
- sub.addComponent(new PopupView("Show popup table", makeTable(
- "Subwindow popup", KeyCode.U)));
+ ((ComponentContainer) sub.getContent()).addComponent(new PopupView(
+ "Show popup table", makeTable("Subwindow popup", KeyCode.U)));
}
private ComponentContainer makeTable(final String caption, int keyCode) {
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
index ae9ba302c6..8293d9919f 100644
--- a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
@@ -59,10 +59,12 @@ public class RichTextAreaWithKeyboardShortcuts extends TestBase {
panelLayout.addComponent(createRichTextArea("InPanel"));
getLayout().addComponent(panel);
- Window w = new Window("SubWindow");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("SubWindow", layout);
w.addActionHandler(actionHandler);
- w.addComponent(createRichTextArea("InSubWindow"));
- w.getContent().setSizeUndefined();
+ layout.addComponent(createRichTextArea("InSubWindow"));
+ layout.setSizeUndefined();
getLayout().getUI().addWindow(w);
diff --git a/uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java b/uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java
index ceb5ff5c60..8e6b68d666 100644
--- a/uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java
+++ b/uitest/src/com/vaadin/tests/components/uitest/components/WindowsCssTest.java
@@ -86,7 +86,10 @@ public class WindowsCssTest extends VerticalLayout {
String styleName) {
Window window = new Window();
- window.addComponent(new Label("Some content"));
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ window.setContent(layout);
+ layout.addComponent(new Label("Some content"));
if (caption != null) {
window.setCaption(caption);
diff --git a/uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java b/uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java
index 9994414d12..455fb2e531 100644
--- a/uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java
+++ b/uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java
@@ -11,6 +11,7 @@ import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class AttachShouldBeCalledForSubWindows extends AbstractTestCase {
@@ -72,7 +73,9 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase {
}
private Window createSubWindow() {
- Window w = new Window("Sub window") {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Sub window", layout) {
@Override
public void attach() {
log(this);
@@ -95,7 +98,7 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase {
}
});
okButton.setClickShortcut(KeyCode.ENTER);
- w.addComponent(okButton);
+ layout.addComponent(okButton);
w.center();
return w;
}
diff --git a/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java b/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
index a7fcda3cf1..efe7eb20bf 100644
--- a/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
+++ b/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.window;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class CenteredWindowWithUndefinedSize extends TestBase {
@@ -18,14 +19,16 @@ public class CenteredWindowWithUndefinedSize extends TestBase {
@Override
protected void setup() {
- Window centered = new Window("A window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window centered = new Window("A window", layout);
centered.setSizeUndefined();
- centered.getContent().setSizeFull();
+ layout.setSizeFull();
centered.center();
Label l = new Label("This window should be centered");
l.setSizeUndefined();
- centered.addComponent(l);
+ layout.addComponent(l);
getMainWindow().addWindow(centered);
diff --git a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java
index 8060ec9955..e2a59b6005 100644
--- a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java
+++ b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java
@@ -5,6 +5,7 @@ import com.vaadin.tests.util.Log;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Window.CloseEvent;
import com.vaadin.ui.Window.CloseListener;
@@ -30,9 +31,11 @@ public class CloseSubWindow extends TestBase {
}
private Window createClosableSubWindow(final String title) {
- final Window window = new Window(title);
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSizeFull();
+ final Window window = new Window(title, layout);
window.setSizeUndefined();
- window.getContent().setSizeFull();
window.setClosable(true);
Button closeButton = new Button("Close");
@@ -42,7 +45,7 @@ public class CloseSubWindow extends TestBase {
event.getButton().findAncestor(Window.class).close();
}
});
- window.addComponent(closeButton);
+ layout.addComponent(closeButton);
Button removeButton = new Button("Remove from parent");
removeButton.addListener(new ClickListener() {
@@ -51,7 +54,7 @@ public class CloseSubWindow extends TestBase {
window.close();
}
});
- window.addComponent(closeButton);
+ layout.addComponent(closeButton);
window.addListener(new CloseListener() {
@Override
diff --git a/uitest/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java b/uitest/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java
index 6ca5837cee..579590ed78 100644
--- a/uitest/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java
+++ b/uitest/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.window;
import com.vaadin.server.ThemeResource;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Embedded;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class EmbeddedInSubWindow extends TestBase {
@@ -20,15 +21,17 @@ public class EmbeddedInSubWindow extends TestBase {
@Override
protected void setup() {
setTheme("tests-tickets");
- Window zoom = new Window("Image Preview");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSizeUndefined();
+ Window zoom = new Window("Image Preview", layout);
zoom.setSizeUndefined();
- zoom.getContent().setSizeUndefined();
String res = "icons/EmbeddedInSubWindow-image.png";
Embedded imagePreview = new Embedded(null, new ThemeResource(res));
imagePreview.setSizeUndefined();
- zoom.addComponent(imagePreview);
+ layout.addComponent(imagePreview);
zoom.setModal(true);
zoom.setResizable(false);
diff --git a/uitest/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java b/uitest/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java
index 5ce0636f6f..af997f3619 100644
--- a/uitest/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java
+++ b/uitest/src/com/vaadin/tests/components/window/ExtraLargeSubWindow.java
@@ -2,19 +2,22 @@ package com.vaadin.tests.components.window;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class ExtraLargeSubWindow extends TestBase {
@Override
protected void setup() {
- Window w = new Window("full sized window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ layout.setSizeFull();
+ Window w = new Window("full sized window", layout);
w.setWidth("2000px");
w.setHeight("2000px");
- w.getContent().setSizeFull();
NativeButton b = new NativeButton("A large button");
b.setSizeFull();
- w.addComponent(b);
+ layout.addComponent(b);
getMainWindow().addWindow(w);
}
diff --git a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java
index 03deb4ea20..35a4b8c761 100644
--- a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java
+++ b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShown.java
@@ -5,6 +5,7 @@ import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class ExtraWindowShown extends TestBase {
@@ -16,19 +17,22 @@ public class ExtraWindowShown extends TestBase {
@Override
public void buttonClick(ClickEvent event) {
- final Window w = new Window("Sub window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ final Window w = new Window("Sub window", layout);
w.center();
- w.addComponent(new Button("Close", new Button.ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- w.close();
- }
- }));
+ layout.addComponent(new Button("Close",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ w.close();
+ }
+ }));
Button iconButton = new Button("A button with icon");
iconButton
.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
- w.addComponent(iconButton);
+ layout.addComponent(iconButton);
event.getButton().getUI().addWindow(w);
}
diff --git a/uitest/src/com/vaadin/tests/components/window/LazyWindowResize.java b/uitest/src/com/vaadin/tests/components/window/LazyWindowResize.java
index 8ccd389b1a..dd98024f1c 100644
--- a/uitest/src/com/vaadin/tests/components/window/LazyWindowResize.java
+++ b/uitest/src/com/vaadin/tests/components/window/LazyWindowResize.java
@@ -11,6 +11,7 @@ import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Window.ResizeEvent;
import com.vaadin.ui.Window.ResizeListener;
@@ -54,11 +55,13 @@ public class LazyWindowResize extends AbstractTestCase {
public void init() {
mainWindow = new LegacyWindow("Resize test");
setMainWindow(mainWindow);
- subWindow = new Window("Sub window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ subWindow = new Window("Sub window", layout);
subWindow.setHeight("50%");
subWindow.setWidth("50%");
subWindow.center();
- subWindow.addComponent(new Label(LoremIpsum.get(1000)));
+ layout.addComponent(new Label(LoremIpsum.get(1000)));
getMainWindow().addWindow(subWindow);
lazyMode = new CheckBox("Lazy resize");
diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowFocus.java b/uitest/src/com/vaadin/tests/components/window/SubWindowFocus.java
index 389c926986..637df36e19 100644
--- a/uitest/src/com/vaadin/tests/components/window/SubWindowFocus.java
+++ b/uitest/src/com/vaadin/tests/components/window/SubWindowFocus.java
@@ -7,6 +7,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class SubWindowFocus extends TestBase {
@@ -43,12 +44,14 @@ public class SubWindowFocus extends TestBase {
Button b = new Button("new", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- final Window win = new Window("Subwin");
- win.getContent().setWidth(null);
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ final Window win = new Window("Subwin", layout);
+ layout.setWidth(null);
win.center();
win.setClosable(false);
getMainWindow().addWindow(win);
- win.addComponent(new Label("SPACE notifies, ESC closes."));
+ layout.addComponent(new Label("SPACE notifies, ESC closes."));
win.addActionHandler(new Action.Handler() {
@@ -76,7 +79,7 @@ public class SubWindowFocus extends TestBase {
});
- win.addComponent(new TextField());
+ layout.addComponent(new TextField());
}
});
diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java b/uitest/src/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java
index bb5a817362..2a0f60f390 100644
--- a/uitest/src/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java
+++ b/uitest/src/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java
@@ -14,6 +14,7 @@ import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Notification;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class SubWindowFocusAndBlurListeners extends TestBase {
@@ -32,10 +33,12 @@ public class SubWindowFocusAndBlurListeners extends TestBase {
@Override
protected void setup() {
- final Window window = new Window("Focus test window");
- window.getContent().setSizeUndefined();
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ final Window window = new Window("Focus test window", layout);
+ layout.setSizeUndefined();
- window.addComponent(new TextField());
+ layout.addComponent(new TextField());
window.addListener(new FocusListener() {
@Override
public void focus(FocusEvent event) {
diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.java b/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.java
index 0ca7fd1067..4585a036ff 100644
--- a/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.java
+++ b/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.java
@@ -11,6 +11,7 @@ import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class SubWindowOrder extends TestBase {
@@ -23,11 +24,13 @@ public class SubWindowOrder extends TestBase {
UI mainWindow = getMainWindow();
HorizontalLayout controlpanels = new HorizontalLayout();
for (int i = 1; i <= 5; i++) {
- Window dialog = new Window("Dialog " + i);
- dialog.getContent().setSizeUndefined();
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window dialog = new Window("Dialog " + i, layout);
+ layout.setSizeUndefined();
windowlist.addBean(dialog);
- dialog.addComponent(new Label("this is dialog number " + i));
- dialog.addComponent(new ControlPanel());
+ layout.addComponent(new Label("this is dialog number " + i));
+ layout.addComponent(new ControlPanel());
mainWindow.addWindow(dialog);
}
controlpanels.addComponent(new ControlPanel());
diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java b/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java
index 5bda762d3f..473b3e1f9c 100644
--- a/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java
+++ b/uitest/src/com/vaadin/tests/components/window/SubWindowWithUndefinedHeight.java
@@ -4,6 +4,7 @@ import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class SubWindowWithUndefinedHeight extends TestBase {
@@ -20,10 +21,12 @@ public class SubWindowWithUndefinedHeight extends TestBase {
@Override
protected void setup() {
- final Window subwindow = new Window("subwindow");
+ final VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ final Window subwindow = new Window("subwindow", layout);
subwindow.center();
subwindow.setSizeUndefined();
- subwindow.getContent().setSizeUndefined();
+ layout.setSizeUndefined();
final Button tabButton = new Button("A button");
tabButton.setCaption("Tab 1");
@@ -42,17 +45,17 @@ public class SubWindowWithUndefinedHeight extends TestBase {
public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
if (tabsheet.getSelectedTab() == tabButton) {
tabsheet.setSizeUndefined();
- subwindow.getContent().setSizeUndefined();
+ layout.setSizeUndefined();
subwindow.setSizeUndefined();
} else if (tabsheet.getSelectedTab() == table) {
subwindow.setWidth("500px");
subwindow.setHeight("500px");
- subwindow.getContent().setSizeFull();
+ layout.setSizeFull();
tabsheet.setSizeFull();
}
}
});
- subwindow.addComponent(tabsheet);
+ layout.addComponent(tabsheet);
Button button = new Button("click me", new Button.ClickListener() {
@Override
diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindows.java b/uitest/src/com/vaadin/tests/components/window/SubWindows.java
index a146aeed49..28e130be1f 100644
--- a/uitest/src/com/vaadin/tests/components/window/SubWindows.java
+++ b/uitest/src/com/vaadin/tests/components/window/SubWindows.java
@@ -9,6 +9,7 @@ import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class SubWindows extends TestBase {
@@ -45,16 +46,16 @@ public class SubWindows extends TestBase {
@Override
protected void setup() {
- autoWideWindow = new Window("Dialog - width by contents",
- new HorizontalLayout());
- autoWideWindow.getContent().setSizeUndefined();
- autoWideWindow.addComponent(new TextField("Field 1"));
- autoWideWindow.addComponent(new TextField("Field 2"));
- autoWideWindow.addComponent(new Button("Add", new ClickListener() {
+ final HorizontalLayout hl = new HorizontalLayout();
+ autoWideWindow = new Window("Dialog - width by contents", hl);
+ hl.setSizeUndefined();
+ hl.addComponent(new TextField("Field 1"));
+ hl.addComponent(new TextField("Field 2"));
+ hl.addComponent(new Button("Add", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- autoWideWindow.addComponent(createRemoveButton());
+ hl.addComponent(createRemoveButton());
}
@@ -63,29 +64,34 @@ public class SubWindows extends TestBase {
getMainWindow().addWindow(autoWideWindow);
{
- Window dialog = new Window("Dialog - undefined width");
- dialog.addComponent(new TextField("Field 1"));
+ VerticalLayout vl = new VerticalLayout();
+ hl.setMargin(true);
+ Window dialog = new Window("Dialog - undefined width", vl);
+ vl.addComponent(new TextField("Field 1"));
TextField tf2 = new TextField("Field 2");
tf2.setWidth("500px");
- dialog.addComponent(tf2);
- dialog.addComponent(new Button("Ok"));
+ vl.addComponent(tf2);
+ vl.addComponent(new Button("Ok"));
dialog.center();
getMainWindow().addWindow(dialog);
}
{
- Window dialog = new Window("Dialog - width defined by content");
- dialog.getContent().setHeight(null);
- dialog.getContent().setWidth("100%");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window dialog = new Window("Dialog - width defined by content",
+ layout);
+ layout.setHeight(null);
+ layout.setWidth("100%");
TextArea ta = new TextArea();
ta.setValue("The textfield should fill the window (except margins)."
+ "\n - Try to resize the window\n");
ta.setRows(5);
ta.setWidth("100%");
- dialog.addComponent(ta);
+ layout.addComponent(ta);
dialog.setPositionX(20);
dialog.setPositionY(100);
@@ -93,9 +99,12 @@ public class SubWindows extends TestBase {
}
{
- Window dialog = new Window("Dialog - size defined by content");
- dialog.getContent().setHeight("100%");
- dialog.getContent().setWidth("100%");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window dialog = new Window("Dialog - size defined by content",
+ layout);
+ layout.setHeight("100%");
+ layout.setWidth("100%");
TextArea ta = new TextArea();
ta.setValue("The textfield should fill the window (except margins)."
@@ -103,7 +112,7 @@ public class SubWindows extends TestBase {
ta.setWidth("100%");
ta.setHeight("100%");
ta.setRows(5);
- dialog.addComponent(ta);
+ layout.addComponent(ta);
dialog.setPositionX(20);
dialog.setPositionY(300);
diff --git a/uitest/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java b/uitest/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java
index 03e5988fad..8349c82911 100644
--- a/uitest/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java
+++ b/uitest/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java
@@ -19,7 +19,9 @@ public class SubwindowInvalidLayout extends TestBase {
@Override
protected void setup() {
- Window window = new Window("Sub window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window window = new Window("Sub window", layout);
window.center();
VerticalLayout vl = new VerticalLayout();
@@ -27,7 +29,7 @@ public class SubwindowInvalidLayout extends TestBase {
Button b = new Button("A 100% wide button, invalid");
b.setWidth("100%");
vl.addComponent(b);
- window.addComponent(vl);
+ layout.addComponent(vl);
getMainWindow().addWindow(window);
}
diff --git a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
index 859c1b4b5d..46845748a3 100644
--- a/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
+++ b/uitest/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.window;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class TestTooSmallSubwindowSize extends TestBase {
@@ -18,14 +19,16 @@ public class TestTooSmallSubwindowSize extends TestBase {
@Override
protected void setup() {
- Window w = new Window("Scroll");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window("Scroll", layout);
Label desc = new Label(
"This is a new child window with a preset"
+ " width, height and position. Resizing has been"
+ " disabled for this window. Additionally, this text label"
+ " is intentionally too large to fit the window. You can"
+ " use the scrollbars to view different parts of the window content.");
- w.addComponent(desc);
+ layout.addComponent(desc);
// Set window position
w.setPositionX(100);
diff --git a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java
index 12af6ccdae..8e786533ef 100644
--- a/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java
+++ b/uitest/src/com/vaadin/tests/components/window/TooltipInWindow.java
@@ -19,16 +19,19 @@ package com.vaadin.tests.components.window;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class TooltipInWindow extends AbstractTestUI {
@Override
protected void setup(VaadinRequest request) {
- Window window = new Window("Window");
- window.getContent().setSizeUndefined();
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window window = new Window("Window", layout);
+ layout.setSizeUndefined();
window.center();
- window.addComponent(createTextField());
+ layout.addComponent(createTextField());
addWindow(window);
addComponent(createTextField());
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowClickEvents.java b/uitest/src/com/vaadin/tests/components/window/WindowClickEvents.java
index a4120b7d42..00cd580ed8 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowClickEvents.java
+++ b/uitest/src/com/vaadin/tests/components/window/WindowClickEvents.java
@@ -54,7 +54,7 @@ public class WindowClickEvents extends TestBase {
});
centered.setSizeUndefined();
- centered.getContent().setSizeUndefined();
+ layout.setSizeUndefined();
centered.center();
Label l = new Label("This window is centered");
@@ -69,8 +69,8 @@ public class WindowClickEvents extends TestBase {
}
});
- centered.addComponent(l);
- centered.addComponent(b);
+ layout.addComponent(l);
+ layout.addComponent(b);
getMainWindow().addWindow(centered);
log = new Log(5);
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowResizeListener.java b/uitest/src/com/vaadin/tests/components/window/WindowResizeListener.java
index 57a125bcb7..e66767dac9 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowResizeListener.java
+++ b/uitest/src/com/vaadin/tests/components/window/WindowResizeListener.java
@@ -8,7 +8,7 @@ import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class WindowResizeListener extends TestBase {
@@ -82,10 +82,11 @@ class ResizeListenerWindow extends Window {
Label sizeLabel = new Label();
public ResizeListenerWindow() {
- super("Subwindow");
+ super("Subwindow", new VerticalLayout());
setWidth("400px");
- Layout hl = (Layout) getContent();
+ VerticalLayout hl = (VerticalLayout) getContent();
+ hl.setMargin(true);
hl.addComponent(new Label("Current size: "));
hl.addComponent(sizeLabel);
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java b/uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java
index 12a30cabfc..09d03cdd28 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java
+++ b/uitest/src/com/vaadin/tests/components/window/WindowScrollingComponentIntoView.java
@@ -52,13 +52,15 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
getMainWindow().addComponent(horizontalLayout);
final Component y9 = l;
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
final Window window = new Window();
window.setHeight("500px");
window.setWidth("500px");
window.setPositionX(200);
window.setPositionY(200);
- window.addComponent(new Button("Scroll mainwin to X9",
+ layout.addComponent(new Button("Scroll mainwin to X9",
new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
@@ -66,7 +68,7 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
}
}));
- window.addComponent(new Button("Scroll mainwin to Y9",
+ layout.addComponent(new Button("Scroll mainwin to Y9",
new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
@@ -82,7 +84,7 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
panel.setScrollLeft(50);
panel.setScrollTop(50);
panelLayout.setSizeUndefined();
- window.addComponent(l("Spacer", 500, 500));
+ layout.addComponent(l("Spacer", 500, 500));
l2 = null;
for (int i = 0; i < 10; i++) {
@@ -119,7 +121,7 @@ public class WindowScrollingComponentIntoView extends AbstractTestCase {
}
}), 0);
- window.addComponent(panel);
+ layout.addComponent(panel);
getMainWindow().addWindow(window);
}
diff --git a/uitest/src/com/vaadin/tests/dd/DDTest6.java b/uitest/src/com/vaadin/tests/dd/DDTest6.java
index 5ba6999da4..2122e8e982 100644
--- a/uitest/src/com/vaadin/tests/dd/DDTest6.java
+++ b/uitest/src/com/vaadin/tests/dd/DDTest6.java
@@ -46,6 +46,7 @@ import com.vaadin.ui.Table;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Tree.TreeDragMode;
import com.vaadin.ui.Tree.TreeTargetDetails;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class DDTest6 extends TestBase {
@@ -256,9 +257,11 @@ public class DDTest6 extends TestBase {
// ATM supports only images.
if (file.getType().equals("image/png")) {
Embedded embedded = new Embedded(file.getName(), file.getResource());
- Window w = new Window(file.getName());
- w.addComponent(embedded);
- w.getContent().setSizeUndefined();
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window(file.getName(), layout);
+ layout.addComponent(embedded);
+ layout.setSizeUndefined();
getMainWindow().addWindow(w);
} else if (file.getType().equals("text/csv")) {
showSpreadsheet(file);
@@ -281,10 +284,12 @@ public class DDTest6 extends TestBase {
String[] split = rows[i].split(",");
table.addItem(split, "" + i);
}
- Window w = new Window(file.getName());
- w.getContent().setSizeUndefined();
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window w = new Window(file.getName(), layout);
+ layout.setSizeUndefined();
table.setEditable(true);
- w.addComponent(table);
+ layout.addComponent(table);
getMainWindow().addWindow(w);
}
diff --git a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java
index d52e38ca40..8a8df93742 100644
--- a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java
+++ b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java
@@ -407,20 +407,24 @@ public class LiferayThemeDemo extends LegacyApplication {
final CssLayout l = new CssLayout();
l.setCaption("Windows");
- final Window w = new Window("Normal window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ final Window w = new Window("Normal window", layout);
w.setWidth("280px");
w.setHeight("180px");
w.setPositionX(40);
w.setPositionY(160);
- final Window w2 = new Window("Window, no resize");
+ VerticalLayout layout2 = new VerticalLayout();
+ layout2.setMargin(true);
+ final Window w2 = new Window("Window, no resize", layout2);
w2.setResizable(false);
w2.setWidth("280px");
w2.setHeight("180px");
w2.setPositionX(350);
w2.setPositionY(160);
- w2.addComponent(new Label("<code>Window.setResizable(false)</code>",
- ContentMode.HTML));
+ layout2.addComponent(new Label(
+ "<code>Window.setResizable(false)</code>", ContentMode.HTML));
tabs.addListener(new TabSheet.SelectedTabChangeListener() {
@Override
diff --git a/uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java b/uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java
index 177471e3c8..674287312d 100644
--- a/uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java
+++ b/uitest/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java
@@ -26,6 +26,7 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.TextArea;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class TestAbsoluteLayout extends TestBase {
@@ -132,8 +133,11 @@ public class TestAbsoluteLayout extends TestBase {
componentChooser.addListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- final Window chooser = new Window("Choose component");
- chooser.getContent().setSizeUndefined();
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ final Window chooser = new Window("Choose component",
+ layout);
+ layout.setSizeUndefined();
chooser.setModal(true);
NativeSelect select = new NativeSelect(
@@ -176,7 +180,7 @@ public class TestAbsoluteLayout extends TestBase {
});
- chooser.addComponent(select);
+ layout.addComponent(select);
getMainWindow().addWindow(chooser);
@@ -189,9 +193,11 @@ public class TestAbsoluteLayout extends TestBase {
addComp.addListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
final Window chooser = new Window(
- "Choose component type to add");
- chooser.getContent().setSizeUndefined();
+ "Choose component type to add", layout);
+ layout.setSizeUndefined();
chooser.setModal(true);
NativeSelect select = new NativeSelect(
@@ -261,7 +267,7 @@ public class TestAbsoluteLayout extends TestBase {
});
- chooser.addComponent(select);
+ layout.addComponent(select);
getMainWindow().addWindow(chooser);
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java b/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java
index f129f01c63..522fbe7670 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.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.Notification;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1465ModalNotification extends LegacyApplication {
@@ -17,7 +18,9 @@ public class Ticket1465ModalNotification extends LegacyApplication {
"ButtonPanel containing a table test");
setMainWindow(mainWin);
- final Window modal = new Window("Modal window");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ final Window modal = new Window("Modal window", layout);
modal.setModal(true);
Button b = new Button("click to show notification",
@@ -31,7 +34,7 @@ public class Ticket1465ModalNotification extends LegacyApplication {
}
});
- modal.addComponent(b);
+ layout.addComponent(b);
b = new Button("click to warning notification",
new Button.ClickListener() {
@@ -43,7 +46,7 @@ public class Ticket1465ModalNotification extends LegacyApplication {
Notification.TYPE_WARNING_MESSAGE);
}
});
- modal.addComponent(b);
+ layout.addComponent(b);
b = new Button("click to Humanized notification",
new Button.ClickListener() {
@@ -55,7 +58,7 @@ public class Ticket1465ModalNotification extends LegacyApplication {
Notification.TYPE_HUMANIZED_MESSAGE);
}
});
- modal.addComponent(b);
+ layout.addComponent(b);
b = new Button("click to test modality!", new Button.ClickListener() {
@@ -66,7 +69,7 @@ public class Ticket1465ModalNotification extends LegacyApplication {
}
});
- modal.addComponent(b);
+ layout.addComponent(b);
mainWin.addWindow(modal);
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1804.java b/uitest/src/com/vaadin/tests/tickets/Ticket1804.java
index f4516f767a..bf648b0d92 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1804.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1804.java
@@ -109,7 +109,7 @@ public class Ticket1804 extends com.vaadin.server.LegacyApplication {
Window w = new Window("Status of the fields");
w.setModal(true);
w.setHeight("80%");
- w.addComponent(new Label(msg.toString(), ContentMode.HTML));
+ w.setContent(new Label(msg.toString(), ContentMode.HTML));
main.addWindow(w);
}
});
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1811.java b/uitest/src/com/vaadin/tests/tickets/Ticket1811.java
index 1cb122a23e..e8f23da3d1 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1811.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1811.java
@@ -72,7 +72,7 @@ public class Ticket1811 extends com.vaadin.server.LegacyApplication {
}
Window w = new Window("Status of the fields");
w.setModal(true);
- w.addComponent(new Label(msg.toString(), ContentMode.HTML));
+ w.setContent(new Label(msg.toString(), ContentMode.HTML));
main.addWindow(w);
}
});
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1819.java b/uitest/src/com/vaadin/tests/tickets/Ticket1819.java
index b24eec115e..b9a0060ce0 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1819.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1819.java
@@ -58,7 +58,7 @@ public class Ticket1819 extends com.vaadin.server.LegacyApplication {
}
Window w = new Window("Status of the fields");
w.setModal(true);
- w.addComponent(new Label(msg.toString(), ContentMode.HTML));
+ w.setContent(new Label(msg.toString(), ContentMode.HTML));
main.addWindow(w);
}
});
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java
index b4ef678efe..4dc69ec470 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java
@@ -100,6 +100,9 @@ public class Ticket2009 extends com.vaadin.server.LegacyApplication {
Button done = new Button("Done");
PropertyEditor(ItemClickEvent event) {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ setContent(layout);
c = (Container) event.getSource();
propertyid = event.getPropertyId();
@@ -109,8 +112,8 @@ public class Ticket2009 extends com.vaadin.server.LegacyApplication {
editor.setPropertyDataSource(c.getContainerProperty(itemid,
propertyid));
- addComponent(editor);
- addComponent(done);
+ layout.addComponent(editor);
+ layout.addComponent(done);
setWidth(W + "px");
setHeight(H + "px");
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2021.java b/uitest/src/com/vaadin/tests/tickets/Ticket2021.java
index 9a73636067..c6cbdbfa94 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket2021.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2021.java
@@ -6,7 +6,6 @@ import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
@@ -31,12 +30,12 @@ public class Ticket2021 extends LegacyApplication {
w.setContent(new GridLayout(2, 2));
setMainWindow(w);
- Panel p = new Panel();
+ VerticalLayout layout = new VerticalLayout();
+ Panel p = new Panel(layout);
p.setCaption("ExpandLayout");
p.setWidth("500px");
p.setHeight("500px");
- p.setContent(new VerticalLayout());
- p.getContent().setSizeFull();
+ layout.setSizeFull();
w.addComponent(p);
@@ -45,19 +44,19 @@ public class Ticket2021 extends LegacyApplication {
tf1.setSizeFull();
tf1.setValue(contents);
tf1.setCaption("TextField caption");
- ((ComponentContainer) p.getContent()).addComponent(tf1);
+ layout.addComponent(tf1);
/*
*
* OrderedLayout
*/
- Panel p2 = new Panel();
+ VerticalLayout layout2 = new VerticalLayout();
+ Panel p2 = new Panel(layout2);
p2.setCaption("OrderedLayout");
p2.setWidth("500px");
p2.setHeight("500px");
- p2.setContent(new VerticalLayout());
- p2.getContent().setSizeFull();
+ layout2.setSizeFull();
w.addComponent(p2);
@@ -66,7 +65,7 @@ public class Ticket2021 extends LegacyApplication {
tf2.setSizeFull();
tf2.setValue(contents);
tf2.setCaption("TextField caption");
- ((ComponentContainer) p2.getContent()).addComponent(tf2);
+ layout2.addComponent(tf2);
/*
*
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2099.java b/uitest/src/com/vaadin/tests/tickets/Ticket2099.java
index 8b5d329977..0dc65cc25e 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket2099.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2099.java
@@ -73,7 +73,7 @@ public class Ticket2099 extends LegacyApplication {
// l1.setVisible(false);
// ts.setSelectedTab(l3);
- w.addComponent(ts);
+ w.setContent(ts);
return w;
}
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2204.java b/uitest/src/com/vaadin/tests/tickets/Ticket2204.java
index 6ccb2d8494..e32b66ffc0 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket2204.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2204.java
@@ -23,7 +23,6 @@ import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.Panel;
import com.vaadin.ui.RichTextArea;
@@ -168,7 +167,9 @@ public class Ticket2204 extends LegacyApplication {
textArea.setSizeFull();
}
if (c == Panel.class) {
- Layout layout = (Layout) ((Panel) cc).getContent();
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ ((Panel) cc).setContent(layout);
containerToComponent.put(cc, layout);
layout.setVisible(false);
textArea.setVisible(true);
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2323.java b/uitest/src/com/vaadin/tests/tickets/Ticket2323.java
index f2ea5146d2..d9bbde52aa 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket2323.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2323.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.tickets;
import com.vaadin.server.LegacyApplication;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2323 extends LegacyApplication {
@@ -12,11 +13,13 @@ public class Ticket2323 extends LegacyApplication {
LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
setMainWindow(w);
- Window subWindow = new Window("");
+ VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ Window subWindow = new Window("", layout);
subWindow.setSizeUndefined();
subWindow.getContent().setSizeUndefined();
subWindow.center();
- subWindow.addComponent(new RichTextArea());
+ subWindow.setContent(new RichTextArea());
w.addWindow(subWindow);
}