]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed #1590: AbstractComponentContainer and CustomComponent setCompositionRoot throws...
authorJani Laakso <jani.laakso@itmill.com>
Wed, 23 Apr 2008 13:41:14 +0000 (13:41 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Wed, 23 Apr 2008 13:41:14 +0000 (13:41 +0000)
svn changeset:4208/svn branch:trunk

src/com/itmill/toolkit/ui/CustomComponent.java

index 4815c3561b8c06c08cb0a9bfc68f52b063effef4..cd5c6725d486001bfbb47cf93169e4518021cbd7 100644 (file)
@@ -83,12 +83,16 @@ public class CustomComponent extends AbstractComponentContainer {
      *                the root of the composition component tree.
      */
     protected final void setCompositionRoot(Component compositionRoot) {
-        if (compositionRoot != root && root != null) {
-            super.removeComponent(root);
-        }
-        root = compositionRoot;
-        if (root != null) {
-            super.addComponent(root);
+        if (compositionRoot != root) {
+            if (root != null) {
+                // remove old component
+                super.removeComponent(root);
+            }
+            if (compositionRoot != null) {
+                // set new component
+                super.addComponent(compositionRoot);
+            }
+            root = compositionRoot;
         }
     }