/**
* For internal use only. May be removed or replaced in the future.
+ *
+ * @deprecated since 7.1.4 no longer used by the framework, might be removed
*/
+ @Deprecated
public void addOrMove(Widget child, int index) {
Profiler.enter("VCssLayout.addOrMove");
if (child.getParent() == this) {
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ConnectorHierarchyChangeEvent;
import com.vaadin.client.FastStringMap;
+import com.vaadin.client.Profiler;
import com.vaadin.client.Util;
import com.vaadin.client.VCaption;
import com.vaadin.client.communication.StateChangeEvent;
*/
@Override
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
- int index = 0;
+ Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange");
+ Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange add children");
+ // for large layouts, significantly faster to clear the list and always
+ // append to the end than to move the children around
+ getWidget().clear();
for (ComponentConnector child : getChildComponents()) {
VCaption childCaption = childIdToCaption
.get(child.getConnectorId());
if (childCaption != null) {
- getWidget().addOrMove(childCaption, index++);
+ getWidget().add(childCaption);
}
- getWidget().addOrMove(child.getWidget(), index++);
+ getWidget().add(child.getWidget());
}
+ 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
getWidget().remove(vCaption);
}
}
+ Profiler.leave("CssLayoutConnector.onConnectorHierarchyChange remove old children");
+ Profiler.leave("CssLayoutConnector.onConnectorHierarchyChange");
}
/**