summaryrefslogtreecommitdiffstats
path: root/server
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 /server
parentaca92f4937cc54f122b20c4bfb6288ee007c9e47 (diff)
downloadvaadin-framework-259b441265677906631c923d8fe51f549adfc120.tar.gz
vaadin-framework-259b441265677906631c923d8fe51f549adfc120.zip
Remove Window.addComponent() (#2924)
Change-Id: Ida3269e3cce906fd4b55c5e1049b24e0ff383289
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/ComponentSizeValidator.java28
-rw-r--r--server/src/com/vaadin/ui/Window.java34
-rw-r--r--server/tests/src/com/vaadin/data/util/sqlcontainer/TicketTests.java2
3 files changed, 16 insertions, 48 deletions
diff --git a/server/src/com/vaadin/server/ComponentSizeValidator.java b/server/src/com/vaadin/server/ComponentSizeValidator.java
index 08fa150a9d..7e72f10f51 100644
--- a/server/src/com/vaadin/server/ComponentSizeValidator.java
+++ b/server/src/com/vaadin/server/ComponentSizeValidator.java
@@ -60,21 +60,23 @@ public class ComponentSizeValidator implements Serializable {
Component component, List<InvalidLayout> errors,
InvalidLayout parent) {
- boolean invalidHeight = !checkHeights(component);
- boolean invalidWidth = !checkWidths(component);
-
- if (invalidHeight || invalidWidth) {
- InvalidLayout error = new InvalidLayout(component, invalidHeight,
- invalidWidth);
- if (parent != null) {
- parent.addError(error);
- } else {
- if (errors == null) {
- errors = new LinkedList<InvalidLayout>();
+ if (component != null) {
+ boolean invalidHeight = !checkHeights(component);
+ boolean invalidWidth = !checkWidths(component);
+
+ if (invalidHeight || invalidWidth) {
+ InvalidLayout error = new InvalidLayout(component,
+ invalidHeight, invalidWidth);
+ if (parent != null) {
+ parent.addError(error);
+ } else {
+ if (errors == null) {
+ errors = new LinkedList<InvalidLayout>();
+ }
+ errors.add(error);
}
- errors.add(error);
+ parent = error;
}
- parent = error;
}
if (component instanceof Panel) {
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java
index 7e9fecbdc5..3f6091aa90 100644
--- a/server/src/com/vaadin/ui/Window.java
+++ b/server/src/com/vaadin/ui/Window.java
@@ -105,40 +105,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
setSizeUndefined();
}
- /**
- * Add a component to the content ({@link ComponentContainer}) of a window.
- *
- * This version creates an empty {@link VerticalLayout} if no container is
- * defined, but this automatic creation will be removed in future versions.
- *
- * @param c
- * component to add
- *
- * @deprecated use Window.setContent(Component) instead
- */
- @Deprecated
- public void addComponent(Component c) {
- if (c instanceof Window) {
- throw new IllegalArgumentException(
- "Window cannot be added to another via addComponent. "
- + "Use addWindow(Window) instead.");
- }
-
- if (getContent() == null) {
- // TODO this automatic creation should be removed in the future
- VerticalLayout content = new VerticalLayout();
- content.setMargin(true);
- setContent(content);
- }
-
- if (getContent() instanceof ComponentContainer) {
- ((ComponentContainer) getContent()).addComponent(c);
- } else {
- throw new IllegalArgumentException(
- "Cannot add component to a window whose content is not a ComponentContainer");
- }
- }
-
/* ********************************************************************* */
/*
diff --git a/server/tests/src/com/vaadin/data/util/sqlcontainer/TicketTests.java b/server/tests/src/com/vaadin/data/util/sqlcontainer/TicketTests.java
index deebe9a08e..6e95aff027 100644
--- a/server/tests/src/com/vaadin/data/util/sqlcontainer/TicketTests.java
+++ b/server/tests/src/com/vaadin/data/util/sqlcontainer/TicketTests.java
@@ -44,7 +44,7 @@ public class TicketTests {
"SELECT * FROM people", Arrays.asList("ID"), connectionPool));
Table table = new Table();
Window w = new Window();
- w.addComponent(table);
+ w.setContent(table);
table.setContainerDataSource(container);
}