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 2007/01/31 23:29:36 UTC

svn commit: r502039 [2/39] - in /incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad: ./ trinidad-api/src/main/java/org/apache/myfaces/trinidad/config/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ trinidad-api/src/main...

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java Wed Jan 31 15:29:21 2007
@@ -21,7 +21,6 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Writer;
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -29,8 +28,8 @@
 
 import javax.faces.FactoryFinder;
 import javax.faces.application.ViewHandler;
-import javax.faces.component.UIComponent;
 import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
 import javax.faces.component.UIData;
 import javax.faces.component.UIForm;
 import javax.faces.component.UIGraphic;
@@ -46,45 +45,38 @@
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseStream;
 import javax.faces.context.ResponseWriter;
-import javax.faces.render.Renderer;
 import javax.faces.render.RenderKit;
 import javax.faces.render.RenderKitFactory;
+import javax.faces.render.Renderer;
 import javax.faces.render.ResponseStateManager;
-
 import javax.servlet.ServletResponse;
 
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-
-import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.context.Agent;
-
+import org.apache.myfaces.trinidad.context.PartialPageContext;
+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.render.DialogRenderKitService;
 import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
-
+import org.apache.myfaces.trinidad.render.RenderUtils;
+import org.apache.myfaces.trinidadinternal.agent.AgentUtil;
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
+import org.apache.myfaces.trinidadinternal.config.dispatch.DispatchResponseConfiguratorImpl;
 import org.apache.myfaces.trinidadinternal.context.TrinidadPhaseListener;
-
-import org.apache.myfaces.trinidadinternal.io.DebugResponseWriter;
 import org.apache.myfaces.trinidadinternal.io.DebugHtmlResponseWriter;
+import org.apache.myfaces.trinidadinternal.io.DebugResponseWriter;
 import org.apache.myfaces.trinidadinternal.io.HtmlResponseWriter;
 import org.apache.myfaces.trinidadinternal.io.IndentingResponseWriter;
 import org.apache.myfaces.trinidadinternal.io.XhtmlResponseWriter;
-
-import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidadinternal.renderkit.RenderKitBase;
-import org.apache.myfaces.trinidad.render.RenderUtils;
-import org.apache.myfaces.trinidad.context.PartialPageContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContextImpl;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
+import org.apache.myfaces.trinidadinternal.renderkit.htmlBasic.HtmlCommandButtonRenderer;
 import org.apache.myfaces.trinidadinternal.renderkit.htmlBasic.HtmlCommandLinkRenderer;
 import org.apache.myfaces.trinidadinternal.renderkit.htmlBasic.HtmlFormRenderer;
-
-import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
-import org.apache.myfaces.trinidadinternal.agent.AgentUtil;
-import org.apache.myfaces.trinidadinternal.renderkit.htmlBasic.HtmlCommandButtonRenderer;
 import org.apache.myfaces.trinidadinternal.share.util.CaboHttpUtils;
