tabPanel.setRenderedValue(null);
Object checkedValue = checkValue(tabPanel.getValue());
UITabPanel pane = tabPanel;
UITab activeTab = null;
TabsIteratorHelper helper = new TabsIteratorHelper(pane.getRenderedTabs(), checkedValue);
activeTab = helper.getTab();
if (activeTab == null) {
Object label = MessageUtil.getLabel(context, tabPanel);
String message = label + ": tab panel has no enabled or rendered tabs!";
context.getExternalContext().log(message);
return ;
}
if (helper.isFallback()) {
Object label = MessageUtil.getLabel(context, tabPanel);
String message = label + ": tab panel [@selectedTab=" + checkedValue +
"] has no enabled or rendered tab with such name. Tab: " + activeTab.getName() +
" will be used instead!";
context.getExternalContext().log(message);
tabPanel.setRenderedValue(activeTab.getName());
} else if (checkedValue == null) {
tabPanel.setRenderedValue(activeTab.getName());
} else {
tabPanel.setRenderedValue(null);
}
helper = null;
ArrayList tabs = new ArrayList();
boolean clientSide = UISwitchablePanel.CLIENT_METHOD.equals(pane.getSwitchType());
TabInfoCollector tabInfoCollector = getTabInfoCollector();
Set<Object> tabNamesSet = new HashSet<Object>();
for (Iterator iter = pane.getRenderedTabs(); iter.hasNext();) {
UITab tab = (UITab) iter.next();
boolean active = activeTab == tab;
tab.setActive(active);
if (!clientSide) {
clientSide = UISwitchablePanel.CLIENT_METHOD.equals(tab.getSwitchTypeOrDefault());
}
if (!tabNamesSet.add(tab.getName())) {
throw new FacesException(TABS_WITH_SAME_NAMES_ERROR);
}
tab.encodeTab(context, active);
if (!tab.isDisabled()) {
tabs.add(tabInfoCollector.collectTabInfo(context, tab));
}
}
// Store flag for exist client-side tabs.