aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/ui/CustomComponent.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/itmill/toolkit/ui/CustomComponent.java b/src/com/itmill/toolkit/ui/CustomComponent.java
index 4815c3561b..cd5c6725d4 100644
--- a/src/com/itmill/toolkit/ui/CustomComponent.java
+++ b/src/com/itmill/toolkit/ui/CustomComponent.java
@@ -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;
}
}