You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2009/12/01 02:33:59 UTC

svn commit: r885646 - in /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core: CoreRenderingContext.java StyleContextImpl.java

Author: jwaldman
Date: Tue Dec  1 01:33:53 2009
New Revision: 885646

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

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

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java?rev=885646&r1=885645&r2=885646&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java Tue Dec  1 01:33:53 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/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java?rev=885646&r1=885645&r2=885646&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java Tue Dec  1 01:33:53 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);