public void setPopupConnector(ComponentConnector newPopupComponent) { if (newPopupComponent != popupComponentConnector) { if (popupComponentConnector != null) { popupComponentConnector.removeStateChangeHandler(this); } Widget newWidget = newPopupComponent.getWidget(); setWidget(newWidget); popupComponentWidget = newWidget; popupComponentConnector = newPopupComponent; popupComponentConnector.addStateChangeHandler("height", this); popupComponentConnector.addStateChangeHandler("width", this); } }
@Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { ComponentConnector oldChild = null; ComponentConnector newChild = getContent(); for (ComponentConnector c : event.getOldChildren()) { if (!(c instanceof WindowConnector)) { oldChild = c; break; } } if (oldChild != newChild) { if (childStateChangeHandlerRegistration != null) { childStateChangeHandlerRegistration.removeHandler(); childStateChangeHandlerRegistration = null; } if (newChild != null) { getWidget().setWidget(newChild.getWidget()); childStateChangeHandlerRegistration = newChild.addStateChangeHandler(childStateChangeHandler); // Must handle new child here as state change events are already // fired onChildSizeChange(); } else { getWidget().setWidget(null); } } for (ComponentConnector c : getChildComponents()) { if (c instanceof WindowConnector) { WindowConnector wc = (WindowConnector) c; wc.setWindowOrderAndPosition(); } } // Close removed sub windows for (ComponentConnector c : event.getOldChildren()) { if (c.getParent() != this && c instanceof WindowConnector) { ((WindowConnector) c).getWidget().hide(); } } }