public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange");
Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange add children");
int index = 0;
for (ComponentConnector child : getChildComponents()) {
VCaption childCaption = childIdToCaption
.get(child.getConnectorId());
if (childCaption != null) {
getWidget().addOrMove(childCaption, index++);
}
getWidget().addOrMove(child.getWidget(), index++);
}
Profiler.leave("CssLayoutConnector.onConnectorHierarchyChange add children");
// Detach old child widgets and possibly their caption
Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange remove old children");
for (ComponentConnector child : event.getOldChildren()) {
if (child.getParent() == this) {
// Skip current children
continue;
}
getWidget().remove(child.getWidget());
VCaption vCaption = childIdToCaption.get(child.getConnectorId());
if (vCaption != null) {
childIdToCaption.remove(child.getConnectorId());
getWidget().remove(vCaption);
}
}