You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2008/05/07 12:18:09 UTC

svn commit: r654063 - in /myfaces/tobago/branches/tobago-1.0.x: core/src/main/java/org/apache/myfaces/tobago/renderkit/html/ core/src/main/java/org/apache/myfaces/tobago/taglib/component/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/render...

Author: bommel
Date: Wed May  7 03:18:08 2008
New Revision: 654063

URL: http://svn.apache.org/viewvc?rev=654063&view=rev
Log:
some minor optimizations

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/StyleClasses.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java?rev=654063&r1=654062&r2=654063&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java Wed May  7 03:18:08 2008
@@ -57,6 +57,7 @@
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.StringTokenizer;
 
@@ -703,4 +704,19 @@
     strBuilder.append("]");
     return strBuilder.toString();
   }
+
+  public static void removeStyleClasses(UIComponent cell) {
+    Object obj = cell.getAttributes().get(org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS);
+    if (obj != null && obj instanceof StyleClasses && cell.getRendererType() != null) {
+      StyleClasses styleClasses = (StyleClasses) obj;
+      if (!styleClasses.isEmpty()) {
+        String rendererName = cell.getRendererType().substring(0, 1).toLowerCase(Locale.ENGLISH)
+            + cell.getRendererType().substring(1);
+        styleClasses.removeTobagoClasses(rendererName);
+      }
+      if (styleClasses.isEmpty()) {
+        cell.getAttributes().remove(org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS);
+      }
+    }
+  }
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/StyleClasses.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/StyleClasses.java?rev=654063&r1=654062&r2=654063&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/StyleClasses.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/StyleClasses.java Wed May  7 03:18:08 2008
@@ -232,6 +232,10 @@
     }
   }
 
+  public boolean isEmpty() {
+    return classes.isEmpty();  
+  }
+
   @Override
   public String toString() {
     if (classes.isEmpty()) {

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java?rev=654063&r1=654062&r2=654063&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java Wed May  7 03:18:08 2008
@@ -36,10 +36,10 @@
 public class PageTag extends TobagoBodyTag
     implements BodyTag, PageTagDeclaration {
 
-  private String doctype = "loose";
+  private String doctype;
 
   // TODO move to renderkit
-  private String method = "POST";
+  private String method;
 
   private String state;
 
@@ -61,7 +61,6 @@
     page.getPopups().clear();
 
     // reseting doctype and charset
-    doctype = "loose";
     return result;
   }
 
@@ -71,8 +70,8 @@
 
   public void release() {
     super.release();
-    doctype = "loose";
-    method = "POST";
+    doctype = null;
+    method = null;
     state = null;
     focusId = null;
     label = null;

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java?rev=654063&r1=654062&r2=654063&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java Wed May  7 03:18:08 2008
@@ -45,6 +45,7 @@
     for (Object o : component.getChildren()) {
       UIComponent child = (UIComponent) o;
       RenderUtil.encode(facesContext, child);
+      HtmlRendererUtil.removeStyleClasses(child);
     }
   }
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java?rev=654063&r1=654062&r2=654063&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java Wed May  7 03:18:08 2008
@@ -382,6 +382,9 @@
             writer.endElement(HtmlConstants.TD);
 
             firstRenderedColum = false;
+
+            HtmlRendererUtil.removeStyleClasses(cell);
+
           }
         }