Author: nbelaevski
Date: 2009-04-30 12:51:07 -0400 (Thu, 30 Apr 2009)
New Revision: 13973
Modified:
trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java
Log:
https://jira.jboss.org/jira/browse/RF-6911
Modified:
trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java
===================================================================
---
trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java 2009-04-30
16:25:32 UTC (rev 13972)
+++
trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabPanelRendererBase.java 2009-04-30
16:51:07 UTC (rev 13973)
@@ -24,8 +24,10 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
@@ -339,7 +341,7 @@
TabInfoCollector tabInfoCollector = getTabInfoCollector();
- UITab prevTab = null;
+ Set<Object> tabNamesSet = new HashSet<Object>();
for (Iterator iter = pane.getRenderedTabs(); iter.hasNext();) {
UITab tab = (UITab) iter.next();
@@ -350,10 +352,8 @@
clientSide =
UISwitchablePanel.CLIENT_METHOD.equals(tab.getSwitchTypeOrDefault());
}
- if(prevTab != null){
- if(prevTab.getName().equals(tab.getName())){
- throw new FacesException(TABS_WITH_SAME_NAMES_ERROR);
- };
+ if (!tabNamesSet.add(tab.getName())) {
+ throw new FacesException(TABS_WITH_SAME_NAMES_ERROR);
}
tab.encodeTab(context, active);
@@ -361,8 +361,6 @@
if (!tab.isDisabled()) {
tabs.add(tabInfoCollector.collectTabInfo(context, tab));
}
-
- prevTab = tab;
}
// Store flag for exist client-side tabs.