}
private boolean hasDefaultChild(List<UIComponent> children, boolean hasDefaultChildSoFar) {
for(UIComponent child : children) {
if(child instanceof AbstractTab) {
AbstractTab tab = (AbstractTab) child;
// If we already find a child so far, we need to disable any other tab#isDefault()
if(hasDefaultChildSoFar) {
tab.getAttributes().put(AbstractTab.DEFAULT_ATTRIBUTE_NAME, false);
}
// If not, we can take the value of the current tab
else {
hasDefaultChildSoFar = tab.isDefault();
}
} else if(child instanceof AbstractMenuFacet) {
boolean hasDefaultChildSoFarOld = hasDefaultChildSoFar;
hasDefaultChildSoFar = hasDefaultChild(child.getChildren(), hasDefaultChildSoFar);