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/27 18:08:54 UTC
svn commit: r479709 -
/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
Author: jwaldman
Date: Mon Nov 27 10:08:53 2006
New Revision: 479709
URL: http://svn.apache.org/viewvc?view=rev&rev=479709
Log:
use 'portlet' as the render-kit-id in getSkin if the outputMode on the RequestContext is portlet. This will pick a portlet skin, like simple.portlet or minimal.portlet.
Modified:
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
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=479709&r1=479708&r2=479709
==============================================================================
--- 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 Mon Nov 27 10:08:53 2006
@@ -20,10 +20,12 @@
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;
/**
@@ -94,6 +96,8 @@
/**
* 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
@@ -113,9 +117,12 @@
if (family == null)
throw new NullPointerException("Null skin family");
- // if there isn't a specific renderKitId specified, get the skin
- // with the default render kit.
- if (renderKitId == null) renderKitId = _RENDER_KIT_ID_CORE;
+ // 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;
// loop through each skin in the SkinFactory
// and see if the family and the renderKitId match
@@ -139,15 +146,16 @@
" and renderkit " + renderKitId + ", so we will" +
" use the simple skin");
}
-
- if (renderKitId.equals(_RENDER_KIT_ID_PDA))
- {
+
+ // 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))
return getSkin(context, _SIMPLE_PDA);
- }
- else
- {
+ else
return getSkin(context, _SIMPLE_DESKTOP);
- }
}
@@ -165,6 +173,7 @@
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);