myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r885642 - in /myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core: CoreRenderingContext.java StyleContextImpl.java
Date Tue, 01 Dec 2009 01:18:30 GMT
Author: jwaldman
Date: Tue Dec  1 01:18:28 2009
New Revision: 885642

URL: http://svn.apache.org/viewvc?rev=885642&view=rev
Log:
TRINIDAD-1637  always check for file modification if in DesignTime mode regardless of web.xml
setting

Modified:
    myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
    myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java

Modified: myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java?rev=885642&r1=885641&r2=885642&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
(original)
+++ myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
Tue Dec  1 01:18:28 2009
@@ -468,11 +468,7 @@
     if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(getOutputMode()) || Beans.isDesignTime())
     {
       FacesContext context = getFacesContext();
-
-      Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
-
-      // Get the requested Skin Id from the request Map
-      Object requestedSkinId = requestMap.get(_SKIN_ID_PARAM);
+      Object requestedSkinId = getRequestMapSkinId(context);
       if (requestedSkinId != null)
       {
 
@@ -519,6 +515,26 @@
   }
 
   /**
+   * Look on the requestMap for "org.apache.myfaces.trinidad.skin.id", and return
+   * the skin id.
+   * This is for clients who want to send to the server 
+   * the skin id via a request scope rather
+  // than using the trinidad-config.xml's skin-family. The examples are the 
+  // design time and a portal container.
+   * @param facesContext
+   * @return the skin id that is on the request map.
+   */
+  public Object getRequestMapSkinId(FacesContext facesContext)
+  {
+
+    Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+
+    // Get the requested Skin Id from the request Map
+    Object requestedSkinId = requestMap.get(_SKIN_ID_PARAM);
+    return requestedSkinId;
+  }
+
+  /**
    * This helps figure out if the portlet producer can share the portlet consumer's stylesheet.
    * @param context
    * @param requestedSkin The skin that the portlet consumer wants the producer to share.

Modified: myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java?rev=885642&r1=885641&r2=885642&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
(original)
+++ myfaces/trinidad/branches/1.2.12.2-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
Tue Dec  1 01:18:28 2009
@@ -18,6 +18,8 @@
  */
 package org.apache.myfaces.trinidadinternal.renderkit.core;
 
+import java.beans.Beans;
+
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentMap;
@@ -111,6 +113,20 @@
   }
   public boolean checkStylesModified()
   {
+    if (Beans.isDesignTime())
+    {
+      // In Design Time mode, if we have a skin-id on the request scope,
+      // then this means we want to check if the skin css files are modified.
+      // This is an alternative to the initParam (CHECK_TIMESTAMP_PARAM) which
+      // is set in web.xml. Design Time cannot set the web.xml file.
+      FacesContext context = FacesContext.getCurrentInstance();
+      Object requestSkinId = 
+        ((CoreRenderingContext) _arc).getRequestMapSkinId(context);
+      if (requestSkinId != null)
+        return true;
+
+    }
+    
     FacesContext context = FacesContext.getCurrentInstance();
     String checkTimestamp =
       context.getExternalContext().getInitParameter(Configuration.CHECK_TIMESTAMP_PARAM);
@@ -261,6 +277,8 @@
   private StyleProvider _styleProvider;
   private Styles _styles;
   private Boolean  _isDisableStyleCompression;
+  static private final String _SKIN_ID_PARAM =
+    "org.apache.myfaces.trinidad.skin.id";
 
   private static final TrinidadLogger _LOG =
     TrinidadLogger.createTrinidadLogger(StyleContextImpl.class);



Mime
View raw message