incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r480740 - in /incubator/adffaces/branches/jwaldman-portal/trinidad: trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ trinidad-impl/src/main/java/org...
Date Wed, 29 Nov 2006 22:24:36 GMT
Author: jwaldman
Date: Wed Nov 29 14:24:35 2006
New Revision: 480740

URL: http://svn.apache.org/viewvc?view=rev&rev=480740
Log:
For branch jwaldman-portal:
Add public API to Skin: public Map<String, String> getStyleClassMap(RenderingContext
arc);
This is used to return the shortened style class map.
It can be used by a portal skin to return a full class name -> portal class name map.

Modified:
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/Skin.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/StyleUtils.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/Skin.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/Skin.java?view=diff&rev=480740&r1=480739&r2=480740
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/Skin.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/Skin.java
Wed Nov 29 14:24:35 2006
@@ -15,9 +15,11 @@
  */
 package org.apache.myfaces.trinidad.skin;
 
+import java.util.Map;
 import java.util.MissingResourceException;
 
 import org.apache.myfaces.trinidad.context.LocaleContext;
+import org.apache.myfaces.trinidad.context.RenderingContext;
 
 /**
  * Defines the components (icons, styles, etc)
@@ -36,7 +38,7 @@
    * Returns an string identifier which uniquely identies
    * this Skin implementation.  Skin implementations
    * can be retrieved by id via SkinFactory.getSkin().
-   * @see org.apache.myfaces.trinidadinternal.skin.SkinFactory#getSkin
+   * @see org.apache.myfaces.trinidad.skin.SkinFactory#getSkin
    */
   abstract public String getId();
 
@@ -55,6 +57,15 @@
    * Returns the renderKitId for the Skin.
    */
   abstract public String getRenderKitId();
