You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mk...@apache.org on 2007/03/29 21:10:08 UTC

svn commit: r523800 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java

Author: mkienenb
Date: Thu Mar 29 12:10:07 2007
New Revision: 523800

URL: http://svn.apache.org/viewvc?view=rev&rev=523800
Log:
Fix for TOMAHAWK-520 - [t:tabbedPane] Component creates two tags with the same id
Thanks to Mathias Werlitz.

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java?view=diff&rev=523800&r1=523799&r2=523800
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java Thu Mar 29 12:10:07 2007
@@ -65,6 +65,7 @@
     private static final String DEFAULT_BG_COLOR = "white";
 
     private static final String AUTO_FORM_SUFFIX = ".autoform";
+    private static final String TAB_DIV_SUFFIX = ".content";
 
 
     public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException
@@ -129,7 +130,7 @@
                 UIComponent child = getUIComponent((UIComponent)children.get(i));
                 if (child instanceof HtmlPanelTab && child.isRendered()){
                     HtmlPanelTab tab = (HtmlPanelTab) child;
-                    tabIDs.add( child.getClientId(facesContext) );
+                    tabIDs.add( child.getClientId(facesContext) + TAB_DIV_SUFFIX);
                     if( ! isDisabled(facesContext, tab) )
                         headerIDs.add( getHeaderCellID(tab, facesContext) );
                 }
@@ -444,7 +445,7 @@
                 writer.writeAttribute(HTML.ONCLICK_ATTR,
                                       "return myFaces_showPanelTab("
                                       +tabIndex+",'"+getTabIndexSubmitFieldIDAndName(tabbedPane, facesContext)+"',"
-                                      +'\''+getHeaderCellID(tab, facesContext)+"','"+tab.getClientId(facesContext)+"',"
+                                      +'\''+getHeaderCellID(tab, facesContext)+"','"+tab.getClientId(facesContext) + TAB_DIV_SUFFIX +"',"
                                       +getHeaderCellsIDsVar(tabbedPane,facesContext)+','+getTabsIDsVar(tabbedPane,facesContext)+','
                                       + (activeUserClass==null ? "null" : '\''+activeUserClass+'\'')+','+ (inactiveUserClass==null ? "null" : '\''+inactiveUserClass+'\'')+','
                                       + (activeSubStyleUserClass==null ? "null" : '\''+activeSubStyleUserClass+'\'')+','+ (inactiveSubStyleUserClass==null ? "null" : '\''+inactiveSubStyleUserClass+'\'')+");",
@@ -540,7 +541,7 @@
 
                 HtmlPanelTab tab = (HtmlPanelTab)child;
                 writer.startElement(HTML.DIV_ELEM, tabbedPane);
-                writer.writeAttribute(HTML.ID_ATTR, tab.getClientId(facesContext), null);
+               writer.writeAttribute(HTML.ID_ATTR, tab.getClientId(facesContext) + TAB_DIV_SUFFIX, null);
                 // the inactive tabs are hidden with a div-tag
                 if (tabIdx != selectedIndex) {
                     writer.writeAttribute(HTML.STYLE_ATTR, "display:none", null);