You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by jw...@apache.org on 2006/11/28 20:36:01 UTC

svn commit: r480192 - in /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: renderkit/core/xhtml/ skin/ ui/laf/base/xhtml/

Author: jwaldman
Date: Tue Nov 28 12:36:01 2006
New Revision: 480192

URL: http://svn.apache.org/viewvc?view=rev&rev=480192
Log:
revert checkins 47698 and 479709. I meant to check into my branch only. Somehow it checked it in both places.

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java?view=diff&rev=480192&r1=480191&r2=480192
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java Tue Nov 28 12:36:01 2006
@@ -29,7 +29,6 @@
 import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
 
-import org.apache.myfaces.trinidadinternal.share.config.Configuration;
 import org.apache.myfaces.trinidadinternal.style.StyleContext;
 import org.apache.myfaces.trinidadinternal.style.StyleProvider;
 import org.apache.myfaces.trinidadinternal.style.util.StyleUtils;
@@ -42,6 +41,20 @@
  */
 public class StyleSheetRenderer extends XhtmlRenderer
 { 
+  /**
+   * Disables optimizations that are normally performed by the
+   * Trinidad Renderers to reduce content size.
+   * <p>
+   * This Boolean property controls whether or not Trinidad Renderer
+   * implementations should attempt to reduce the size of generated
+   * content, for example, by compressing style class names.  These
+   * optimizations are enabled by default.  In general,
+   * clients should not need to disable these optimizations.  However,
+   * clients that want to disable this functionality for testing or
+   * debugging purposes can do so by setting this property to Boolean.TRUE.
+   */
+  static public final String DISABLE_CONTENT_COMPRESSION =
+    "org.apache.myfaces.trinidadinternal.DISABLE_CONTENT_COMPRESSION";
 
   public StyleSheetRenderer()
   {
@@ -122,7 +135,9 @@
       // Hand the Faces-major renderers the style Map for compressing.
       // Oddly enough, this code has to be after provider.getStyleSheetURI(),
       // because that call boostraps up the style provider in general.
-      if (!XhtmlUtils.isDisableContentCompression(context, arc))
+      if (!"true".equals(
+          context.getExternalContext().getInitParameter(
+                                 DISABLE_CONTENT_COMPRESSION)))
       {
         if (arc instanceof CoreRenderingContext)
         {

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java?view=diff&rev=480192&r1=480191&r2=480192
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java Tue Nov 28 12:36:01 2006
@@ -39,11 +39,9 @@
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
 import org.apache.myfaces.trinidad.context.RenderingContext;
 
-import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.Scriptlet;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.XhtmlScriptletFactory;
 
-import org.apache.myfaces.trinidadinternal.share.config.Configuration;
 import org.apache.myfaces.trinidadinternal.share.util.FastMessageFormat;
 
 
@@ -86,39 +84,6 @@
             Boolean.TRUE.equals(
              agent.getCapabilities().get(TrinidadAgent.CAP_PARTIAL_RENDERING)));
   }
-  
-  /**
-   * Return true if we should disable content compression
-   * @param fContext FacesContext
-   * @param renderingContext RenderingContext, where we can get the outputMode.
-   * @return true if we should disable content compression. If in a portlet, then we want to
-   * disable content compression.
-   */
-  static public boolean isDisableContentCompression(
-    FacesContext     fContext,
-    RenderingContext renderingContext)
-  {    
-    String outputMode = renderingContext.getOutputMode();
-    return _isDisableContentCompression(fContext, outputMode);
-  }
-  
-  /**
-   * Return true if we should disable content compression
-   * @param fContext FacesContext
-   * @param requestContext RequestContext, where we can get the outputMode.
-   * @return true if we should disable content compression. If in a portlet, then we want to
-   * disable content compression.
-   */
-  static public boolean isDisableContentCompression(
-    FacesContext   fContext,
-    RequestContext requestContext)
-  {
-    String outputMode = requestContext.getOutputMode();
-    return _isDisableContentCompression(fContext, outputMode);
-  }
-
-  
-
 
   /** Library key for the locale lib */
   public static final String CORE_LIB =
@@ -537,25 +502,6 @@
   {
     FastMessageFormat formatter = new FastMessageFormat(pattern);
     return formatter.format(parameters);
-  }
-  
-  
-  /**
-   * Return true if we should disable content compression. It looks at both the disable
-   * content compression init parameter and the outputMode.
-   * @param fContext
-   * @param outputMode String. We compare this against XhtmlConstants.OUTPUT_MODE_PORTLET
-   * @return
-   */
-  static private boolean _isDisableContentCompression(
-    FacesContext fContext,
-    String       outputMode)
-  {
-    String disableContentCompressionParam =
-      fContext.getExternalContext().getInitParameter(Configuration.DISABLE_CONTENT_COMPRESSION);
-    return ("true".equals(disableContentCompressionParam) || 
-            XhtmlConstants.OUTPUT_MODE_PORTLET.equals(outputMode));
-
   }
 
   /** HashMap mapping names to their scriptlets */

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java?view=diff&rev=480192&r1=480191&r2=480192
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java Tue Nov 28 12:36:01 2006
@@ -20,12 +20,10 @@
 import java.util.Map;
 
 import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.skin.Skin;
 import org.apache.myfaces.trinidad.skin.SkinFactory;
-import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
+
 
 
 /**
@@ -96,8 +94,6 @@
 
   /**
    * given the skinFamily and renderKitId, pass back the Skin.
-   * If outputMode is PORTLET, then we ignore
-   * the render-kit-id and get the 'portlet' skin for that skin family.
    * @param context FacesContext for the request currently being
    * processed, or <code>null</code> if none is available.
    * @param family skin family of the requested {@link Skin} instance
@@ -117,12 +113,9 @@
    if (family == null)
      throw new NullPointerException("Null skin family");
 
-    // default render-kit-id, if needed.
-    if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(
-        RequestContext.getCurrentInstance().getOutputMode()))
-      renderKitId = XhtmlConstants.OUTPUT_MODE_PORTLET;
-    else if (renderKitId == null) 
-      renderKitId = _RENDER_KIT_ID_CORE;
+    // if there isn't a specific renderKitId specified, get the skin
+    // with the default render kit.
+    if (renderKitId == null) renderKitId = _RENDER_KIT_ID_CORE;
 
     // loop through each skin in the SkinFactory
     // and see if the family and the renderKitId match
@@ -146,16 +139,15 @@
                     " and renderkit " + renderKitId + ", so we will" +
                     " use the simple skin");
      }
- 
-    // if we get here, that means we couldn't find an exact 
-    // family/renderKitId match, so return the simple skin 
-    // that matches the renderkitid.
-    if (renderKitId.equals(XhtmlConstants.OUTPUT_MODE_PORTLET))
-      return getSkin(context, _SIMPLE_PORTLET);
-    else if (renderKitId.equals(_RENDER_KIT_ID_PDA))
+
+    if (renderKitId.equals(_RENDER_KIT_ID_PDA))
+    {
       return getSkin(context, _SIMPLE_PDA);
-    else 
+    }
+    else
+    {
       return getSkin(context, _SIMPLE_DESKTOP);
+    }
 
   }
 
@@ -173,7 +165,6 @@
   static private final String _RENDER_KIT_ID_PDA = "org.apache.myfaces.trinidad.pda";
   static private final String _SIMPLE_PDA = "simple.pda";
   static private final String _SIMPLE_DESKTOP = "simple.desktop";
-  static private final String _SIMPLE_PORTLET = "simple.portlet";
 
   static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(SkinFactoryImpl.class);
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java?view=diff&rev=480192&r1=480191&r2=480192
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java Tue Nov 28 12:36:01 2006
@@ -29,7 +29,6 @@
 import javax.faces.context.ResponseWriter;
 
 import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.skin.Icon;
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
@@ -311,9 +310,12 @@
     // try to get it now
     if (styleClasses == null)
     {
-      if (!(XhtmlUtils.isDisableContentCompression(context.getFacesContext(), 
-          RequestContext.getCurrentInstance())))
+      ExternalContext external =
+        context.getFacesContext().getExternalContext();
 
+      if (!"true".equals(
+           external.getInitParameter(
+             Configuration.DISABLE_CONTENT_COMPRESSION)))
       {
         StyleContext styleContext = context.getStyleContext();
         StyleProvider provider = context.getStyleContext().getStyleProvider();