+
+  /**
+   * Returns the style class map, or null if there is no map.
+   * It should be a map that contains the full style class name as 
+   * the key, and the value could be a shortened style class name,
+   * or a portlet style class name, etc.
+   */
+  abstract public Map<String, String> getStyleClassMap(
+    RenderingContext arc);
 
   /**
    * Returns the name of the XSS style sheet for this Skin.

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java?view=diff&rev=480740&r1=480739&r2=480740
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java
Wed Nov 29 14:24:35 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.myfaces.trinidadinternal.renderkit.core;
 
+import java.util.Map;
+
 import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -124,7 +126,12 @@
     {
       return null;
     }
-
+    
+    public Map<String, String> getShortStyleClasses(StyleContext context)
+    {
+      return null;
+    }
+    
     public String getStyleSheetURI(StyleContext context)
     {
       return null;

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java?view=diff&rev=480740&r1=480739&r2=480740
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
Wed Nov 29 14:24:35 2006
@@ -31,10 +31,9 @@
 
 import org.apache.myfaces.trinidadinternal.style.StyleContext;
 import org.apache.myfaces.trinidadinternal.style.StyleProvider;
-import org.apache.myfaces.trinidadinternal.style.util.StyleUtils;
 
 /**
- * Renderer for meta data section of the document--a.k.a <head>.
+ * Renderer for meta data section of the document--a.k.a &lt;head&gt;.
  * <p>
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/renderkit/core/xhtml/StyleSheetRenderer.java#0
$) $Date: 10-nov-2005.19:02:29 $
  * @author The Oracle ADF Faces Team
@@ -135,17 +134,10 @@
       // 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 (!"true".equals(
-          context.getExternalContext().getInitParameter(
-                                 DISABLE_CONTENT_COMPRESSION)))
+      if (arc instanceof CoreRenderingContext)
       {
-        if (arc instanceof CoreRenderingContext)
-        {
-          Map<String, String> shortStyles = 
-            StyleUtils.getShortStyleClasses(sContext, provider);
-          
-          ((CoreRenderingContext) arc).setStyleMap(shortStyles);
-        }
+        Map<String, String> shortStyles = arc.getSkin().getStyleClassMap(arc);    
   
+        ((CoreRenderingContext) arc).setStyleMap(shortStyles);
       }
     }
   }

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java?view=diff&rev=480740&r1=480739&r2=480740
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
Wed Nov 29 14:24:35 2006
@@ -22,15 +22,23 @@
 import java.util.MissingResourceException;
 import java.util.Stack;
 
+import javax.faces.context.ExternalContext;
+
+import javax.faces.context.FacesContext;
+
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.context.LocaleContext;
+import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.skin.Icon;
 import org.apache.myfaces.trinidad.skin.Skin;
 
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinProperties;
+import org.apache.myfaces.trinidadinternal.share.config.Configuration;
 import org.apache.myfaces.trinidadinternal.share.expl.Coercions;
 import org.apache.myfaces.trinidadinternal.skin.icon.ReferenceIcon;
 import org.apache.myfaces.trinidadinternal.style.StyleContext;
+import org.apache.myfaces.trinidadinternal.style.StyleProvider;
 import org.apache.myfaces.trinidadinternal.style.xml.StyleSheetDocumentUtils;
 import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetDocument;
 import org.apache.myfaces.trinidadinternal.ui.laf.xml.parse.IconNode;
@@ -324,6 +332,42 @@
     _extensionStyleSheetNames.add(styleSheetName);
   }
 
+  /**
+   * Returns the style class map, or null if there is no map.
+   * @param arc RenderingContext
+   * @return Map<String, String> It should be a map that contains the full style class
name as 
+   * the key, and the value could be a shortened style class name,
+   * or a portlet style class name, etc.
+   */
+   
+
+   /**
+    * Returns the style class map, or null if there is no map.
+    * Some StyleProvider implementations, such as the FileSystemStyleCache,
+    * automatically provide compressed versions style class names.  The
+    * short style classes can be used instead of the full style class
+    * names to reduce the overall size of generated content.
+    * @param arc RenderingContext
+    * @return Map&lt;String, String&gt; It should be a map that contains the full
style class name as 
+    * the key, and the value could be a shortened style class name,
+    * or a portlet style class name, etc.
+    */
+   public Map<String, String> getStyleClassMap(
+     RenderingContext arc
+     )
+   {
+     ExternalContext external  = FacesContext.getCurrentInstance().getExternalContext();
+     if (!"true".equals(
+          external.getInitParameter(
+            Configuration.DISABLE_CONTENT_COMPRESSION)))
+     {
+       StyleContext sContext = ((CoreRenderingContext)arc).getStyleContext();
+       StyleProvider sProvider = sContext.getStyleProvider();
+       return sProvider.getShortStyleClasses(sContext);   
+     }
+     return null;
+   }
+  
   /**
    * Returns the StyleSheetDocument object which defines all of the
    * styles for this Skin, including any styles that are

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java?view=diff&rev=480740&r1=480739&r2=480740
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java
Wed Nov 29 14:24:35 2006
@@ -16,9 +16,11 @@
 
 package org.apache.myfaces.trinidadinternal.style;
 
+import java.util.Map;
+
 /**
- * The StyleProvider API is used to access context-dependent style 
- * information.  Style information is exposed in two ways - as 
+ * The StyleProvider API is used to access context-dependent style
+ * information.  Style information is exposed in two ways - as
  * CSS style sheet URIs (via getStyleSheetURI()), or as Style objects
  * (via getStyleMap()).  Both methods take a StyleContext object,
  * which describes the target end user environment.
@@ -37,6 +39,16 @@
    * defined by the StyleProvider.
    */
   public String getContentStyleType(StyleContext context);
