incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r493168 - in /incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: renderkit/core/CoreRenderingContext.java renderkit/core/xhtml/XhtmlConstants.java skin/SkinFactoryImpl.java
Date Fri, 05 Jan 2007 20:11:47 GMT
Author: jwaldman
Date: Fri Jan  5 12:11:46 2007
New Revision: 493168

URL: http://svn.apache.org/viewvc?view=rev&rev=493168
Log:
jwaldman-portal checkin. move renderkitid picking for skin into _initializeSkin in CoreRenderingContext
and out of getSkin in SkiNFactoryImpl cuz I feel that is cleaner. And use the XhtmlConstants
for the renderkitids.

Modified:
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java?view=diff&rev=493168&r1=493167&r2=493168
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
Fri Jan  5 12:11:46 2007
@@ -51,6 +51,7 @@
 import org.apache.myfaces.trinidadinternal.style.StyleContext;
 import org.apache.myfaces.trinidadinternal.style.util.StyleUtils;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
 import org.apache.myfaces.trinidadinternal.share.nls.MutableDecimalFormatContext;
 import org.apache.myfaces.trinidadinternal.share.nls.MutableLocaleContext;
 import org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils;
@@ -67,7 +68,7 @@
     _outputMode = afContext.getOutputMode();
     _agent = _initializeAgent(context, afContext.getAgent(), _outputMode);
 
-    _initializeSkin(afContext);
+    _initializeSkin(context, afContext);
     _initializePPR(context, afContext);
     // Get and cache (since it can be EL-bound)
     _accessibilityMode = afContext.getAccessibilityMode();
@@ -358,23 +359,28 @@
    * Set the local variable _skin to be the Skin from the
    * SkinFactory that best matches
    * the <skin-family> and current render-kit-id.
-   * @param fContext FacesContext
-   * @param context  RequestContext
+   * @param context    FacesContext
+   * @param afContext  RequestContext
    */
-  private void _initializeSkin(RequestContext afContext)
+  private void _initializeSkin(
+    FacesContext   context,
+    RequestContext afContext)
   {
+    // get skinFamily
     String skinFamily = afContext.getSkinFamily();
     if (skinFamily == null)
       skinFamily = getDefaultSkinFamily();
-    String renderKitId = "org.apache.myfaces.trinidad.desktop";
-
-    // =-=jmw @todo when we have proper renderKitId switching, I can
-    // get rid of this bit of code.
-    if (TrinidadAgent.TYPE_PDA == _agent.getAgentType())
+      
+    // get renderKitId, default is desktop renderKit
+    String renderKitId = XhtmlConstants.APACHE_TRINIDAD_DESKTOP;    
+    if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(getOutputMode())) 
+      renderKitId = XhtmlConstants.APACHE_TRINIDAD_PORTLET;
+    else if (TrinidadAgent.TYPE_PDA == _agent.getAgentType())
     {
-      renderKitId = "org.apache.myfaces.trinidad.pda";
+      // =-=jmw @todo when we have proper renderKitId switching, I can
+      // get rid of this bit of code. Should we use getViewRoot().getRenderKitId() instead?
+      renderKitId = XhtmlConstants.APACHE_TRINIDAD_PDA;
     }
-
 
     SkinFactory factory = SkinFactory.getFactory();
     if (factory == null)

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.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/XhtmlConstants.java?view=diff&rev=493168&r1=493167&r2=493168
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
Fri Jan  5 12:11:46 2007
@@ -241,6 +241,8 @@
     "org.apache.myfaces.trinidad.desktop";
   public static final String APACHE_TRINIDAD_PDA = 
     "org.apache.myfaces.trinidad.pda";
+  public static final String APACHE_TRINIDAD_PORTLET = 
+    CoreRenderKit.OUTPUT_MODE_PORTLET;
   
   /** Unicode character for non-breaking space */
   public static final char NBSP_CHAR = 0xA0;

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java?view=diff&rev=493168&r1=493167&r2=493168
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
Fri Jan  5 12:11:46 2007
@@ -26,6 +26,7 @@
 import org.apache.myfaces.trinidad.skin.Skin;
 import org.apache.myfaces.trinidad.skin.SkinFactory;
 import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
 
 
 /**
@@ -96,12 +97,12 @@
 
   /**
    * 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
-   * @param renderKitId RenderKit identifier of the requested
+   * @param renderKitId RenderKit identifier of the requested:
+   * XhtmlConstants.APACHE_TRINIDAD_DESKTOP, XhtmlConstants.APACHE_TRINIDAD_PDA, or
+   * XhtmlConstants.APACHE_TRINIDAD_PORTLET
    *  {@link Skin} instance
    */
   @Override
@@ -118,11 +119,8 @@
      throw new NullPointerException("Null skin family");
 
     // default render-kit-id, if needed.
-     RequestContext rContext = RequestContext.getCurrentInstance();   
-     if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(rContext.getOutputMode()))
-      renderKitId = _RENDER_KIT_ID_PORTLET;
-    else if (renderKitId == null) 
-      renderKitId = _RENDER_KIT_ID_CORE;
+    if (renderKitId == null) 
+      renderKitId = XhtmlConstants.APACHE_TRINIDAD_DESKTOP;
 
     // loop through each skin in the SkinFactory
     // and see if the family and the renderKitId match
@@ -150,9 +148,9 @@
     // 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(_RENDER_KIT_ID_PORTLET))
+    if (renderKitId.equals(XhtmlConstants.APACHE_TRINIDAD_PORTLET))
       return getSkin(context, _SIMPLE_PORTLET);
-    else if (renderKitId.equals(_RENDER_KIT_ID_PDA))
+    else if (renderKitId.equals(XhtmlConstants.APACHE_TRINIDAD_PDA))
       return getSkin(context, _SIMPLE_PDA);
     else 
       return getSkin(context, _SIMPLE_DESKTOP);



Mime
View raw message