incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r505349 - in /incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: renderkit/core/StyleContextImpl.java style/StyleContext.java style/cache/FileSystemStyleCache.java
Date Fri, 09 Feb 2007 16:23:55 GMT
Author: jwaldman
Date: Fri Feb  9 08:23:54 2007
New Revision: 505349

URL: http://svn.apache.org/viewvc?view=rev&rev=505349
Log:
merged in 505034
I changed my implementation for 
http://issues.apache.org/jira/browse/ADFFACES-370 (Need to avoid IE's number of CSS selectors
limitation
) AGAIN
In Skin's getStyleClassMap(RenderingContext) we get the StyleContext from the RenderingContext.
This is fine, but the problem I found is that from FileSystemStyleCache the StyleContext is
not yet set up on the RenderingContext, so calling getStyleContext caused it to run through
all the code that processes all the skin files again (they are cached, so it doesn't get stuck
in a loop). Still, this is obviously not good.

If we could pass StyleContext to getStyleClassMap, then that would be good, but StyleContext
is not in the public api. That's why we pass in RenderingContext.

The change I made was to go back to looking to see if the skin's renderKitId is portlet. We
don't compress if portlet.

Modified:
    incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
    incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java
    incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java

Modified: incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java?view=diff&rev=505349&r1=505348&r2=505349
==============================================================================
--- incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
(original)
+++ incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
Fri Feb  9 08:23:54 2007
@@ -80,11 +80,6 @@
     return ((CoreRenderingContext) _arc).getTrinidadAgent();
   }
 
-  public Skin getSkin()
-  {
-    return ((CoreRenderingContext) _arc).getSkin();
-  }
-
   public boolean checkStylesModified()
   {
     // =-=AEW Expose a configuration option if this

Modified: incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java?view=diff&rev=505349&r1=505348&r2=505349
==============================================================================
--- incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java
(original)
+++ incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleContext.java
Fri Feb  9 08:23:54 2007
@@ -41,7 +41,6 @@
    * Returns the end user's Agent.
    */
   public TrinidadAgent getAgent();
-  public Skin getSkin();
 
   public String getGeneratedFilesPath();
   public boolean checkStylesModified();

Modified: incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java?view=diff&rev=505349&r1=505348&r2=505349
==============================================================================
--- incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
(original)
+++ incubator/adffaces/branches/faces-1_2-070201/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
Fri Feb  9 08:23:54 2007
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -50,6 +50,8 @@
 import org.apache.myfaces.trinidadinternal.share.io.NameResolver;
 import org.apache.myfaces.trinidad.context.LocaleContext;
 import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.skin.Skin;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.StyleSheetRenderer;
 import org.apache.myfaces.trinidadinternal.share.xml.JaxpXMLProvider;
 import org.apache.myfaces.trinidadinternal.share.xml.XMLProvider;
@@ -438,6 +440,7 @@
       return entry;
 
     // If we didn't find an entry in the cache, create a new entry
+    // This generates the CSS file.
     return _createEntry(context,
                         document,
                         cache,
@@ -706,15 +709,18 @@
     // Write out the style sheet
     // First figure out whether or not we need to compress the style classes.
     // We don't compress the style classes if the content compression flag is disabled or
-    // if the skin's styleClassMap does not match our shortStyleClassMap.
-    
-    Map skinsStyleClassMap = context.getSkin().getStyleClassMap(
-                                RenderingContext.getCurrentInstance());
-    String disableContentCompression = 
-      FacesContext.getCurrentInstance().getExternalContext().
-      getInitParameter(StyleSheetRenderer.DISABLE_CONTENT_COMPRESSION);
-    boolean compressStyles = (skinsStyleClassMap == shortStyleClassMap) && 
-                             !"true".equals(disableContentCompression);
+    // if the skin is a portlet skin.
+     String disableContentCompression =
+       FacesContext.getCurrentInstance().getExternalContext().
+       getInitParameter(StyleSheetRenderer.DISABLE_CONTENT_COMPRESSION);
+     // we do not compress if it is a portlet skin
+     Skin skin = RenderingContext.getCurrentInstance().getSkin();
+     boolean isPortletSkin =
+     CoreRenderKit.OUTPUT_MODE_PORTLET.equals(skin.getRenderKitId());
+
+     boolean compressStyles = (!"true".equals(disableContentCompression)) &&
+                                              !isPortletSkin;
+
 
     CSSGenerationUtils.writeCSS(context,
                                 styles,
@@ -942,7 +948,7 @@
             String styleClass = selector.substring(1);
             if (!map.containsKey(styleClass))
               map.put(styleClass, _getShortStyleClass(map.size()));
-            
+
             if (style.isEmpty())
               emptySelectors.add(styleClass);
             else
@@ -958,17 +964,17 @@
               while (styleClasses.hasNext())
               {
                 String styleClass = styleClasses.next();
-                
+
                 if (!map.containsKey(styleClass))
                   map.put(styleClass, _getShortStyleClass(map.size()));
-                
+
                 // Don't remove any styleclass that is referred to
                 nonEmptySelectors.add(styleClass);
               }
             }
-            
+
             int length = namespacePrefixes.length;
-            
+
             for (int i=0; i < length; i++)
             {
               String nsPrefix = namespacePrefixes[i];
@@ -982,7 +988,7 @@
                 while (afSelectors.hasNext())
                 {
                   String styleClass = afSelectors.next();
-                  
+
                   if (!map.containsKey(styleClass))
                     map.put(styleClass, _getShortStyleClass(map.size()));
                   if (isFirst && !afSelectors.hasNext() && style.isEmpty())
@@ -993,7 +999,7 @@
                   {
                     nonEmptySelectors.add(styleClass);
                   }
-                  
+
                   isFirst = false;
                 }
               }



Mime
View raw message