myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r544941 - in /myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: renderkit/core/xhtml/StyleSheetRenderer.java skin/SkinUtils.java ui/laf/xml/parse/SkinAdditionNode.java
Date Wed, 06 Jun 2007 20:30:04 GMT
Author: jwaldman
Date: Wed Jun  6 13:30:03 2007
New Revision: 544941

URL: http://svn.apache.org/viewvc?view=rev&rev=544941
Log:
TRINIDAD-49 ignore skin-addition's jar ordering when generating the stylesheet hashcode
Changes to SkinUtils.java and SkinAdditionNode.java
Comment changes only to StyleSheetRenderer.java

checked into trunk

Modified:
    myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
    myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
    myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/xml/parse/SkinAdditionNode.java

Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java?view=diff&rev=544941&r1=544940&r2=544941
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
Wed Jun  6 13:30:03 2007
@@ -157,6 +157,12 @@
   }
 
   // returns true if we want to suppress the stylesheet.
+  // It checks for suppressStylesheet flag on the request map and 
+  // for the skin-id on the request map to exist identically on the server.
+  //
+  // This is usually called in a portal environment when we want to suppress the
+  // producer (portlet)'s stylesheet and use the consumer (portal container)'s 
+  // instead for performance enhancements.
   private boolean _isSuppressStylesheet(FacesContext context,  RenderingContext arc)
   {
 
@@ -165,6 +171,10 @@
     boolean suppressStylesheet = "true".equals(requestMap.get(_SUPPRESS_STYLESHEET_ID_PARAM));
     if (suppressStylesheet)
     {
+      // getRequestMapSkin --
+      // See if a skin-id is requested on the requestMap. If so, then see if the Skin
+      // with that id exists on the server, and if it does, and if it is an exact match
+      // (styleSheetDocumentIds match), then it returns the Skin. Otherwise, it returns null
       Skin requestMapSkin = ((CoreRenderingContext) arc).getRequestMapSkin();
       return (requestMapSkin != null) ? true : false;
     }

Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java?view=diff&rev=544941&r1=544940&r2=544941
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
Wed Jun  6 13:30:03 2007
@@ -25,6 +25,7 @@
 import java.net.URL;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Enumeration;
 
 import java.util.Iterator;
@@ -339,11 +340,8 @@
     // webInfSkinsNode object
     FacesContext fContext = FacesContext.getCurrentInstance();
     // register skin-additions from META-INF/trinidad-skins.xml files
-    for (SkinsNode skinsNode : metaInfSkinsNodeList)
-    {
-      List<SkinAdditionNode> skinAdditionNodeList = skinsNode.getSkinAdditionNodes();
-      _registerSkinAdditions(fContext, skinFactory, skinAdditionNodeList, true);    
-    } 
+    _registerMetaInfSkinAdditions(fContext, skinFactory, metaInfSkinsNodeList);
+
     // register skin-additions from WEB-INF/trinidad-skins.xml file
     if (webInfSkinsNode != null)
     {
@@ -610,6 +608,28 @@
       _LOG.severe(_UNKNOWN_BASE_SKIN_ERROR + baseSkinId);
 
     return baseSkin;
+  }
+  
+  // register the META-INF skin additions. 
+  // It should not matter what order we process skin-additions since they should not 
+  // depend upon one another.
+  // We sort them by style-sheet-name so the StyleSheetDocumentId will be the same regardless
+  // of order. Portals are using the styleSheetDocumentId to determine if the producer's
skin
+  // matches the consumer's skin, and the order of the skin-additions should not change this.
+  private static void _registerMetaInfSkinAdditions(
+    FacesContext    fContext,
+    SkinFactory     skinFactory,
+    List<SkinsNode> metaInfSkinsNodeList)
+  {
+    List<SkinAdditionNode> skinAdditionNodeList = new ArrayList<SkinAdditionNode>();
+    
+    for (SkinsNode skinsNode : metaInfSkinsNodeList)
+    {
+      skinAdditionNodeList.addAll(skinsNode.getSkinAdditionNodes());
+    } 
+    
+    Collections.sort(skinAdditionNodeList);
+    _registerSkinAdditions(fContext, skinFactory, skinAdditionNodeList, true);
   }
   
   /**

Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/xml/parse/SkinAdditionNode.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/xml/parse/SkinAdditionNode.java?view=diff&rev=544941&r1=544940&r2=544941
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/xml/parse/SkinAdditionNode.java
(original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/xml/parse/SkinAdditionNode.java
Wed Jun  6 13:30:03 2007
@@ -25,7 +25,7 @@
  * @deprecated This class comes from the old Java 1.2 UIX codebase and should not be used
anymore.
  */
 @Deprecated
-public class SkinAdditionNode
+public class SkinAdditionNode implements Comparable<SkinAdditionNode>
 {
 
   /**
@@ -60,7 +60,13 @@
     _styleSheetName = ssName;
   }
   
+  // Sort by the name of the stylesheet
+  public int compareTo(SkinAdditionNode node)
+  {
+    return getStyleSheetName().compareTo(node.getStyleSheetName());
+  }
+  
   private String _skinId;
   private String _styleSheetName;
 
-}
\ No newline at end of file
+}



Mime
View raw message