From 259b441265677906631c923d8fe51f549adfc120 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Wed, 14 Nov 2012 15:13:21 +0200 Subject: Remove Window.addComponent() (#2924) Change-Id: Ida3269e3cce906fd4b55c5e1049b24e0ff383289 --- .../com/vaadin/server/ComponentSizeValidator.java | 28 +++++++++--------- server/src/com/vaadin/ui/Window.java | 34 ---------------------- 2 files changed, 15 insertions(+), 47 deletions(-) (limited to 'server/src') 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 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(); + 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(); + } + 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"); - } - } - /* ********************************************************************* */ /* -- cgit v1.2.3