-import org.apache.myfaces.trinidadinternal.webapp.DispatchServletResponse;
 
 /**
  * RenderKit based on UIX.
@@ -508,7 +500,7 @@
       if (contentTypeList == null)
       {
         // default to content type captured by ServletFilter
-        contentTypeList = DispatchServletResponse.getContentType(fContext);
+        contentTypeList = DispatchResponseConfiguratorImpl.getContentType(fContext);
       }
 
       String[] acceptedTypes = (contentTypeList == null)

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java Wed Jan 31 15:29:21 2007
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -54,6 +54,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;
@@ -72,7 +73,7 @@
     RequestContext afContext = RequestContext.getCurrentInstance();
 
     _properties = new HashMap<Object, Object>();
-    
+
     _outputMode = afContext.getOutputMode();
     _agent = _initializeAgent(context,
                               afContext.getAgent(),
@@ -80,7 +81,7 @@
                               // in case anyone has overidden getOutputMode()
                               getOutputMode());
 
-    _initializeSkin(afContext);
+    _initializeSkin(context, afContext);
     _initializePPR(context, afContext);
     // Get and cache (since it can be EL-bound)
     _accessibilityMode = afContext.getAccessibilityMode();
@@ -253,6 +254,8 @@
     if (styleClass == null) return null;
 
     styleClass = getSkinResourceMappedKey(styleClass);
+    // Most likely the _styleMap is a shortened style class map. In the case of portlets,
+    // it is a full name-> portlet style class map.
     String shortenedStyle = null;
     if (_styleMap != null)
     {
@@ -272,7 +275,7 @@
       // namespace character '|' is not in the name.
       // we do the same thing in CSSUtils when we write the full selector
       // to the CSS file.
-      styleClass = StyleUtils.convertToValidSelector(styleClass.toString());
+      styleClass = StyleUtils.convertToValidSelector(styleClass);
     }
     return styleClass;
   }
@@ -374,21 +377,29 @@
    * 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 == getTrinidadAgent().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;
     }
 
 
@@ -400,7 +411,24 @@
       return;
     }
 
-    Skin skin = factory.getSkin(null, skinFamily, renderKitId);
+    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());
+      }
+
+    }
+
+    if (skin == null)
+      skin = factory.getSkin(null, skinFamily, renderKitId);
 
     if (skin == null)
     {
@@ -439,6 +467,10 @@
     {
       return AgentUtil.mergeCapabilities(agent, _EMAIL_CAPABILITIES);
     }
+    else if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(outputMode))
+    {
+      return AgentUtil.mergeCapabilities(agent, _PORTLET_CAPABILITIES);
+    }
     else
     {
       return agent;
@@ -472,9 +504,9 @@
   {
     String path = null;
 
-    Map<String, Object> applicationMap = 
+    Map<String, Object> applicationMap =
       fContext.getExternalContext().getApplicationMap();
-    
+
     if (applicationMap != null)
     {
       // In general, write to the Servlet spec'd temporary directory
@@ -556,18 +588,22 @@
   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 
-  //        CapabilityKey is not in the public API and those map are 
-  //        used as a parameter in an API call receiving a 
+  // FIXME: Cannot use CapabilityKey in the generic definition because
+  //        CapabilityKey is not in the public API and those map are
+  //        used as a parameter in an API call receiving a
   //        Map<Object, Object> argument
-  static private final Map<Object, Object> _PRINTABLE_CAPABILITIES = 
+  static private final Map<Object, Object> _PRINTABLE_CAPABILITIES =
+    new HashMap<Object, Object>();
+
+  static private final Map<Object, Object> _EMAIL_CAPABILITIES =
     new HashMap<Object, Object>();
-  
-  static private final Map<Object, Object> _EMAIL_CAPABILITIES = 
+
+  static private final Map<Object, Object> _PORTLET_CAPABILITIES =
     new HashMap<Object, Object>();
-  
+
   static
   {
     _PRINTABLE_CAPABILITIES.put(TrinidadAgent.CAP_INTRINSIC_EVENTS,
@@ -591,6 +627,11 @@
     _EMAIL_CAPABILITIES.put(TrinidadAgent.CAP_STYLE_ATTRIBUTES,
                             TrinidadAgent.STYLES_INTERNAL);
     _EMAIL_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
+                            Boolean.FALSE);
+
+    _PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
+                            Boolean.FALSE);
+    _PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_MULTIPLE_WINDOWS,
                             Boolean.FALSE);
   }
 

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/StyleContextImpl.java Wed Jan 31 15:29:21 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.myfaces.trinidadinternal.renderkit.core;
 
+import java.util.Map;
+
 import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -127,7 +129,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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java Wed Jan 31 15:29:21 2007
@@ -188,10 +188,7 @@
     String viewId = context.getViewRoot().getViewId();
     String action =
       context.getApplication().getViewHandler().getActionURL(context, viewId);
-    action = context.getExternalContext().encodeActionURL(action);
-
-    rw.writeURIAttribute("action", action, null);
-
+    renderEncodedActionURI(context, "action", action);
     if (supportsTarget(arc))
     {
       rw.writeAttribute("target", getTargetFrame(bean), "targetFrame");

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java Wed Jan 31 15:29:21 2007
@@ -22,6 +22,7 @@
 import java.util.TimeZone;
 
 import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
@@ -149,17 +150,20 @@
     FacesContext context,
     RenderingContext arc)
   {
+    ExternalContext externalContext = context.getExternalContext();
+    
     // Disable the Cookie script for portlets
     // =-=AEW Right or wrong?
-    if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(arc.getOutputMode()))
+    String outputMode = arc.getOutputMode();
+    if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(outputMode))
       return false;
 
     // Do not need the cookie script when we have a PartialPageContext
     if (arc.getPartialPageContext() != null)
       return false;
     
-    Object request = context.getExternalContext().getRequest();
-    Object response = context.getExternalContext().getResponse();
+    Object request = externalContext.getRequest();
+    Object response = externalContext.getResponse();
     if ((request instanceof HttpServletRequest) &&
         (response instanceof HttpServletResponse))
     {

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/IconRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/IconRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/IconRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/IconRenderer.java Wed Jan 31 15:29:21 2007
@@ -68,11 +68,11 @@
       renderId(context, comp);
       renderAllAttributes(context, arc, bean, false);
       renderStyleAttributes(context, arc, bean, "AFLogo");
-      rw.writeAttribute(
+      renderEncodedResourceURI(
+        context,
         "src",
         context.getExternalContext().getRequestContextPath() +
-        "/adf/images/t.gif",
-        null);
+        "/adf/images/t.gif");
       rw.endElement("img");
     }
     else

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MediaRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MediaRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MediaRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MediaRenderer.java Wed Jan 31 15:29:21 2007
@@ -544,7 +544,7 @@
 
       if (isURL)
       {
-        writer.writeURIAttribute("value", paramValue, null);
+        renderEncodedResourceURI(context, "value", paramValue);
       }
       else
       {

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java Wed Jan 31 15:29:21 2007
@@ -541,7 +541,7 @@
     Application application = context.getApplication();
     ViewHandler handler = application.getViewHandler();
     String resolvedIconUri = handler.getResourceURL(context, iconUri);
-    rw.writeAttribute("src", resolvedIconUri, null);
+    renderEncodedResourceURI(context, "src", resolvedIconUri);
     rw.endElement("img");
   }
 

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPartialRootRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPartialRootRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPartialRootRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPartialRootRenderer.java Wed Jan 31 15:29:21 2007
@@ -400,7 +400,7 @@
       }
       else
       {
-        writer.writeAttribute("src", "about:blank", null);
+        writer.writeURIAttribute("src", "about:blank", null);
       }
 
       Object width = "0";

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectManyShuttleRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectManyShuttleRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectManyShuttleRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectManyShuttleRenderer.java Wed Jan 31 15:29:21 2007
@@ -756,7 +756,7 @@
     // Write out Javascript
     // FIXME: this would be far better just written as Javascript
     // with onclick
-    rw.writeURIAttribute("href", href, null);
+    renderEncodedActionURI(context, "href", href);
     Icon icon = rc.getIcon(iconName);
 
     // FIXME: the icon previously had "p_OraDisplayBlock" rendered on it.
@@ -780,7 +780,7 @@
   {
     ResponseWriter rw = context.getResponseWriter();
     rw.startElement("a", null);
-    rw.writeURIAttribute("href", href, null);
+    renderEncodedActionURI(context, "href", href);
     renderStyleClass(context,
                      rc,
                      href == null

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputFileRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputFileRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputFileRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputFileRenderer.java Wed Jan 31 15:29:21 2007
@@ -26,7 +26,7 @@
 import org.apache.myfaces.trinidad.component.core.input.CoreInputFile;
 
 import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.webapp.UploadedFiles;
+import org.apache.myfaces.trinidadinternal.config.upload.UploadedFiles;
 
 /**
  */

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java Wed Jan 31 15:29:21 2007
@@ -23,6 +23,7 @@
 import java.util.Map;
 
 import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
@@ -34,10 +35,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
@@ -91,7 +91,8 @@
       String href = provider.getStyleSheetURI(sContext);
       if (href != null)
       {
-        String contextUri = context.getExternalContext().getRequestContextPath();
+        ExternalContext externalContext = context.getExternalContext();
+        String contextUri = externalContext.getRequestContextPath();
         String baseURL = contextUri + XhtmlConstants.STYLES_CACHE_DIRECTORY;
         
         String outputMode = arc.getOutputMode();
@@ -105,8 +106,8 @@
                         "charset=\\\"UTF-8\\\" type=\\\"text/css\\\" " +
                         "href=\\\"",
 						null);
-          writer.writeText(baseURL, null);
-          writer.writeText(href, null);
+          String uri = context.getExternalContext().encodeResourceURL(baseURL+href);
+          writer.writeText(uri, null);
           writer.writeText("\\\">\")}", null);
           writer.endElement("script");
         }
@@ -138,17 +139,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-pretrunkmerge/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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java Wed Jan 31 15:29:21 2007
@@ -244,6 +244,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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java Wed Jan 31 15:29:21 2007
@@ -162,6 +162,8 @@
     // each script once.  Employ document.write() to achieve this
     // effect.  (Note that on Netscape 4.x this caused major
     // problems when resizing windows - but we're done with Netscape 4)
