/**
* Restore to original for rendering
*/
private void restorePartialView(FacesContext facesContext) {
PartialViewRoot partialView = (PartialViewRoot) facesContext.getViewRoot();
for (int i = 0; i < partialView.getChildCount(); i++) {
UIComponent kid = partialView.getChildren().get(i);
kid.setParent(partialView.getParents().get(i));
}
facesContext.setViewRoot(partialView.getBase());
partialView = null;
}