Author: jwaldman
Date: Fri Jan  5 18:11:16 2007
New Revision: 493272

URL: http://svn.apache.org/viewvc?view=rev&rev=493272
Log:
If in a portal output-mode, we look at the ExternalContext's requestMap for the 
"oracle.apache.myfaces.trinidad.skin.id" attribute. If it exists, we find the 
skin with that id, if that exists, we use the skin, instead of using the portal 
skin.

Modified:
    
incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.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=493272&r1=493271&r2=493272
==============================================================================
--- 
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 18:11:16 2007
@@ -373,14 +373,17 @@
       
     // get renderKitId, default is desktop renderKit
     String renderKitId = XhtmlConstants.APACHE_TRINIDAD_DESKTOP;    
-    if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(getOutputMode())) 
+    if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(getOutputMode()))
+    {
       renderKitId = XhtmlConstants.APACHE_TRINIDAD_PORTLET;
+    }
     else if (TrinidadAgent.TYPE_PDA == _agent.getAgentType())
     {
       // =-=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)
@@ -389,8 +392,25 @@
         _LOG.warning("There is no SkinFactory");
       return;
     }
+    
+    Skin skin = null;
+    
+    // see if there is a skinID on the requestParameterMap. If there is, then
+    // we want to use that skin. Otherwise, use find the skin as usual, using 
the portlet
+    // renderKitId.
+    if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(getOutputMode()))
+    {
+      Map<String, Object> requestMap = 
context.getExternalContext().getRequestMap();
+      Object skinId = requestMap.get(_SKIN_ID_PARAM);
+      if (skinId != null)
+      {
+        skin = factory.getSkin(context, skinId.toString());
+      }
+        
+    }
 
-    Skin skin = factory.getSkin(null, skinFamily, renderKitId);
+    if (skin == null)
+      skin = factory.getSkin(null, skinFamily, renderKitId);
 
     if (skin == null)
     {
@@ -550,6 +570,7 @@
   private int                 _linkStyleDisabledCount = 0;
   private boolean             _isLinkDisabled = false;
 
+  static private final String _SKIN_ID_PARAM = 
"oracle.apache.myfaces.trinidad.skin.id";
   // Maps describing the capabilities of our output modes
   // -= Simon Lessard =-
   // FIXME: Cannot use CapabilityKey in the generic definition because 


Reply via email to