+    libURL = context.getExternalContext().encodeResourceURL(libURL.toString());
+
     if (XhtmlConstants.FACET_PORTLET.equals(arc.getOutputMode()))
     {
       if (arc.getProperties().get(_PORTLET_LIB_TABLE_KEY) == null)
@@ -189,8 +191,7 @@
     else
     {
       // The "safe" case: just write out the source
-      libURL = context.getExternalContext().encodeResourceURL(libURL.toString());
-      writer.writeAttribute("src", libURL, null);
+      writer.writeURIAttribute("src", libURL, null);
     }
 
     writer.endElement("script");

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/url/EncoderUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/url/EncoderUtils.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/url/EncoderUtils.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/url/EncoderUtils.java Wed Jan 31 15:29:21 2007
@@ -764,5 +764,6 @@
     _DONT_ENCODE_SET.set('!');
     _DONT_ENCODE_SET.set('(');
     _DONT_ENCODE_SET.set(')');
+    _DONT_ENCODE_SET.set(';'); //ADFFACES-235 ";" are valid chars in querystrings
   }
 }

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/util/MultipartFormHandler.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/util/MultipartFormHandler.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/util/MultipartFormHandler.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/util/MultipartFormHandler.java Wed Jan 31 15:29:21 2007
@@ -26,9 +26,9 @@
 
 import java.util.StringTokenizer;
 
-import javax.servlet.ServletRequest;
-
+import javax.faces.context.ExternalContext;
 
+import org.apache.myfaces.trinidadinternal.util.ExternalContextUtils;
 
 /**
  * MultipartFormHandler - parses an incoming file upload post.
@@ -45,6 +45,7 @@
  * <p>
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/util/MultipartFormHandler.java#1 $) $Date: 11-nov-2005.14:59:39 $
  * @author The Oracle ADF Faces Team
+ * @author Scott O'Bryan
  */
 public class MultipartFormHandler
 {
@@ -52,28 +53,30 @@
   /**
    * Returns true if the servlet request is a multipart request.
    */
-  static public boolean isMultipartRequest(ServletRequest request)
+  static public boolean isMultipartRequest(final ExternalContext externalContext)
   {
-    String contentType = request.getContentType();
+    final String contentType =   ExternalContextUtils.getContentType(externalContext);
+    
     if (contentType == null)
+    {
       return false;
+    }
 
-    return (contentType.startsWith(_MULTIPART_REQUEST_TYPE) &&
-            (request.getAttribute(_HANDLED) == null));
+    return contentType.startsWith(_MULTIPART_REQUEST_TYPE) && externalContext.getRequestMap().get(_HANDLED) == null;
   }
 
   /**
    * Create a MultipartFormHandler for the given servlet request.
    */
-  public MultipartFormHandler(ServletRequest request)
-    throws IOException
+  public MultipartFormHandler(final ExternalContext externalContext) throws IOException
   {
-    this(request.getContentType(), request.getInputStream());
+    
+    this(ExternalContextUtils.getContentType(externalContext), ExternalContextUtils.getRequestInputStream(externalContext));
 
     // make sure that we don't try to decode this multi part request at a
     // later time; ie: if we do a forward.
-    request.setAttribute(_HANDLED, Boolean.TRUE);
-    _contentStreamSize = request.getContentLength();
+    externalContext.getRequestMap().put(_HANDLED, Boolean.TRUE);
+    _contentStreamSize = ExternalContextUtils.getContentLength(externalContext);
   }
 
   /**
@@ -84,20 +87,18 @@
    *             must define the multipart boundary value.
    * @param in The InputStream which provides the multipart/form-data content
    */
-  public MultipartFormHandler(String type, InputStream in)
-    throws IOException
+  public MultipartFormHandler(final String type, final InputStream in) throws IOException
   {
     if (!type.startsWith(_MULTIPART_REQUEST_TYPE))
+    {
       throw new IllegalStateException("Content is not multipart form data");
+    }
 
     _boundary = _parseBoundary(type);
-
     _in = in;
-
     _skipBoundary();
   }
 
-
   /**
    * Gets the character enocoding.
    */
@@ -106,7 +107,6 @@
     return _characterEncoding;
   }
 
-
   /**
    * Sets the character encoding.  If left to default,
    * Strings will be decoded for ISO-8859-1.  Clients
@@ -114,8 +114,7 @@
    * expect another part of their processing to decode
    * the strings for them.
    */
-  public void setCharacterEncoding(String characterEncoding)
-    throws UnsupportedEncodingException
+  public void setCharacterEncoding(final String characterEncoding) throws UnsupportedEncodingException
   {
     CaboHttpUtils.validateEncoding(characterEncoding);
     _characterEncoding = characterEncoding;
@@ -140,7 +139,6 @@
     return _contentStreamSize;
   }
 
-
   /**
    * Sets the maximum number of bytes that MultipartFormItem.writeFile()
    * will be allowed to write.  This value may be set immediately
@@ -153,7 +151,7 @@
    * to 128MB.
    * @see org.apache.myfaces.trinidadinternal.share.util.MultipartFormItem#writeFile
    */
-  public void setMaximumAllowedBytes(long maxAllowedBytes)
+  public void setMaximumAllowedBytes(final long maxAllowedBytes)
   {
     _maxAllowedBytes = Math.max(0L, maxAllowedBytes);
   }
@@ -171,22 +169,27 @@
    * Returns the next MultipartStreamItem from the request, or null if no
    * more are present.
    */
-  public MultipartFormItem getNextPart()
-    throws IOException
+  public MultipartFormItem getNextPart() throws IOException
   {
-    MultipartFormItemImpl previous = _currentItem;
+    final MultipartFormItemImpl previous = _currentItem;
     if (previous != null)
+    {
       previous.finish();
+    }
 
     //The first line is content-disposition
-    String dispositionText = _readLine(false);
+    final String dispositionText = _readLine(false);
     if (dispositionText == null)
+    {
       return null;
-    Disposition disposition = new Disposition(dispositionText);
+    }
+    final Disposition disposition = new Disposition(dispositionText);
 
-    String contentTypeText = _readLine(false);
+    final String contentTypeText = _readLine(false);
     if (contentTypeText == null)
+    {
       return null;
+    }
     String contentType = _parseContentType(contentTypeText);
 
     if (contentType == null)
@@ -196,10 +199,12 @@
     else
     {
       //Eat empty line
-      String emptyLine = _readLine(true);
+      final String emptyLine = _readLine(true);
       if (emptyLine.length() > 0)
+      {
         // =-=AEW Better exception?
         throw new IOException();
+      }
     }
 
     // Create the MultipartFormItem using the previously created
@@ -208,13 +213,11 @@
     return _currentItem;
   }
 
-
   //Reads a line and makes sure it is a boundary.  Throws an exception
   //if the line is not a boundary
-  private void _skipBoundary()
-    throws IOException
+  private void _skipBoundary() throws IOException
   {
-    String line = _readLine(true);
+    final String line = _readLine(true);
 
     //A boundary must be a boundary, otherwise the stream is corrupt
     if (!line.startsWith(_boundary))
@@ -224,30 +227,28 @@
     }
   }
 
-
   //Reads a line from the stream.  If required is true then throws an
   //Exception if the line cannot be read.
