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 2009/11/05 11:33:18 UTC

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

Author: lofwyr
Date: Thu Nov  5 10:32:57 2009
New Revision: 833028

URL: http://svn.apache.org/viewvc?rev=833028&view=rev
Log:
TOBAGO-412: Supplement: compilable

Modified:
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.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=833028&r1=833027&r2=833028&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 Thu Nov  5 10:32:57 2009
@@ -104,7 +104,9 @@
     storeFooterHeight(facesContext, uiComponent);
     UIData data = (UIData) uiComponent;
 
-    ensureColumnWidthList(facesContext, data);
+    Style style = new Style(facesContext, data);
+    
+    ensureColumnWidthList(facesContext, data, style);
 
     final String sheetId = data.getClientId(facesContext);
 
@@ -114,7 +116,6 @@
     writer.startElement(HtmlConstants.DIV, data);
     writer.writeIdAttribute(sheetId + "_outer_div");
     writer.writeClassAttribute("tobago-sheet-outer-div");
-    Style style = new Style(facesContext, data);
     writer.writeStyleAttribute(style);
     UICommand clickAction = null;
     UICommand dblClickAction = null;
@@ -141,7 +142,7 @@
       i++;
     }
 
-    renderSheet(facesContext, data, (clickAction != null || dblClickAction != null));
+    renderSheet(facesContext, data, (clickAction != null || dblClickAction != null), style);
 
     writer.endElement(HtmlConstants.DIV);
 
@@ -173,7 +174,8 @@
     HtmlRendererUtils.writeScriptLoader(facesContext, SCRIPTS, cmds);
   }
 
-  private void renderSheet(FacesContext facesContext, UIData data, boolean hasClickAction) throws IOException {
+  private void renderSheet(FacesContext facesContext, UIData data, boolean hasClickAction, Style style) 
+      throws IOException {
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
     ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
     UIViewRoot viewRoot = facesContext.getViewRoot();
@@ -184,7 +186,6 @@
     String selectorDisabled = contextPath + resourceManager.getImage(viewRoot, "image/sheetUncheckedDisabled.gif");
     String unchecked = contextPath + resourceManager.getImage(viewRoot, "image/sheetUnchecked.gif");
 
-    Style style = HtmlRendererUtils.ensureStyleAttributeMap(data);
     //Style headerStyle = (Style) attributes.get(STYLE_HEADER);
 //    String sheetWidthString = LayoutUtils.getStyleAttributeValue(style,
 //        "width");
@@ -295,7 +296,7 @@
 //      intSpace -= columnWidths.get(columnWidths.size() - 1);
       Measure space = bodyStyle.getWidth();
       space.subtractNotNegative(getContentBorder(facesContext, data));
-      if (needVerticalScrollbar(facesContext, data)) {
+      if (needVerticalScrollbar(facesContext, data, style)) {
         space.subtractNotNegative(getScrollbarWidth(facesContext, data));
       }
       sheetBodyStyle.setWidth(space);
@@ -624,7 +625,7 @@
 
   }
 
-  public boolean needVerticalScrollbar(FacesContext facesContext, UIData data) {
+  private boolean needVerticalScrollbar(FacesContext facesContext, UIData data, Style style) {
     // estimate need of height-scrollbar on client, if yes we have to consider
     // this when calculating column width's
 
@@ -641,7 +642,6 @@
       }
     }
 
-    Style style = HtmlRendererUtils.ensureStyleAttributeMap(data);
     if (style.getHeight() != null) {
       int first = data.getFirst();
       int rows = Math.min(data.getRowCount(), first + data.getRows()) - first;
@@ -1089,6 +1089,7 @@
   public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
     
     UIData data = (UIData) component; 
+    Style style = new Style(facesContext, data);
     
     AjaxUtils.checkParamValidity(facesContext, data, UIData.class);
     // TODO find a better way
@@ -1111,16 +1112,16 @@
         }
       }
     }
-    ensureColumnWidthList(facesContext, data);
+    ensureColumnWidthList(facesContext, data, style);
 
-    renderSheet(facesContext, data, (clickAction != null || dblClickAction != null));
+    renderSheet(facesContext, data, (clickAction != null || dblClickAction != null), style);
   }
 
   public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
     // DO Nothing
   }
 
-  private void ensureColumnWidthList(FacesContext facesContext, UIData data) {
+  private void ensureColumnWidthList(FacesContext facesContext, UIData data, Style style) {
     List<Integer> currentWidthList = null;
     List<UIColumn> rendererdColumns = data.getRenderedColumns();
 
@@ -1167,7 +1168,7 @@
 
       Measure space = data.getWidth();
       space.subtractNotNegative(getContentBorder(facesContext, data));
-      if (needVerticalScrollbar(facesContext, data)) {
+      if (needVerticalScrollbar(facesContext, data, style)) {
         space.subtractNotNegative(getScrollbarWidth(facesContext, data));
       }
       LayoutInfo layoutInfo =

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java?rev=833028&r1=833027&r2=833028&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java Thu Nov  5 10:32:57 2009
@@ -180,7 +180,7 @@
       writer.writeClassAttribute(styleClasses);
 
       // div style (width)
-      Style style = HtmlRendererUtils.ensureStyleAttributeMap(tree);
+      Style style = new Style(facesContext, tree);
       String widthString;
       if (style != null && style.getWidth() != null) {
         widthString = "width: " + Integer.toString(style.getWidth().getPixel() - 22); // fixme: 4 + 18 for scrollbar