Map.Entry entry = (Map.Entry) entries.next();
if (entry.getValue() == component) {
incrementDynamicChildCount(component.getParent());
component.clearInitialState();
component.getAttributes().put(DYNAMIC_COMPONENT, component.getParent().getChildren().indexOf(component));
ComponentStruct struct = new ComponentStruct();
struct.action = ComponentStruct.ADD;
struct.facetName = entry.getKey().toString();
struct.parentClientId = component.getParent().getClientId(context);
struct.clientId = component.getClientId(context);
struct.id = component.getId();
handleAddRemoveWithAutoPrune(component, struct);
}
}
}
else {
incrementDynamicChildCount(component.getParent());
component.clearInitialState();
component.getAttributes().put(DYNAMIC_COMPONENT, component.getParent().getChildren().indexOf(component));
ComponentStruct struct = new ComponentStruct();
struct.action = ComponentStruct.ADD;
struct.parentClientId = component.getParent().getClientId(context);
struct.clientId = component.getClientId(context);
struct.id = component.getId();
handleAddRemoveWithAutoPrune(component, struct);