}
// if a component is marked transient do not persist its state as
// well as its children.
if (!kid.isTransient()) {
TreeStructure treeStructureChild = new TreeStructure(kid);
treeStructure.addChild(treeStructureChild);
buildTreeStructureToSave(context, kid, treeStructureChild,
componentIds);
}
}
// save structure info of the facets of the component currenly being
// processed.
Iterator facets = component.getFacets().keySet().iterator();
while (facets.hasNext()) {
String facetName = (String) facets.next();
UIComponent facetComponent = (UIComponent) component.getFacets().
get(facetName);
// check for id uniqueness
id = facetComponent.getClientId(context);
if (id != null && !componentIds.add(id)) {
throw new IllegalStateException(MessageUtils.getExceptionMessageString(
MessageUtils.DUPLICATE_COMPONENT_ID_ERROR_ID,
new Object[]{id}));
}
// if a facet is marked transient do not persist its state as well as
// its children.
if (!(facetComponent.isTransient())) {
TreeStructure treeStructureFacet =
new TreeStructure(facetComponent);
treeStructure.addFacet(facetName, treeStructureFacet);
// process children of facet.
buildTreeStructureToSave(context,
facetComponent, treeStructureFacet,
componentIds);