// hierarchy, unregister it and any possible
// children. The UIConnector should never be
// unregistered even though it has no parent.
+ Profiler.enter("unregisterRemovedConnectors unregisterConnector");
connectorMap.unregisterConnector(c);
+ Profiler.leave("unregisterRemovedConnectors unregisterConnector");
unregistered++;
}
JsArrayString hierarchyKeys = hierarchies.getKeyArray();
for (int i = 0; i < hierarchyKeys.length(); i++) {
try {
+ Profiler.enter("updateConnectorHierarchy hierarchy entry");
+
String connectorId = hierarchyKeys.get(i);
ServerConnector parentConnector = connectorMap
.getConnector(connectorId);
.getJSStringArray(connectorId);
int childConnectorSize = childConnectorIds.length();
+ Profiler.enter("updateConnectorHierarchy find new connectors");
+
List<ServerConnector> newChildren = new ArrayList<ServerConnector>();
List<ComponentConnector> newComponents = new ArrayList<ComponentConnector>();
for (int connectorIndex = 0; connectorIndex < childConnectorSize; connectorIndex++) {
}
}
+ Profiler.leave("updateConnectorHierarchy find new connectors");
+
// TODO This check should be done on the server side in
// the future so the hierarchy update is only sent when
// something actually has changed
continue;
}
+ Profiler.enter("updateConnectorHierarchy handle HasComponentsConnector");
+
if (parentConnector instanceof HasComponentsConnector) {
HasComponentsConnector ccc = (HasComponentsConnector) parentConnector;
List<ComponentConnector> oldComponents = ccc
+ " has component children even though it isn't a HasComponentsConnector");
}
+ Profiler.leave("updateConnectorHierarchy handle HasComponentsConnector");
+
+ Profiler.enter("updateConnectorHierarchy setChildren");
parentConnector.setChildren(newChildren);
+ Profiler.leave("updateConnectorHierarchy setChildren");
+
+ Profiler.enter("updateConnectorHierarchy find removed children");
/*
* Find children removed from this parent and mark for
maybeDetached.add(oldChild.getConnectorId());
}
}
+
+ Profiler.leave("updateConnectorHierarchy find removed children");
} catch (final Throwable e) {
VConsole.error(e);
+ } finally {
+ Profiler.leave("updateConnectorHierarchy hierarchy entry");
}
}
+ Profiler.enter("updateConnectorHierarchy detach removed connectors");
+
/*
* Connector is in maybeDetached at this point if it has been
* removed from its parent but not added to any other parent
recursivelyDetach(removed, result.events);
}
+ Profiler.leave("updateConnectorHierarchy detach removed connectors");
+
Profiler.leave("updateConnectorHierarchy");
return result;
* is the closest we can get without data from the server.
* #10151
*/
+ Profiler.enter("ApplicationConnection recursivelyDetach reset state");
try {
+ Profiler.enter("ApplicationConnection recursivelyDetach reset state - getStateType");
Type stateType = AbstractConnector.getStateType(connector);
+ Profiler.leave("ApplicationConnection recursivelyDetach reset state - getStateType");
// Empty state instance to get default property values from
+ Profiler.enter("ApplicationConnection recursivelyDetach reset state - createInstance");
Object defaultState = stateType.createInstance();
+ Profiler.leave("ApplicationConnection recursivelyDetach reset state - createInstance");
- SharedState state = connector.getState();
-
- JsArrayObject<Property> properties = stateType
- .getPropertiesAsArray();
- int size = properties.size();
- for (int i = 0; i < size; i++) {
- Property property = properties.get(i);
- property.setValue(state,
- property.getValue(defaultState));
+ if (connector instanceof AbstractConnector) {
+ // optimization as the loop setting properties is very
+ // slow, especially on IE8
+ replaceState((AbstractConnector) connector,
+ defaultState);
+ } else {
+ SharedState state = connector.getState();
+
+ Profiler.enter("ApplicationConnection recursivelyDetach reset state - properties");
+ JsArrayObject<Property> properties = stateType
+ .getPropertiesAsArray();
+ int size = properties.size();
+ for (int i = 0; i < size; i++) {
+ Property property = properties.get(i);
+ property.setValue(state,
+ property.getValue(defaultState));
+ }
+ Profiler.leave("ApplicationConnection recursivelyDetach reset state - properties");
}
} catch (NoDataException e) {
throw new RuntimeException("Can't reset state for "
+ Util.getConnectorString(connector), e);
+ } finally {
+ Profiler.leave("ApplicationConnection recursivelyDetach reset state");
}
+ Profiler.enter("ApplicationConnection recursivelyDetach perform detach");
/*
* Recursively detach children to make sure they get
* setParent(null) and hierarchy change events as needed.
}
recursivelyDetach(child, events);
}
+ Profiler.leave("ApplicationConnection recursivelyDetach perform detach");
/*
* Clear child list and parent
*/
+ Profiler.enter("ApplicationConnection recursivelyDetach clear children and parent");
connector
.setChildren(Collections.<ServerConnector> emptyList());
connector.setParent(null);
+ Profiler.leave("ApplicationConnection recursivelyDetach clear children and parent");
/*
* Create an artificial hierarchy event for containers to give
* it a chance to clean up after its children if it has any
*/
+ Profiler.enter("ApplicationConnection recursivelyDetach create hierarchy event");
if (connector instanceof HasComponentsConnector) {
HasComponentsConnector ccc = (HasComponentsConnector) connector;
List<ComponentConnector> oldChildren = ccc
events.add(event);
}
}
+ Profiler.leave("ApplicationConnection recursivelyDetach create hierarchy event");
}
+ private native void replaceState(AbstractConnector connector,
+ Object defaultState)
+ /*-{
+ connector.@com.vaadin.client.ui.AbstractConnector::state = defaultState;
+ }-*/;
+
private void handleRpcInvocations(ValueMap json) {
if (json.containsKey("rpc")) {
Profiler.enter("handleRpcInvocations");