-  private String _readLine(boolean required)
-    throws IOException
+  private String _readLine(final boolean required) throws IOException
   {
     return _readLine(required, false, true);
   }
 
   //Reads a line from the stream.  If required is true then throws an
   //Exception if the line cannot be read.
-  private String _readLine(boolean required,
-                           boolean decodeEncoding,
-                           boolean stripNewLines)
-    throws IOException
+  private String _readLine(final boolean required, final boolean decodeEncoding, final boolean stripNewLines)
+  throws IOException
   {
-    byte[] data  = _lineBuffer;
-    int    bytes = _readLine(data, 0, data.length);
+    final byte[] data = _lineBuffer;
+    final int bytes = _readLine(data, 0, data.length);
 
     String line = null;
     if (bytes < 0)
     {
       if (required)
+      {
         throw new EOFException();
+      }
     }
     else
     {
@@ -258,14 +259,12 @@
 
   // This is a replacement for ServletInputStream.readLine().  We use
   // this utility method instead as we don't always have a ServletInputStream.
-  private int _readLine(
-    byte[]      buffer,
-    int         offset,
-    int         length
-    ) throws IOException
+  private int _readLine(final byte[] buffer, int offset, final int length) throws IOException
   {
     if (length <= 0)
+    {
       return 0;
+    }
 
     int count = 0;
     int c;
@@ -277,24 +276,26 @@
     // be of doubtful value.
     while ((c = _in.read()) != -1)
     {
-      buffer[offset++] = (byte)c;
+      buffer[offset++] = (byte) c;
       count++;
 
       // Found a newline;  we're done.
       if (c == '\n')
+      {
         break;
+      }
 
       // Out of space; we're done too.
       // Read one character less so that we can account for CR
-      if (count == length-1)
+      if (count == length - 1)
       {
         // If we've found a CR, then we're not quite done;  we'd
         // better read over the next character (which might be a LF);
         // othewise, the LF gets processed as a bonus newline.
         if (c == '\r')
         {
-          int nextchar = _in.read();
-          buffer[offset++] = (byte)nextchar;
+          final int nextchar = _in.read();
+          buffer[offset++] = (byte) nextchar;
           count++;
         }
 
@@ -303,28 +304,28 @@
     }
 
     _totalBytesRead += count;
-    return (count > 0) ? count : -1;
+    return count > 0 ? count : -1;
   }
 
-  private String _dataToString(
-    byte[]  data,
-    int     start,
-    int     bytes,
-    boolean decodeEncoding,
-    boolean stripNewLines)
+  private String _dataToString(final byte[] data, final int start, int bytes, final boolean decodeEncoding,
+      boolean stripNewLines)
   {
     if (bytes > 0)
     {
       int i = 0;
 
       // Strip off up to the last two CR/LF's automatically
-      while ((i < 2) && (bytes > 0))
+      while (i < 2 && bytes > 0)
       {
-        byte lastChar = data[start + bytes - 1];
-        if ((lastChar == '\r') || (lastChar == '\n'))
+        final byte lastChar = data[start + bytes - 1];
+        if (lastChar == '\r' || lastChar == '\n')
+        {
           bytes--;
+        }
         else
+        {
           break;
+        }
 
         i++;
       }
@@ -332,7 +333,7 @@
       // If we *don't* want to strip new lines, but we just did,
       // then put back a '\n' (doing it this way means that
       // we force any combo of CR/LF/etc. into '\n', which is our intention.)
-      if (!stripNewLines && (i > 0))
+      if (!stripNewLines && i > 0)
       {
         bytes++;
         data[start + bytes - 1] = '\n';
@@ -346,13 +347,13 @@
       // platform byte converter.  Whereas we explicitly want
       // to do _no_ byte conversion whatsoever, which is what
       // this constructor does.
-      if (decodeEncoding && (_characterEncoding != null))
+      if (decodeEncoding && _characterEncoding != null)
       {
         try
         {
           return new String(data, start, bytes, _characterEncoding);
         }
-        catch (UnsupportedEncodingException uee)
+        catch (final UnsupportedEncodingException uee)
         {
           // Shouldn't happen - we trap unsupported encodings
           // in setCharacterEncoding()... but fall through anyway
@@ -365,7 +366,7 @@
         {
           return new String(data, start, bytes, "ISO-8859-1");
         }
-        catch (UnsupportedEncodingException uee)
+        catch (final UnsupportedEncodingException uee)
         {
           // Shouldn't happen - we trap unsupported encodings
           // in setCharacterEncoding()... but fall through anyway
@@ -378,22 +379,20 @@
   }
 
   // Parse out the boundary text from the content type
-  static private String _parseBoundary(String contentType)
+  static private String _parseBoundary(final String contentType)
   {
-    int boundaryStart = contentType.indexOf(_BOUNDARY_PARAMETER);
+    final int boundaryStart = contentType.indexOf(_BOUNDARY_PARAMETER);
     if (boundaryStart < 0)
+    {
       return null;
+    }
 
     // Boundary always starts with "--"
-    return "--" +
-           contentType.substring(boundaryStart +
-                                 _BOUNDARY_PARAMETER.length());
+    return "--" + contentType.substring(boundaryStart + _BOUNDARY_PARAMETER.length());
   }
 
-
   //Reads the ContentType string out of a line of the incoming request
-  private String _parseContentType(String line)
-    throws IOException
+  private String _parseContentType(String line) throws IOException
   {
     String contentType = null;
 
@@ -401,7 +400,7 @@
 
     if (line.startsWith(_CONTENT_TYPE_PARAMETER))
     {
-      int start = line.indexOf(" ");
+      final int start = line.indexOf(" ");
 
       if (start == -1)
       {
@@ -422,29 +421,25 @@
     return contentType;
   }
 
-
-
   // Implementation of MultipartFormItem
-  private class MultipartFormItemImpl
-    implements MultipartFormItem
+  private class MultipartFormItemImpl implements MultipartFormItem
   {
-    MultipartFormItemImpl(
-      Disposition disposition,
-      String contentType) throws IOException
+    MultipartFormItemImpl(final Disposition disposition, final String contentType) throws IOException
     {
       _disposition = disposition;
       _contentType = contentType;
 
       // This is a parameter
       if (disposition.getFilename() == null)
+      {
         _parameterValue = _readParameter();
+      }
 
     }
 
     public void finish() throws IOException
     {
-      if ((_parameterValue == null) &&
-          !_finished)
+      if (_parameterValue == null && !_finished)
       {
         if (_inputStream == null)
         {
@@ -479,54 +474,58 @@
       return _contentType;
     }
 
-    public long writeFile(OutputStream out)
-      throws IOException
+    public long writeFile(final OutputStream out) throws IOException
     {
       // This isn't a file!
       if (_parameterValue != null)
+      {
         // =-=AEW Better exception?  We could just write
         // the value out to their output stream instead
         // of complaining, but this is probably not what
         // they really want.
         throw new IOException("Item is not a file");
-
+      }
 
       // The file's already been written, or at least
       // skipped over.
       if (_finished)
+      {
         // =-=AEW Better exception?
         throw new IOException("Item has already been read past.");
+      }
 
       if (_inputStream != null)
+      {
         // =-=AEW Better exception?
         throw new IOException("Input stream has already been requested.");
+      }
 
-      long   totalBytesWritten = 0;
+      long totalBytesWritten = 0;
 
       // ServletInputStream.readLine() has the annoying habit of adding a \r\n
       // to the end of the last line.
       // Since we want a byte-for-byte transfer, don't write the \r\n from the
       // end of a line until we have verified that we have another line.
-      boolean addCRLF     = false;
-      int  numbuf  = 0;
-      byte[] buffer     = __getStreamBuffer();
-      int    bufferSize = buffer.length;
-      while((numbuf = _readLine(buffer, 0, bufferSize)) != -1)
+      boolean addCRLF = false;
+      int numbuf = 0;
+      final byte[] buffer = __getStreamBuffer();
+      final int bufferSize = buffer.length;
+      while ((numbuf = _readLine(buffer, 0, bufferSize)) != -1)
       {
         // Check for boundary
-        if(numbuf > 2 && buffer[0] == '-' && buffer[1] == '-')   // quick pre-check
+        if (numbuf > 2 && buffer[0] == '-' && buffer[1] == '-') // quick pre-check
         {
-          String line = _dataToString(buffer, 0, numbuf, false, true);
-          if(line.startsWith(_boundary))
+          final String line = _dataToString(buffer, 0, numbuf, false, true);
+          if (line.startsWith(_boundary))
           {
-              break;
+            break;
           }
         }
 
         // Are we supposed to write \r\n from the last iteration?
-        if(addCRLF)
+        if (addCRLF)
         {
-          if(out != null)
+          if (out != null)
           {
             out.write('\r');
             out.write('\n');
@@ -535,69 +534,75 @@
           addCRLF = false;
         }
         // Postpone any ending \r\n until the next iteration
-        if(numbuf >= 2 &&
-           buffer[numbuf - 2] == '\r' &&
-           buffer[numbuf - 1] == '\n')
+        if (numbuf >= 2 && buffer[numbuf - 2] == '\r' && buffer[numbuf - 1] == '\n')
         {
-            numbuf -= 2;    // skip the last 2 chars
-            addCRLF = true;     // make a note to write them on the next iteration
+          numbuf -= 2; // skip the last 2 chars
+          addCRLF = true; // make a note to write them on the next iteration
         }
-        if(out != null)
+        if (out != null)
         {
           totalBytesWritten += numbuf;
           if (totalBytesWritten <= _maxAllowedBytes)
+          {
             out.write(buffer, 0, numbuf);
+          }
         }
       }
-      
+
       _finished = true;
 
       if (totalBytesWritten >= _maxAllowedBytes)
-        throw new EOFException("Uploaded file of length " + totalBytesWritten +
-                               " bytes exceeded maximum allowed length ("
-                               + _maxAllowedBytes + " bytes)");
+      {
+        throw new EOFException("Uploaded file of length " + totalBytesWritten
+            + " bytes exceeded maximum allowed length (" + _maxAllowedBytes + " bytes)");
+      }
       return totalBytesWritten;
     }
 
-    public InputStream getInputStream()
-      throws IOException
+    public InputStream getInputStream() throws IOException
     {
       if (_parameterValue != null)
+      {
         // =-=AEW Better exception?  We could just give
         // them a StringInputStream, but this probably
         // isn't what they want
         throw new IOException("Item is not a file");
+      }
 
       if (_finished)
+      {
         // =-=AEW Better exception?
         throw new IOException("Item has already been read past.");
+      }
 
       if (_inputStream != null)
+      {
         // =-=AEW Better exception?
         throw new IOException("Input stream has already been requested.");
+      }
 
       _inputStream = new MultipartInputStream();
       return _inputStream;
     }
 
-    private String _readParameter()
-      throws IOException
+    private String _readParameter() throws IOException
     {
       // Create the buffer.  It's no use reusing the buffer,
       // since the String object sent out will end up "owning"
       // the storage of the StringBuffer
-      StringBuffer buffer = new StringBuffer(200);
-      for (String line = _readLine(false, true, false);
-           (line != null) && !line.startsWith(_boundary);
-           line = _readLine(false, true, false))
+      final StringBuffer buffer = new StringBuffer(200);
+      for (String line = _readLine(false, true, false); line != null
+      && !line.startsWith(_boundary); line = _readLine(false, true, false))
       {
         buffer.append(line);
       }
 
       // Trim the final newline
-      int length = buffer.length();
+      final int length = buffer.length();
       if (buffer.charAt(length - 1) == '\n')
+      {
         buffer.deleteCharAt(length - 1);
+      }
 
       // =-=AEW Trim the buffer before toString()'ing?  The
       // usual time/space tradeoff.
@@ -606,35 +611,36 @@
 
     private MultipartInputStream _inputStream;
 
-    private Disposition _disposition;
+    private Disposition          _disposition;
 
-    private String _contentType;
+    private String               _contentType;
 
-    private String _parameterValue;
+    private String               _parameterValue;
 
     // For a file item, has the file been read?
-    private boolean _finished;
-
+    private boolean              _finished;
 
     private class MultipartInputStream extends InputStream
     {
-      MultipartInputStream()
-        throws IOException
+      MultipartInputStream() throws IOException
       {
         // This isn't a file!
         if (_parameterValue != null)
+        {
           // =-=AEW Better exception?  We could just write
           // the value out to their output stream instead
           // of complaining, but this is probably not what
           // they really want.
           throw new IOException("Item is not a file");
-
+        }
 
         // The file's already been written, or at least
         // skipped over.
         if (_finished)
+        {
           // =-=AEW Better exception?
           throw new IOException("Item has already been read past.");
+        }
 
         _begin = 0;
         _end = 0;
@@ -653,7 +659,7 @@
             ;
           }
         }
-        catch (IOException e)
+        catch (final IOException e)
         {
           // Don't care...
           ;
@@ -662,8 +668,7 @@
 
       //Fills up the _buffer parameter with
       //Returns false on EOF
-      private void readLine()
-        throws IOException
+      private void readLine() throws IOException
       {
         if (_finished)
         {
@@ -677,39 +682,36 @@
           _addCRLF = false;
         }
 
-        int  bufferSize = _buffer.length;
-        int  numbuf  = _readLine(_buffer, _end, (bufferSize-_end));
+        final int bufferSize = _buffer.length;
+        int numbuf = _readLine(_buffer, _end, (bufferSize - _end));
         if (numbuf < 0)
         {
           _finished = true;
           return;
         }
-        
-        if(numbuf > 2 && _buffer[_end] == '-' && _buffer[_end+1] == '-')   // quick pre-check
+
+        if (numbuf > 2 && _buffer[_end] == '-' && _buffer[_end + 1] == '-') // quick pre-check
         {
           // Check for boundary
-          String line = _dataToString(_buffer, _end, numbuf, false, true);
-          if(line.startsWith(_boundary))
+          final String line = _dataToString(_buffer, _end, numbuf, false, true);
+          if (line.startsWith(_boundary))
           {
-            _finished = true; 
+            _finished = true;
             return;
           }
-        } 
-        
-        if(numbuf >= 2 &&
-           _buffer[_end+numbuf - 2] == '\r' &&
-           _buffer[_end+numbuf - 1] == '\n')
+        }
+
+        if (numbuf >= 2 && _buffer[_end + numbuf - 2] == '\r' && _buffer[_end + numbuf - 1] == '\n')
         {
           // Postpone any ending \r\n until the next iteration
-          numbuf -= 2;     // skip the last 2 chars
+          numbuf -= 2; // skip the last 2 chars
           _addCRLF = true; // make a note to write them on the next iteration
         }
         _end += numbuf;
       }
 
       @Override
-      public int read(byte[] buffer, int offset, int length)
-        throws IOException
+      public int read(final byte[] buffer, final int offset, final int length) throws IOException
       {
         int bytes = -1; // default to EOF
 
@@ -724,15 +726,15 @@
           {
             readLine();
           }
-          if(!_finished)
+          if (!_finished)
           {
             cachedBytes = _end - _begin;
-  
-            bytes = (length > cachedBytes) ? cachedBytes : length;
-  
+
+            bytes = length > cachedBytes ? cachedBytes : length;
+
             System.arraycopy(_buffer, _begin, buffer, offset, bytes);
             _begin += bytes;
-  
+
             //If we've written all the data out of the array, then reset
             //to the beginning of the array
             if (_begin == _end)
@@ -745,17 +747,15 @@
       }
 
       @Override
-      public int read(byte[] buffer)
-        throws IOException
+      public int read(final byte[] buffer) throws IOException
       {
         return read(buffer, 0, buffer.length);
       }
 
       @Override
-      public int read()
-        throws IOException
+      public int read() throws IOException
       {
-        byte[] temp = new byte[1];
+        final byte[] temp = new byte[1];
         int value;
 
         value = read(temp, 0, 1);
@@ -770,28 +770,29 @@
     }
 
     //Where data begins in the buffer
-    private int _begin;
+    private int     _begin;
+
     //Where date ends in the buffer
-    private int _end;
+    private int     _end;
 
     //Data read from the servlet
-    private byte[] _buffer;
+    private byte[]  _buffer;
 
     //If true then no more bytes can be read
     private boolean _addCRLF;
   }
 
-
   private class Disposition
   {
-    Disposition(String line)
-      throws IOException // =-=AEW Better exception?
+    Disposition(final String line) throws IOException // =-=AEW Better exception?
     {
       // =-=AEW This could be more efficient
-      StringTokenizer tokenizer = new StringTokenizer(line, ";");
+      final StringTokenizer tokenizer = new StringTokenizer(line, ";");
 
       if (!tokenizer.hasMoreTokens())
+      {
         throw new IOException();
+      }
 
       // The first token has to be "content-disposition: something"
       String disposition = tokenizer.nextToken().toLowerCase();
@@ -801,17 +802,18 @@
       }
 
       // Get everything after content-disposition, lose the white space...
-      disposition = disposition.substring(
-                     _CONTENT_DISPOSITION_PARAMETER.length()).trim();
+      disposition = disposition.substring(_CONTENT_DISPOSITION_PARAMETER.length()).trim();
 
       // ... and then make sure it's form-data.
       if (!disposition.equals(_FORM_DATA_DISPOSITION))
+      {
         throw new IOException();
+      }
 
       String filenameBuffer = null;
       while (tokenizer.hasMoreTokens())
       {
-        String keyValue = tokenizer.nextToken().trim();
+        final String keyValue = tokenizer.nextToken().trim();
         if (_name == null)
         {
           _name = _extractName(keyValue);
@@ -819,15 +821,21 @@
         else
         {
           if (filenameBuffer == null)
+          {
             filenameBuffer = keyValue;
           // Don't quit on the first semicolon - keep appending
+          }
           else
+          {
             filenameBuffer = filenameBuffer + ";" + keyValue;
+          }
         }
       }
 
       if (filenameBuffer != null)
+      {
         _filename = _extractFilename(filenameBuffer);
+      }
     }
 
     public final String getName()
@@ -840,21 +848,19 @@
       return _filename;
     }
 
-    private String _extractName(String keyValue)
+    private String _extractName(final String keyValue)
     {
       return _extractValue(keyValue, _NAME_PARAMETER);
     }
 
-    private String _extractFilename(String keyValue)
+    private String _extractFilename(final String keyValue)
     {
       String fileName = _extractValue(keyValue, _FILENAME_PARAMETER);
       try
       {
-        fileName = CaboHttpUtils.decodeRequestParameter(fileName,
-                                                        getCharacterEncoding(),
-                                                        null);
+        fileName = CaboHttpUtils.decodeRequestParameter(fileName, getCharacterEncoding(), null);
       }
-      catch (UnsupportedEncodingException uee)
+      catch (final UnsupportedEncodingException uee)
       {
         // Must never happen, because we always check the validity
         // of the encoding before it gets set
@@ -864,8 +870,7 @@
       // Strip off anything that corresponds to a path.
       if (fileName != null)
       {
-        int index =
-          Math.max(fileName.lastIndexOf('/'), fileName.lastIndexOf('\\'));
+        final int index = Math.max(fileName.lastIndexOf('/'), fileName.lastIndexOf('\\'));
 
         if (index != -1)
         {
@@ -876,20 +881,22 @@
       return fileName;
     }
 
-    private String _extractValue(
-      String keyValue,
-      String param)
+    private String _extractValue(final String keyValue, final String param)
     {
-      int length = param.length();
+      final int length = param.length();
       if (keyValue.regionMatches(true, 0, param, 0, length))
       {
         // Remove the leading and trailing quotes
         int start = length;
         if (keyValue.charAt(start) == '"')
+        {
           start++;
+        }
         int end = keyValue.length();
         if (keyValue.charAt(end - 1) == '"')
+        {
           end--;
+        }
         return keyValue.substring(start, end);
       }
 
@@ -897,57 +904,62 @@
     }
 
     private String _name;
+
     private String _filename;
   }
 
   byte[] __getStreamBuffer()
   {
     if (_streamBuffer == null)
+    {
       _streamBuffer = new byte[_STREAM_BUFFER_SIZE];
+    }
     return _streamBuffer;
   }
 
+  private static final String   _MULTIPART_REQUEST_TYPE        = "multipart/form-data";
 
-  private static final String _MULTIPART_REQUEST_TYPE = "multipart/form-data";
-
-  private static final String _DEFAULT_CONTENT_TYPE =
-      "application/octet-stream";
+  private static final String   _DEFAULT_CONTENT_TYPE          = "application/octet-stream";
 
   //Parameter of the content type used to identify the boundary string
-  private static final String _BOUNDARY_PARAMETER = "boundary=";
+  private static final String   _BOUNDARY_PARAMETER            = "boundary=";
+
+  private static final String   _NAME_PARAMETER                = "name=";
 
-  private static final String _NAME_PARAMETER = "name=";
+  private static final String   _FILENAME_PARAMETER            = "filename=";
 
-  private static final String _FILENAME_PARAMETER = "filename=";
+  private static final String   _CONTENT_TYPE_PARAMETER        = "content-type";
 
-  private static final String _CONTENT_TYPE_PARAMETER = "content-type";
+  private static final String   _CONTENT_DISPOSITION_PARAMETER = "content-disposition:";
 
-  private static final String _CONTENT_DISPOSITION_PARAMETER =
-    "content-disposition:";
+  private static final String   _FORM_DATA_DISPOSITION         = "form-data";
 
-  private static final String _FORM_DATA_DISPOSITION =
-    "form-data";
+  private static final String   _HANDLED                       = "org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler.handled";
 
-  private static final String _HANDLED =
-    "org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler.handled";
+  private static final int      _STREAM_BUFFER_SIZE            = 65000;
 
-  private static final int _STREAM_BUFFER_SIZE = 65000;
-  private static final int _LINE_BUFFER_SIZE = 8000;
+  private static final int      _LINE_BUFFER_SIZE              = 8000;
 
   // Use one buffer for each of file streaming and line reading.
   // Not multithread
   // safe, but this class explicitly _can't_ multithread anyway.
-  private byte[]             _lineBuffer   = new byte[_LINE_BUFFER_SIZE];
-  private byte[]             _streamBuffer;
+  private final byte[]                _lineBuffer                    = new byte[_LINE_BUFFER_SIZE];
 
-  private InputStream        _in;
-  private String             _boundary;
+  private byte[]                _streamBuffer;
 
-  private MultipartFormItemImpl  _currentItem;
-  private String                 _characterEncoding;
+  private InputStream           _in;
 
-  private long _maxAllowedBytes = 1L << 27;
-  private int _totalBytesRead;
-  private int _contentStreamSize = -1;
+  private String                _boundary;
+
+  private MultipartFormItemImpl _currentItem;
+
+  private String                _characterEncoding;
+
+  private long                  _maxAllowedBytes               = 1L << 27;
+
+  private int                   _totalBytesRead;
+
+  private int                   _contentStreamSize             = -1;
 }
+
 

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java Wed Jan 31 15:29:21 2007
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -58,9 +58,7 @@
    *        Skin "extends". If it is a Skin designed for "org.apache.myfaces.trinidad.desktop"
    *        render-kit-id, then its base skin should be SimpleDesktopSkin.
    *        If it is a Skin designed for "org.apache.myfaces.trinidad.pda" render-kit-id,
-   *        then its base skin should be SimplePdaSkin. Currently, we
-   *        do not allow one SkinExtension to extend another, but we may
-   *        someday.
+   *        then its base skin should be SimplePdaSkin.
    *        Must be non-null.
    * @param id A string which can be used to uniquely identify the
    *           Skin .
@@ -189,6 +187,19 @@
   }
 
   /**
+   * Returns the styleClassMap for this extension
+   */
+    @Override
+  public Map<String, String> getStyleClassMap(
+       RenderingContext arc
+     )
+  {
+    if (_styleClassMap != null)
+      return _styleClassMap;
+    return _baseSkin.getStyleClassMap(arc);
+  }
+
+  /**
    * Override of Skin.getTranslatedValue() which
    * supports pulling translations from component providers
    * as well as the base Skin.
@@ -476,7 +487,7 @@
     )
   {
    // We store the translation keys map in the translation cache
-    Map<String, Boolean> keys = 
+    Map<String, Boolean> keys =
       (Map<String, Boolean>)_getCachedTranslatedValue(lContext,
                                               _TRANSLATION_KEYS_KEY);
 
@@ -546,10 +557,10 @@
         _LOG.warning(_CIRCULAR_INCLUDE_ERROR + refName);
       return null;
     }
-    
+
     if (referencedIconStack == null)
     {
-      // -= Simon Lessard =- 
+      // -= Simon Lessard =-
       // TODO: Check if something better than Stack can be used
       referencedIconStack = new Stack<String>();
     }
@@ -594,7 +605,7 @@
 
     // Tests whether the value is present in the (possibly null) stack.
   private static boolean _stackContains(
-      Stack<String> stack, 
+      Stack<String> stack,
       Object value)
   {
     if (stack == null)
@@ -626,6 +637,7 @@
   private SkinImpl    _baseSkin;
   private String      _styleSheetName;
   private String      _bundleName;
+  private Map<String, String> _styleClassMap;
 
   // Now that we look into possibly multiple ResourceBundles
   // to find a translation (eg. the local bundle, a component
@@ -640,7 +652,7 @@
   //
   // This HashMap hashes Locales -> HashMaps.
   // The HashMaps map translation key to message.
-  private OptimisticHashMap<Locale, Map<String, Object>> _translations = 
+  private OptimisticHashMap<Locale, Map<String, Object>> _translations =
     new OptimisticHashMap<Locale, Map<String, Object>>(13);
 
   // The StyleSheetDocument for the base LookAndFeel's style sheet

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java Wed Jan 31 15:29:21 2007
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -23,9 +23,14 @@
 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.CoreRenderKit;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
+
 
 /**
  * Factory for creating Skin objects.
@@ -98,7 +103,9 @@
    * @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
@@ -114,13 +121,13 @@
    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 (renderKitId == null)
+      renderKitId = XhtmlConstants.APACHE_TRINIDAD_DESKTOP;
 
     // loop through each skin in the SkinFactory
     // and see if the family and the renderKitId match
-    
+
     for(Skin skin : _skins.values())
     {
       if (family.equalsIgnoreCase(skin.getFamily()) &&
@@ -136,19 +143,20 @@
     // that matches the renderkitid.
      if (_LOG.isWarning())
      {
-       _LOG.warning("Can't find a skin that matches family " + family + 
+       _LOG.warning("Can't find a skin that matches family " + family +
                     " 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.APACHE_TRINIDAD_PORTLET))
+      return getSkin(context, _SIMPLE_PORTLET);
+    else if (renderKitId.equals(XhtmlConstants.APACHE_TRINIDAD_PDA))
       return getSkin(context, _SIMPLE_PDA);
-    }
     else
-    {
       return getSkin(context, _SIMPLE_DESKTOP);
-    }
 
   }
 
@@ -164,9 +172,11 @@
 
   static private final String _RENDER_KIT_ID_CORE = "org.apache.myfaces.trinidad.desktop";
   static private final String _RENDER_KIT_ID_PDA = "org.apache.myfaces.trinidad.pda";
+  static private final String _RENDER_KIT_ID_PORTLET = CoreRenderKit.OUTPUT_MODE_PORTLET;
+
   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/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java Wed Jan 31 15:29:21 2007
@@ -25,15 +25,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;
@@ -325,6 +333,41 @@
     _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; The default implemention returns a map of full
+    * style class names to shortened style classes.
+    */
+   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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java Wed Jan 31 15:29:21 2007
@@ -30,9 +30,9 @@
 import java.util.Iterator;
 import java.util.List;
 
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
-import javax.servlet.ServletContext;
 import javax.xml.parsers.SAXParserFactory;
 
 import org.apache.myfaces.trinidad.skin.SkinFactory;
@@ -42,8 +42,11 @@
 import org.apache.myfaces.trinidad.skin.Skin;
 import org.apache.myfaces.trinidadinternal.renderkit.core.skin.MinimalDesktopSkinExtension;
 import org.apache.myfaces.trinidadinternal.renderkit.core.skin.MinimalPdaSkinExtension;
+import org.apache.myfaces.trinidadinternal.renderkit.core.skin.MinimalPortletSkinExtension;
 import org.apache.myfaces.trinidadinternal.renderkit.core.skin.SimpleDesktopSkin;
 import org.apache.myfaces.trinidadinternal.renderkit.core.skin.SimplePdaSkin;
+import org.apache.myfaces.trinidadinternal.renderkit.core.skin.SimplePortletSkin;
+
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
@@ -100,7 +103,7 @@
    * @param context ServletContext, used to get the trinidad-skins.xml file.
    */
   static public void registerSkinExtensions(
-    ServletContext context)
+    ExternalContext context)
   {
 
     SkinFactory skinFactory = SkinFactory.getFactory();
@@ -259,7 +262,12 @@
 
     SimplePdaSkin simplePdaSkin = new SimplePdaSkin();
     skinFactory.addSkin(simplePdaSkin.getId(), simplePdaSkin);
-
+    //portlet skin maps most of our style classes to portlet style classes,
+    // so we output portlet style classes.
+    // It also clears out the portlet style class definitions.
+    SimplePortletSkin simplePortletSkin = new SimplePortletSkin();
+    skinFactory.addSkin(simplePortletSkin.getId(), simplePortletSkin);
+    
     MinimalDesktopSkinExtension minimalDesktopSkin =
       new MinimalDesktopSkinExtension(simpleDesktopSkin);
     skinFactory.addSkin(minimalDesktopSkin.getId(), minimalDesktopSkin);
@@ -267,6 +275,10 @@
     MinimalPdaSkinExtension minimalPdaSkin =
       new MinimalPdaSkinExtension(simplePdaSkin);
     skinFactory.addSkin(minimalPdaSkin.getId(), minimalPdaSkin);
+    
+    MinimalPortletSkinExtension minimalPortletSkin = 
+      new MinimalPortletSkinExtension(simplePortletSkin);
+    skinFactory.addSkin(minimalPortletSkin.getId(), minimalPortletSkin);
   }
 
   /**
@@ -281,7 +293,7 @@
    * @param skinFactory
    */
   private static void _registerSkinExtensions(
-    ServletContext context,
+    ExternalContext context,
     SkinFactory skinFactory)
   {
     if (context == null)
@@ -514,7 +526,7 @@
    * @return List of SkinNodes (skin elements) found in trinidad-skins.xml
    */
   private static SkinsNode _getWebInfSkinsNode(
-    ServletContext context)
+    ExternalContext context)
   {
     InputStream in = context.getResourceAsStream(_CONFIG_FILE);
     if (in != null)

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java Wed Jan 31 15:29:21 2007
@@ -142,11 +142,12 @@
     // Write out the src attr
     String baseURI = _getBaseURI(context, arc);
     String uri = getRelativeURI(context, arc);
-
+    
     if (baseURI == null)
-      writer.writeAttribute("src", uri, null);
+      writer.writeURIAttribute("src", context.getExternalContext().encodeResourceURL(uri), null);
     else
-      writer.writeAttribute("src", baseURI + uri, null);
+      writer.writeURIAttribute("src", 
+                            context.getExternalContext().encodeResourceURL(baseURI + uri), null);
 
     // Write out the width/height attrs
     Object width = _getWidth(arc, attrs);

Modified: incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/StyleProvider.java Wed Jan 31 15:29:21 2007
@@ -18,9 +18,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.
@@ -39,6 +41,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-pretrunkmerge/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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/StyleUtils.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/StyleUtils.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/StyleUtils.java Wed Jan 31 15:29:21 2007
@@ -18,13 +18,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.
  *
@@ -37,48 +32,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-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/action/FireAction.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/action/FireAction.java?view=diff&rev=502039&r1=502038&r2=502039
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/action/FireAction.java (original)
+++ incubator/adffaces/branches/jwaldman-portal-pretrunkmerge/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/action/FireAction.java Wed Jan 31 15:29:21 2007
@@ -20,6 +20,9 @@
 
 import java.io.IOException;
 
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidadinternal.share.url.FacesURLEncoder;
 import org.apache.myfaces.trinidadinternal.share.url.URLEncoder;
 import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
 import org.apache.myfaces.trinidadinternal.ui.UIConstants;
@@ -280,21 +283,28 @@
 
     // Create the buffer
     StringBuffer buffer = new StringBuffer(length);
-
-    // Add the start script and destination
+    StringBuffer urlBuffer = new StringBuffer(length);
+    // Add the start script
     buffer.append(startScript);
-    buffer.append(destination);
+
+    urlBuffer.append(destination);
 
     // Make sure we are in the query string portion of the URL
     if (destination.indexOf('?') == -1)
-      buffer.append("?");
+      urlBuffer.append("?");
 
-    appendURLParameter(buffer, eventKey, event);
-    appendURLParameter(buffer, sourceKey, source);
+    appendURLParameter(urlBuffer, eventKey, event);
+    appendURLParameter(urlBuffer, sourceKey, source);
     if ((extraKey != null) && (extraValue != null))
-      appendURLParameter(buffer, extraKey, extraValue);
-    appendClientParameters(context, buffer, parameters);
+      appendURLParameter(urlBuffer, extraKey, extraValue);
+    appendClientParameters(context, urlBuffer, parameters);
+    
+    String url = urlBuffer.toString();
+    FacesContext facesContext = context.getFacesContext();
+    if(facesContext != null)
+      url = facesContext.getExternalContext().encodeActionURL(url);
 
+    buffer.append(url);
     buffer.append(endScript);
     buffer.append(returnScript);