@@ -154,22 +154,10 @@ public class ConnectorMap { | |||
} | |||
String connectorId = connector.getConnectorId(); | |||
VConsole.log("Unregistering connector " + connectorId + " (" | |||
+ connector.getClass().getName() + ")"); | |||
// Warn if widget is still attached to DOM. It should never be at this | |||
// point. | |||
Widget widget = null; | |||
if (connector instanceof ComponentConnector) { | |||
widget = ((ComponentConnector) connector).getWidget(); | |||
} | |||
if (widget != null && widget.isAttached()) { | |||
VConsole.log("Widget for unregistered connector " + connectorId | |||
+ " is still attached to the DOM."); | |||
} | |||
idToComponentDetail.remove(connectorId); | |||
idToConnector.remove(connectorId); | |||
connector.onUnregister(); | |||
if (connector instanceof ComponentContainerConnector) { | |||
for (ComponentConnector child : ((ComponentContainerConnector) connector) |
@@ -104,4 +104,10 @@ public interface ServerConnector extends Connector { | |||
* The event to send. | |||
*/ | |||
public void fireEvent(GwtEvent<?> event); | |||
/** | |||
* Event called when connector has been unregistered. | |||
*/ | |||
public void onUnregister(); | |||
} |
@@ -17,6 +17,7 @@ import com.vaadin.terminal.gwt.client.LayoutManager; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
import com.vaadin.terminal.gwt.client.TooltipInfo; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.communication.ServerRpc; | |||
import com.vaadin.terminal.gwt.client.communication.SharedState; | |||
@@ -371,4 +372,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector | |||
return (reg != null && reg.contains(eventIdentifier)); | |||
} | |||
@Override | |||
public void onUnregister() { | |||
super.onUnregister(); | |||
// Warn if widget is still attached to DOM. It should never be at this | |||
// point. | |||
if (getWidget() != null && getWidget().isAttached()) { | |||
VConsole.log("Widget for unregistered connector " | |||
+ Util.getConnectorString(this) | |||
+ " is still attached to the DOM."); | |||
} | |||
} | |||
} |
@@ -168,4 +168,13 @@ public abstract class AbstractConnector implements ServerConnector, | |||
+ " received by " + Util.getConnectorString(this)); | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.terminal.gwt.client.ServerConnector#onUnregister() | |||
*/ | |||
public void onUnregister() { | |||
VConsole.log("Unregistered connector " + Util.getConnectorString(this)); | |||
} | |||
} |