diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java b/src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java index bcefcf05cb..408f03f6cb 100644 --- a/src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java +++ b/src/com/vaadin/terminal/gwt/client/extensions/AbstractExtensionConnector.java @@ -8,17 +8,26 @@ import com.vaadin.terminal.gwt.client.ServerConnector; import com.vaadin.terminal.gwt.client.ui.AbstractConnector; public abstract class AbstractExtensionConnector extends AbstractConnector { + boolean hasBeenAttached = false; + @Override public void setParent(ServerConnector parent) { ServerConnector oldParent = getParent(); - if (oldParent != null && oldParent != parent) { + if (oldParent == parent) { + // Nothing to do + return; + } + if (hasBeenAttached && parent != null) { throw new IllegalStateException( "An extension can not be moved from one parent to another."); } super.setParent(parent); - extend(parent); + if (parent != null) { + extend(parent); + hasBeenAttached = true; + } } protected void extend(ServerConnector target) { |