You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ca...@apache.org on 2009/03/27 16:43:19 UTC

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

Author: cagatay
Date: Fri Mar 27 15:43:19 2009
New Revision: 759180

URL: http://svn.apache.org/viewvc?rev=759180&view=rev
Log:
Fix for TOMAHAWK-1405, style and styleClass attributes of individual tabs were ignored

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?rev=759180&r1=759179&r2=759180&view=diff
==============================================================================
--- 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 Fri Mar 27 15:43:19 2009
@@ -328,22 +328,17 @@
                 false);
     }
 
-    protected String getActiveHeaderClasses(HtmlPanelTabbedPane tabbedPane){
-        String userActiveStyleClass = tabbedPane.getActiveTabStyleClass();
+    protected String getHeaderClasses(HtmlPanelTabbedPane tabbedPane, HtmlPanelTab tab, String defaultClass, String userClass){
+        String headerCellClass = defaultClass;
+        String userTabStyleClass = tab.getStyleClass();
 
-        if( userActiveStyleClass == null || userActiveStyleClass.length() == 0 )
-            return ACTIVE_HEADER_CELL_CLASS;
+        if( userClass != null )
+            headerCellClass = headerCellClass + " " + userClass;
 
-        return ACTIVE_HEADER_CELL_CLASS+' '+userActiveStyleClass;
-    }
-
-    protected String getInactiveHeaderClasses(HtmlPanelTabbedPane tabbedPane){
-        String userInactiveStyleClass = tabbedPane.getInactiveTabStyleClass();
-
-        if( userInactiveStyleClass == null || userInactiveStyleClass.length() == 0 )
-            return INACTIVE_HEADER_CELL_CLASS;
+        if( userTabStyleClass != null )
+            headerCellClass = headerCellClass + " " + userTabStyleClass;
 
-        return INACTIVE_HEADER_CELL_CLASS+' '+userInactiveStyleClass;
+        return headerCellClass;
     }
 
     protected void writeTableStart(ResponseWriter writer,
@@ -413,17 +408,20 @@
             if (active)
             {
                 writer.writeAttribute(HTML.CLASS_ATTR,
-                                      getActiveHeaderClasses(tabbedPane),
+                                      getHeaderClasses(tabbedPane, tab, ACTIVE_HEADER_CELL_CLASS, tabbedPane.getActiveTabStyleClass()),
                                       null);
             }
             else
             {
                 writer.writeAttribute(HTML.CLASS_ATTR,
-                                      getInactiveHeaderClasses(tabbedPane),
+                                      getHeaderClasses(tabbedPane, tab, INACTIVE_HEADER_CELL_CLASS, tabbedPane.getInactiveTabStyleClass()),
                                       null);
             }
         }
-
+      
+        if (tab.getStyle() != null) {
+            writer.writeAttribute(HTML.STYLE_ATTR, tab.getStyle(), null);
+        }
 
         String label = tab.getLabel();
         if (label == null || label.length() == 0)