+  
+  /**
+   * Returns a Map which maps style class names to
+   * equivalent shorter names.
+   * @param context The StyleContext
+   *
+   * @return A Map which maps the full style class names to
+   *   the shorter equivalents.
+   */
+  public Map<String, String> getShortStyleClasses(StyleContext context);
 
   /**
    * Returns the URI of the CSS style sheet to use for the

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/StyleUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/StyleUtils.java?view=diff&rev=480740&r1=480739&r2=480740
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/StyleUtils.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/StyleUtils.java
Wed Nov 29 14:24:35 2006
@@ -16,13 +16,8 @@
 
 package org.apache.myfaces.trinidadinternal.style.util;
 
-import java.util.Map;
 import java.util.regex.Pattern;
 
-import org.apache.myfaces.trinidadinternal.style.StyleContext;
-import org.apache.myfaces.trinidadinternal.style.StyleProvider;
-import org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache;
-
 /**
  * Generic style utilities.
  *
@@ -35,48 +30,6 @@
   public static final String RTL_CSS_SUFFIX = ":rtl";
   public static final String LTR_CSS_SUFFIX = ":ltr";
 
-  /**
-   * Returns a Map which maps style class names to
-   * equivalent shorter names.
-   * <p>
-   * Some StyleProvider implementations, such as the FileSystemStyleCache,
-   * automatically provide compressed versions style class names.  The
-   * short style classes can be used instead of the full style class
-   * names to reduce the overall size of generated content.
-   * <p>
-   * <p>
-   * Note: The returned Map uses String keys to represent
-   * the full class names.  However, the short style class values
-   * may not necessarily be type java.lang.String.  Clients must
-   * avoid explicitly casting the values contained in the Map
-   * to type String.  Instead, such values should be passed directly
-   * to the ResponseWriter API to be rendered.  Or, if the String
-   * representation is required, toString() should be called on
-   * the value.
-   *
-   * @param context The StyleContext
-   * @param provider The StyleProvider
-   *
-   * @return A Map which maps the full style class names to
-   *   the shorter equivalents.
-   */
-  public static Map<String, String> getShortStyleClasses(
-    StyleContext  context,
-    StyleProvider provider)
-  {
-    // =-=ags For now, we explicilty cast to FileSystemStyleCache!
-    //        It would be better if we could add a method to
-    //        StyleProvider, but it is too late for that now.
-    //        Alternatively, we could add a new StyleProvider
-    //        sub-interface, but we won't pollute our public
-    //        API until that proves necessary.
-    if (provider instanceof FileSystemStyleCache)
-    {
-      return ((FileSystemStyleCache)provider).getShortStyleClasses(context);
-    }
-
-    return null;
-  }
 
   /**
    * Convert the characters that should not be in a selector

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java?view=diff&rev=480740&r1=480739&r2=480740
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java
Wed Nov 29 14:24:35 2006
@@ -24,7 +24,6 @@
 import java.util.Stack;
 
 import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
@@ -43,9 +42,7 @@
 import org.apache.myfaces.trinidadinternal.share.url.FormEncoder;
 import org.apache.myfaces.trinidadinternal.style.ParsedPropertyKey;
 import org.apache.myfaces.trinidadinternal.style.Style;
-import org.apache.myfaces.trinidadinternal.style.StyleContext;
 import org.apache.myfaces.trinidadinternal.style.StyleMap;
-import org.apache.myfaces.trinidadinternal.style.StyleProvider;
 import org.apache.myfaces.trinidadinternal.style.util.StyleUtils;
 import org.apache.myfaces.trinidadinternal.ui.AttributeKey;
 import org.apache.myfaces.trinidadinternal.ui.MutableUINode;
@@ -310,18 +307,8 @@
     // try to get it now
     if (styleClasses == null)
     {
-      ExternalContext external =
-        context.getFacesContext().getExternalContext();
-
-      if (!"true".equals(
-           external.getInitParameter(
-             Configuration.DISABLE_CONTENT_COMPRESSION)))
-      {
-        StyleContext styleContext = context.getStyleContext();
-        StyleProvider provider = context.getStyleContext().getStyleProvider();
-        styleClasses = StyleUtils.getShortStyleClasses(styleContext, provider);
-
-      }
+      RenderingContext arc = RenderingContext.getCurrentInstance();
+      styleClasses = context.getSkin().getStyleClassMap(arc);
 
       if (styleClasses == null)
         styleClasses = _NULL_STYLE_CLASSES;



Mime
View raw message