You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/04/07 20:33:50 UTC

svn commit: r931638 - /myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java

Author: lofwyr
Date: Wed Apr  7 18:33:50 2010
New Revision: 931638

URL: http://svn.apache.org/viewvc?rev=931638&view=rev
Log:
TOBAGO-828: Setting header width

Modified:
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=931638&r1=931637&r2=931638&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Wed Apr  7 18:33:50 2010
@@ -163,7 +163,7 @@ public class SheetRenderer extends Layou
       };
 
       HtmlRendererUtils.writeScriptLoader(facesContext, SCRIPTS, cmds);
-  }
+    }
   }
 
   private void renderSheet(FacesContext facesContext, UISheet sheet, boolean hasClickAction, Style style)
@@ -248,15 +248,17 @@ public class SheetRenderer extends Layou
       bodyStyle.setPaddingTop(Measure.ZERO);
     }
     writer.writeStyleAttribute(bodyStyle);
-    if (bodyStyle.getWidth() != null) {
+//    if (bodyStyle.getWidth() != null) {
 //      intSpace -= columnWidths.get(columnWidths.size() - 1);
-      Measure space = bodyStyle.getWidth();
-      space.subtractNotNegative(getContentBorder(facesContext, sheet));
-      if (needVerticalScrollbar(facesContext, sheet, style)) {
-        space.subtractNotNegative(getVerticalScrollbarWeight(facesContext, sheet));
-      }
-      sheetBodyStyle.setWidth(space);
-    }
+    Measure space = bodyStyle.getWidth();
+    final boolean needVerticalScrollbar = needVerticalScrollbar(facesContext, sheet, style);
+    if (needVerticalScrollbar) {
+      space = space.subtractNotNegative(getVerticalScrollbarWeight(facesContext, sheet));
+    }
+    Measure headerWidth = space;
+    space = space.subtractNotNegative(getContentBorder(facesContext, sheet));
+    sheetBodyStyle.setWidth(space);
+//    }
     sheetBodyStyle.setHeight(null);
 
     writer.startElement(HtmlConstants.TABLE, null);
@@ -410,7 +412,8 @@ public class SheetRenderer extends Layou
 
     if (showHeader) {
       renderColumnHeaders(
-          facesContext, sheet, writer, resourceManager, contextPath, sheetId, image1x1, renderedColumnList);
+          facesContext, sheet, writer, resourceManager, contextPath, sheetId, image1x1, renderedColumnList,
+          headerWidth);
     }
 
     final String showRowRange
@@ -726,11 +729,15 @@ public class SheetRenderer extends Layou
 
   private void renderColumnHeaders(
       FacesContext facesContext, UISheet sheet, TobagoResponseWriter writer, ResourceManager resourceManager,
-      String contextPath, String sheetId, String image1x1, List<UIColumn> renderedColumnList) throws IOException {
+      String contextPath, String sheetId, String image1x1, List<UIColumn> renderedColumnList,
+      Measure headerWidth) throws IOException {
     // begin rendering header
     writer.startElement(HtmlConstants.DIV, null);
     writer.writeIdAttribute(sheetId + "_header_div");
     writer.writeClassAttribute("tobago-sheet-header-div");
+    Style style = new Style();
+    style.setWidth(headerWidth);
+    writer.writeStyleAttribute(style);
 
     int columnCount = 0;
     Measure sortMarkerWidth = getAscendingMarkerWidth(facesContext, sheet);