diff options
author | Artur Signell <artur@vaadin.com> | 2012-11-14 13:24:02 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-11-14 13:24:02 +0000 |
commit | 251e140917efc4e63826d8800b1dda1694f89fea (patch) | |
tree | 7b20dfa2cec8322301ced3cc5adc2379bcb8491c /server/src | |
parent | 5e0fe9c6ff1e7a17d471b25afbfa6466073a8d28 (diff) | |
parent | 259b441265677906631c923d8fe51f549adfc120 (diff) | |
download | vaadin-framework-251e140917efc4e63826d8800b1dda1694f89fea.tar.gz vaadin-framework-251e140917efc4e63826d8800b1dda1694f89fea.zip |
Merge "Remove Window.addComponent() (#2924)"
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/com/vaadin/server/ComponentSizeValidator.java | 28 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/Window.java | 34 |
2 files changed, 15 insertions, 47 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"); - } - } - /* ********************************************************************* */ /* |