myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arobinso...@apache.org
Subject svn commit: r889345 [8/17] - in /myfaces/trinidad/branches/ar_clientBehaviors: ./ trinidad-api/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/or...
Date Thu, 10 Dec 2009 17:46:47 GMT
Modified: myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MessageBoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MessageBoxRenderer.java?rev=889345&r1=889344&r2=889345&view=diff
==============================================================================
--- myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MessageBoxRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MessageBoxRenderer.java Thu Dec 10 17:46:13 2009
@@ -19,6 +19,7 @@
 package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
 import java.io.IOException;
+
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -31,13 +32,12 @@
 import org.apache.myfaces.trinidad.bean.FacesBean;
 import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.component.core.output.CoreMessages;
-
 import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.context.RequestContext;
-import org.apache.myfaces.trinidad.skin.Icon;
 import org.apache.myfaces.trinidad.util.LabeledFacesMessage;
 import org.apache.myfaces.trinidadinternal.util.MessageUtils;
 
+
 /**
  * Renderer for org.apache.myfaces.trinidad.Messages, family org.apache.myfaces.trinidad.Messages.
  *
@@ -49,13 +49,15 @@
     this(CoreMessages.TYPE);
   }
 
-  protected MessageBoxRenderer(FacesBean.Type type)
+  protected MessageBoxRenderer(
+    FacesBean.Type type)
   {
     super(type);
   }
 
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
     _textKey     = type.findKey("text");
@@ -74,8 +76,12 @@
 
   @SuppressWarnings("unchecked")
   @Override
-  protected void encodeAll(FacesContext context, RenderingContext arc,
-      UIComponent component, FacesBean bean) throws IOException
+  protected void encodeAll(
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
     // Force MessageBox to be re-rendered via PPR, since the set
     // of messages may have changed.
@@ -85,19 +91,19 @@
 
     ResponseWriter writer = context.getResponseWriter();
 
-    Map<String, String> origSkinResourceMap = arc.getSkinResourceKeyMap();
+    Map<String, String> origSkinResourceMap = rc.getSkinResourceKeyMap();
 
     // Setup the rendering context, so that default skin selectors of
     // delegate renderers are mapped to those of this renderer
-    arc.setSkinResourceKeyMap(_RESOURCE_KEY_MAP);
+    rc.setSkinResourceKeyMap(_RESOURCE_KEY_MAP);
 
     // Check if INLINE validation mode is enabled
     boolean inlineValidation =
         RequestContext.ClientValidation.INLINE.equals(
             RequestContext.getCurrentInstance().getClientValidation());
-    
-    boolean isGlobalOnly = isGlobalOnly(bean);
-    
+
+    boolean isGlobalOnly = isGlobalOnly(component, bean);
+
     // Determine if we should render the MessageBox
     boolean renderMsgBox = (isGlobalOnly && context.getMessages(null).hasNext()) ||
       (!isGlobalOnly && inlineValidation) || (!isGlobalOnly && context.getMessages().hasNext());
@@ -105,27 +111,27 @@
     if (renderMsgBox)
     {
 
-      if (!isGlobalOnly && inlineValidation && supportsScripting(arc))
+      if (!isGlobalOnly && inlineValidation && supportsScripting(rc))
       {
         writer.startElement(XhtmlConstants.SCRIPT_ELEMENT, null);
-        renderScriptDeferAttribute(context, arc);
-        renderScriptTypeAttribute(context, arc);
+        renderScriptDeferAttribute(context, rc);
+        renderScriptTypeAttribute(context, rc);
 
         // Output the styles required for client-side manipulation of the MessageBox
 
         // Output style for list of messages
         writer.writeText("TrPage.getInstance().addStyleClassMap( {'", null);
         writer.writeText(SkinSelectors.AF_MESSAGES_LIST_STYLE_CLASS + "':'", null);
-        writer.writeText(arc.getStyleClass(SkinSelectors.AF_MESSAGES_LIST_STYLE_CLASS), null);
+        writer.writeText(rc.getStyleClass(SkinSelectors.AF_MESSAGES_LIST_STYLE_CLASS), null);
 
         // Single entry list uses two styles
         writer.writeText("','" + SkinSelectors.AF_MESSAGES_LIST_SINGLE_STYLE_CLASS + "':'", null);
-        writer.writeText(arc.getStyleClass(SkinSelectors.AF_MESSAGES_LIST_STYLE_CLASS), null);
-        writer.writeText(" " + arc.getStyleClass(SkinSelectors.AF_MESSAGES_LIST_SINGLE_STYLE_CLASS), null);
+        writer.writeText(rc.getStyleClass(SkinSelectors.AF_MESSAGES_LIST_STYLE_CLASS), null);
+        writer.writeText(" " + rc.getStyleClass(SkinSelectors.AF_MESSAGES_LIST_SINGLE_STYLE_CLASS), null);
 
         // Output Style for MessageBox Anchors
         writer.writeText("','" + SkinSelectors.LINK_STYLE_CLASS + "':'", null);
-        writer.writeText(arc.getStyleClass(SkinSelectors.LINK_STYLE_CLASS), null);
+        writer.writeText(rc.getStyleClass(SkinSelectors.LINK_STYLE_CLASS), null);
         writer.writeText("'} ); ", null);
 
         // Output the script that will register the MessageBox with
@@ -139,7 +145,7 @@
 
       // Delegate rendering of the outer shell to the BoxRenderer class
       // which will call back to this renderer to output the messages
-      _boxRenderer.encodeAll(context, arc, component, bean);
+      _boxRenderer.encodeAll(context, rc, component, bean);
     }
     else
     {
@@ -148,34 +154,34 @@
       renderId(context, component);
       writer.endElement(XhtmlConstants.SPAN_ELEMENT);
     }
-    
+
     // Reset the skin resource map
-    arc.setSkinResourceKeyMap(origSkinResourceMap);
+    rc.setSkinResourceKeyMap(origSkinResourceMap);
   }
 
   protected void _renderContent(
-      FacesContext context,
-      RenderingContext arc,
-      UIComponent component,
-      FacesBean bean)
-      throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
 
-    boolean globalOnly = isGlobalOnly(bean);
+    boolean globalOnly = isGlobalOnly(component, bean);
 
     // TODO - Merge styles into AF_MESSAGES_STYLE_CLASS
     writer.startElement(XhtmlConstants.DIV_ELEMENT, component);
-    renderStyleClass(context, arc, SkinSelectors.AF_MESSAGES_BODY_STYLE_CLASS);
+    renderStyleClass(context, rc, SkinSelectors.AF_MESSAGES_BODY_STYLE_CLASS);
 
-    _renderHeader(context, arc, component, bean);
+    _renderHeader(context, rc, component, bean);
 
     // Render the 'message' attribute if specified
-    String message = getMessage(bean);
+    String message = getMessage(component, bean);
     if (message != null)
     {
       writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
-      renderStyleClass(context, arc, SkinSelectors.AF_MESSAGES_MESSAGE_TEXT_STYLE_CLASS);
+      renderStyleClass(context, rc, SkinSelectors.AF_MESSAGES_MESSAGE_TEXT_STYLE_CLASS);
       writer.write(message);
       writer.endElement(XhtmlConstants.DIV_ELEMENT);
     }
@@ -196,12 +202,12 @@
       styleClasses = new String[] {SkinSelectors.AF_MESSAGES_LIST_STYLE_CLASS,
         SkinSelectors.AF_MESSAGES_LIST_SINGLE_STYLE_CLASS};
 
-    renderStyleClasses(context, arc, styleClasses);
+    renderStyleClasses(context, rc, styleClasses);
 
-    _renderGlobalMessages(context, arc, component, bean);
+    _renderGlobalMessages(context, rc, component, bean);
 
     if (!globalOnly)
-      _renderComponentMessages(context, arc, component, bean);
+      _renderComponentMessages(context, rc, component, bean);
 
     // End of list
     writer.endElement("ol");
@@ -211,11 +217,11 @@
 
   @SuppressWarnings("unchecked")
   protected void _renderGlobalMessages(
-      FacesContext context,
-      RenderingContext arc,
-      UIComponent component,
-      FacesBean bean)
-      throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
 
@@ -227,7 +233,7 @@
 
       writer.startElement("li", null);
 
-      String text = MessageUtils.getGlobalMessage(arc, msg.getSummary(), msg.getDetail());
+      String text = MessageUtils.getGlobalMessage(rc, msg.getSummary(), msg.getDetail());
       renderPossiblyFormattedText(context, text);
 
       writer.endElement("li");
@@ -236,11 +242,11 @@
 
   @SuppressWarnings("unchecked")
   protected void _renderComponentMessages(
-      FacesContext context,
-      RenderingContext arc,
-      UIComponent component,
-      FacesBean bean)
-      throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
 
@@ -260,10 +266,10 @@
 
         writer.startElement("li", null);
 
-        _renderMessageAnchor(context, arc, msg, id);
+        _renderMessageAnchor(context, rc, msg, id);
+
+        String text = MessageUtils.getClientMessage(rc, msg.getSummary(), msg.getDetail());
 
-        String text = MessageUtils.getClientMessage(arc, msg.getSummary(), msg.getDetail());
-        
         // If the first two characters are "- ", assume it's due to af_messages.LIST_FORMAT_private;
         // alternatively, we could change the value of this key in CoreBundle.xrts, located in:
         // trinidad-impl\src\main\xrts\org\apache\myfaces\trinidadinternal\renderkit\core\resource
@@ -280,7 +286,7 @@
         {
           isNullLabel = true;
         }
-        
+
         if (isNullLabel && text.charAt(0) == '-' && text.charAt(1) == ' ')
           text = text.substring(2);
 
@@ -292,19 +298,21 @@
   }
 
   protected void _renderHeader(
-      FacesContext        context,
-      RenderingContext arc,
-      UIComponent         component,
-      FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
-    delegateRenderer(context, arc, component, bean, _headerRenderer);
+    delegateRenderer(context, rc, component, bean, _headerRenderer);
   }
 
   protected void _renderMessageAnchor(
-      FacesContext        context,
-      RenderingContext arc,
-      FacesMessage msg,
-      String componentId) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    FacesMessage     msg,
+    String           componentId
+    ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
 
@@ -321,7 +329,7 @@
       {
         String anchor = MessageUtils.getAnchor(componentId);
         writer.startElement(XhtmlConstants.LINK_ELEMENT, null);
-        renderStyleClass(context, arc, SkinSelectors.LINK_STYLE_CLASS);
+        renderStyleClass(context, rc, SkinSelectors.LINK_STYLE_CLASS);
         writer.writeAttribute(XhtmlConstants.HREF_ATTRIBUTE, "#" + anchor, null);
         writer.write(labelString);
         writer.endElement(XhtmlConstants.LINK_ELEMENT);
@@ -333,27 +341,35 @@
   // Rendering delegate to handle output of the header for the message box
   private class HeaderRenderer extends PanelHeaderRenderer
   {
-    public HeaderRenderer(FacesBean.Type type)
+    public HeaderRenderer(
+      FacesBean.Type type)
     {
       super(type);
     }
 
     @Override
-    protected boolean shouldRenderId(FacesContext context, UIComponent component)
+    protected boolean shouldRenderId(
+      FacesContext context,
+      UIComponent  component)
     {
       // Header will always be refreshed as sub-element of parent
       return false;
     }
 
     @Override
-    protected void renderEventHandlers(FacesContext context, FacesBean bean)
-        throws IOException
+    protected void renderEventHandlers(
+      FacesContext context,
+      UIComponent  component,
+      FacesBean    bean
+      ) throws IOException
     {
       // Prevent HeaderRenderer from re-rendering event handlers
     }
 
     @Override
-    protected String getMessageType(FacesBean bean)
+    protected String getMessageType(
+      UIComponent component,
+      FacesBean   bean)
     {
       String messageType = null;
 
@@ -376,16 +392,19 @@
     }
 
     @Override
-    protected String getText(RenderingContext arc, FacesBean bean,
-        String messageType)
+    protected String getText(
+      RenderingContext rc,
+      UIComponent      component,
+      FacesBean        bean,
+      String           messageType)
     {
-      String text = MessageBoxRenderer.this.getText(bean);
+      String text = MessageBoxRenderer.this.getText(component, bean);
       if (text != null)
         // Use Text attribute of this component for header text
         return text;
 
       // Otherwise parent will decide text & style based on messageType
-      return super.getText(arc, bean, messageType);
+      return super.getText(rc, component, bean, messageType);
     }
 
     @Override
@@ -409,21 +428,22 @@
 
       return iconName;
     }
-
   }
 
   // Delegate renderer, handles the outer element rendering and
   // provides option to wrap message box using rounded borders etc.
   private class BoxRenderer extends PanelBoxRenderer
   {
-
-    public BoxRenderer(FacesBean.Type type)
+    public BoxRenderer(
+      FacesBean.Type type)
     {
       super(type);
     }
 
     @Override
-    protected boolean shouldRenderId(FacesContext context, UIComponent component)
+    protected boolean shouldRenderId(
+      FacesContext context,
+      UIComponent  component)
     {
       // As panelBox is handling the outer rendering, then it should render
       // the id of the MessageBox component
@@ -431,7 +451,9 @@
     }
 
     @Override
-    protected String getBackground(FacesBean bean)
+    protected String getBackground(
+      UIComponent component,
+      FacesBean   bean)
     {
       // Force use of 'light' style, so we know which style
       // to re-map in _RESOURCE_KEY_MAP
@@ -439,9 +461,11 @@
     }
 
     @Override
-    protected String getInlineStyle(FacesBean bean)
+    protected String getInlineStyle(
+      UIComponent component,
+      FacesBean   bean)
     {
-      String inlineStyle = super.getInlineStyle(bean);
+      String inlineStyle = super.getInlineStyle(component, bean);
 
       boolean inlineValidation =
         RequestContext.ClientValidation.INLINE.equals(
@@ -458,29 +482,38 @@
       // Ensure the MessageBox is hidden for inline mode when there are no messages
       if (inlineStyle != null)
         return inlineStyle + ";display:none;";
-      
+
       return "display:none;";
     }
 
     @Override
-    protected boolean hasChildren(UIComponent component)
+    protected boolean hasChildren(
+      UIComponent component)
     {
       // Required to force panelBox to call render properly
       return true;
     }
 
     @Override
-    protected void renderBody(FacesContext context, RenderingContext arc,
-        UIComponent component, FacesBean bean, Object icon, Object text) throws IOException
+    protected void renderBody(
+      FacesContext     context,
+      RenderingContext rc,
+      UIComponent      component,
+      FacesBean        bean,
+      Object           icon,
+      Object           text
+      ) throws IOException
     {
       // Pass control back to MessageBoxRenderer to continue rendering
       // the content of the message box.
-      MessageBoxRenderer.this._renderContent(context, arc, component, bean);
+      MessageBoxRenderer.this._renderContent(context, rc, component, bean);
     }
   }
 
   @Override
-  protected boolean shouldRenderId(FacesContext context, UIComponent component)
+  protected boolean shouldRenderId(
+    FacesContext context,
+    UIComponent  component)
   {
     // Normally BoxRenderer will output the id for this component, but
     // if we're just outputting an empty element for PPR purposes, then
@@ -488,17 +521,23 @@
     return true;
   }
 
-  protected String getText(FacesBean bean)
+  protected String getText(
+    UIComponent component,
+    FacesBean   bean)
   {
     return (String)this.resolveProperty(bean, _textKey);
   }
 
-  protected String getMessage(FacesBean bean)
+  protected String getMessage(
+    UIComponent component,
+    FacesBean   bean)
   {
     return (String)this.resolveProperty(bean, _messageKey);
   }
 
-  protected boolean isGlobalOnly(FacesBean bean)
+  protected boolean isGlobalOnly(
+    UIComponent component,
+    FacesBean   bean)
   {
     return (Boolean)this.resolveProperty(bean, _globalOnlyKey, true);
   }

Modified: myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MessageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MessageRenderer.java?rev=889345&r1=889344&r2=889345&view=diff
==============================================================================
--- myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MessageRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/MessageRenderer.java Thu Dec 10 17:46:13 2009
@@ -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
@@ -28,14 +28,14 @@
 import org.apache.myfaces.trinidad.bean.FacesBean;
 import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.component.core.output.CoreMessage;
-
 import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidadinternal.util.MessageUtils;
 
+
 /**
  * Renderer for org.apache.myfaces.trinidad.Message, family org.apache.myfaces.trinidad.Message.
- * 
+ *
  */
 public class MessageRenderer extends ValueRenderer
 {
@@ -44,13 +44,15 @@
     this(CoreMessage.TYPE);
   }
 
-  protected MessageRenderer(FacesBean.Type type)
+  protected MessageRenderer(
+    FacesBean.Type type)
   {
     super(type);
   }
 
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
     _forKey         = type.findKey("for");
@@ -63,14 +65,16 @@
   {
     return true;
   }
-  
+
   @Override
-  protected String getInlineStyle(FacesBean bean)
+  protected String getInlineStyle(
+    UIComponent component,
+    FacesBean   bean)
   {
-    String beanInlineStyle = super.getInlineStyle(bean);
+    String beanInlineStyle = super.getInlineStyle(component, bean);
     String inlineStyle = null;
 
-    if (getIndented(bean))
+    if (getIndented(component, bean))
     {
       inlineStyle = (RenderingContext.getCurrentInstance().isRightToLeft()
           ? _sRTL_INDENTED_STYLE
@@ -81,7 +85,7 @@
    if (inlineStyle != null && beanInlineStyle != null)
     {
       StringBuffer buffer = new StringBuffer(inlineStyle.length() +
-                                             beanInlineStyle.length() + 
+                                             beanInlineStyle.length() +
                                              1);
       buffer.append(inlineStyle);
       if (!inlineStyle.endsWith(";"))
@@ -91,21 +95,22 @@
     }
     else if (inlineStyle != null)
       return inlineStyle;
-    else 
+    else
       return beanInlineStyle;
   }
 
   @Override
   protected void encodeAll(
-    FacesContext        context,
-    RenderingContext arc,
-    UIComponent         component,
-    FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
 
-    String message = getMessage(bean);
-    String messageType = getMessageType(bean);
+    String message = getMessage(component, bean);
+    String messageType = getMessageType(component, bean);
 
     String forId = getForId(context, component, bean);
     if ((message == null) || (messageType == null))
@@ -120,33 +125,34 @@
                         facesMessage.getSeverity());
       }
     }
-    
-    UIComponent help = getFacet(component, "help");   
-   
+
+    UIComponent help = getFacet(component, "help");
+
     boolean isError = true;
     if (messageType != null)
       isError = CoreMessage.MESSAGE_TYPE_ERROR.equals(messageType);
-    
+
     boolean hasHelp = (help != null);
     boolean hasMessage = (message != null);
-    
-    RequestContext rc = RequestContext.getCurrentInstance();
-    boolean isInline = (rc.getClientValidation() ==
+
+    RequestContext requestContext = RequestContext.getCurrentInstance();
+    boolean isInline = (requestContext.getClientValidation() ==
                         RequestContext.ClientValidation.INLINE);
-    
+
     // Handle rendering the help text
     if (hasHelp)
     {
       // Write the root level element for the help
       writer.startElement(XhtmlConstants.SPAN_ELEMENT, component);
       if (shouldRenderId(context, component))
-        writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE, 
+        writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE,
             forId + "::help", null);
 
-      renderAllAttributes(context, arc, bean, false);
-      renderStyleAttributes(context, arc, bean, SkinSelectors.INLINE_INFO_TEXT_STYLE_CLASS);
+      renderAllAttributes(context, rc, component, bean, false);
+      renderStyleAttributes(context, rc, component, bean,
+        SkinSelectors.INLINE_INFO_TEXT_STYLE_CLASS);
 
-      encodeChild(context, help); 
+      encodeChild(context, help);
 
       if (hasMessage || isInline)
       {
@@ -162,18 +168,18 @@
 
     // Handle rendering the message text (or the empty placeholder)
     // Skip if there is no message for PDA
-    if (hasMessage || (isInline && !isPDA(arc)))
+    if (hasMessage || (isInline && !isPDA(rc)))
     {
 
       // Write the root level element for the help
       writer.startElement(XhtmlConstants.SPAN_ELEMENT, component);
 
       if (shouldRenderId(context, component) || (isInline && forId != null))
-        writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE, 
+        writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE,
             forId + "::msg", null);
 
-      renderAllAttributes(context, arc, bean, false);
-      renderStyleAttributes(context, arc, bean, isError ? 
+      renderAllAttributes(context, rc, component, bean, false);
+      renderStyleAttributes(context, rc, component, bean, isError ?
           SkinSelectors.INLINE_ERROR_TEXT_STYLE_CLASS :
             SkinSelectors.INLINE_INFO_TEXT_STYLE_CLASS);
 
@@ -182,33 +188,39 @@
         // Output the server-side message
         renderPossiblyFormattedText(context, message);
       }
-//      else 
+//      else
 //      {
 //        // Hide element ready for client-side validation
-//        writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE, 
+//        writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
 //            "display:none;", null);
 //      }
-      
+
       writer.endElement(XhtmlConstants.SPAN_ELEMENT);
-    }    
+    }
 
   }
 
   //
   // NEW HOOKS
-  // 
+  //
 
-  protected boolean getIndented(FacesBean bean)
+  protected boolean getIndented(
+    UIComponent component,
+    FacesBean   bean)
   {
     return false;
   }
 
-  protected String getFor(FacesBean bean)
+  protected String getFor(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_forKey));
   }
 
-  protected String getMessageType(FacesBean bean)
+  protected String getMessageType(
+    UIComponent component,
+    FacesBean   bean)
   {
     // We're used in some composite circumstances where
     // the message type is always derived from the presence
@@ -219,7 +231,9 @@
     return toString(bean.getProperty(_messageTypeKey));
   }
 
-  protected String getMessage(FacesBean bean)
+  protected String getMessage(
+    UIComponent component,
+    FacesBean   bean)
   {
     // Ditto.
     if (_messageKey == null)
@@ -228,13 +242,13 @@
     return toString(bean.getProperty(_messageKey));
   }
 
-  
+
   protected String getForId(
     FacesContext context,
     UIComponent  component,
     FacesBean    bean)
   {
-    String forValue = getFor(bean);
+    String forValue = getFor(component, bean);
     if (forValue == null)
       return null;
 
@@ -247,7 +261,6 @@
   private PropertyKey _messageTypeKey;
   private PropertyKey _messageKey;
 
-
   static private final String _sLTR_INDENTED_STYLE = "margin-left:21px";
   static private final String _sRTL_INDENTED_STYLE = "margin-right:21px";
 }

Modified: myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java?rev=889345&r1=889344&r2=889345&view=diff
==============================================================================
--- myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java Thu Dec 10 17:46:13 2009
@@ -19,6 +19,7 @@
 package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
 import java.io.IOException;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -39,11 +40,11 @@
 import org.apache.myfaces.trinidad.component.UIXNavigationLevel;
 import org.apache.myfaces.trinidad.component.core.nav.CoreNavigationPane;
 import org.apache.myfaces.trinidad.context.Agent;
+import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.render.RenderUtils;
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
-import org.apache.myfaces.trinidad.context.Agent;
-import org.apache.myfaces.trinidad.context.RenderingContext;
+
 
 public class NavigationPaneRenderer extends XhtmlRenderer
 {
@@ -53,7 +54,8 @@
   }
 
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
     _hintKey = type.findKey("hint");
@@ -69,14 +71,15 @@
 
   @Override
   protected void encodeAll(
-    FacesContext        context,
-    RenderingContext    arc,
-    UIComponent         component,
-    FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
     // Since NavigationPane is a naming container, we can be more
     // efficient about skipping its children
-    if (!PartialPageUtils.containsPprTargets(arc,
+    if (!PartialPageUtils.containsPprTargets(rc,
                                              component,
                                              getClientId(context, component)))
     {
@@ -86,8 +89,8 @@
     ResponseWriter writer = context.getResponseWriter();
 
     writer.startElement("div", component);
-    renderAllAttributes(context, arc, bean, false);
-    _renderStyleAttributes(context, arc, bean);
+    renderAllAttributes(context, rc, component, bean, false);
+    _renderStyleAttributes(context, rc, component, bean);
     renderId(context, component);
 
     int renderedItemCount = _getItemCount((UIXHierarchy)component);
@@ -96,7 +99,7 @@
     // no kids, no NavigationLevel -- but you still get the span.
     if (renderedItemCount > 0 || renderedRowCount > 0)
     {
-      renderContent(context, arc,
+      renderContent(context, rc,
                     (UIXHierarchy)component, bean);
     }
 
@@ -107,7 +110,7 @@
    * Gets the stamp to use to render each link
    */
   private UIComponent _getStamp(
-    UIXHierarchy        component
+    UIXHierarchy component
     )
   {
     UIComponent stamp = component.getFacet("nodeStamp");
@@ -116,15 +119,15 @@
 
   @SuppressWarnings("unchecked")
   protected void renderContent(
-    FacesContext        context,
-    RenderingContext arc,
-    UIXHierarchy        component,
-    FacesBean           bean
+    FacesContext     context,
+    RenderingContext rc,
+    UIXHierarchy     component,
+    FacesBean        bean
     ) throws IOException
   {
     NavItemData navItemData = new NavItemData();
     List<UIComponent> nonNavItemList = new ArrayList<UIComponent>();
-    String renderingHint = _getHint(bean);
+    String renderingHint = _getHint(component, bean);
 
     UIComponent nodeStamp = _getStamp(component);
     if (nodeStamp == null)
@@ -204,7 +207,7 @@
     {
       // starting outer markup:
       ResponseWriter rw = context.getResponseWriter();
-      boolean isRtl = arc.getLocaleContext().isRightToLeft();
+      boolean isRtl = rc.getLocaleContext().isRightToLeft();
       boolean isChoiceHint =
         (NavigationPaneRenderer._HINT_CHOICE.equals(renderingHint));
       String choiceSelectId = null;
@@ -213,27 +216,27 @@
         choiceSelectId = getClientId(context, component) + _CHOICE_SELECT_ID_SUFFIX;
         if (isRtl)
         {
-          _renderChoiceButton(context, arc, rw, isRtl, choiceSelectId);
+          _renderChoiceButton(context, rc, rw, isRtl, choiceSelectId);
         }
         else
         {
-          _renderChoiceLabel(context, arc, rw, isRtl, bean);
+          _renderChoiceLabel(context, rc, rw, isRtl, component, bean);
         }
 
         rw.startElement("select", null);
         rw.writeAttribute("id", choiceSelectId, null);
-           
+
         // For Non-JavaScript browsers, render the name attribute thus it would
         // enable the browsers to include the name and value of this element
         // in its payLoad.
 
-        if ( !supportsScripting(arc) )
+        if ( !supportsScripting(rc) )
         {
           rw.writeAttribute("name", choiceSelectId, null);
         }
-        renderStyleClass(context, arc,
+        renderStyleClass(context, rc,
           SkinSelectors.AF_NAVIGATION_LEVEL_CHOICE_OPTIONS_STYLE_CLASS);
-        if (getDisabled(bean))
+        if (getDisabled(component, bean))
           rw.writeAttribute("disabled", Boolean.TRUE, null);
       }
 
@@ -259,14 +262,14 @@
           Integer rowIndex = (Integer) currentItemData.get("rowIndex");
           if (rowIndex != null)
             component.setRowIndex(rowIndex.intValue());
-          _renderNavigationItem(context, arc, rw, currentItemData,
+          _renderNavigationItem(context, rc, rw, currentItemData,
               renderingHint, isRtl);
           previousActive =
               getBooleanFromProperty(currentItemData.get("isActive"));
         }
         else
         {
-          renderNonCommandChild(i, context, arc,iter.next(), (i == lastRowIndex), renderingHint);
+          renderNonCommandChild(i, context, rc,iter.next(), (i == lastRowIndex), renderingHint);
         }
       }
       component.setRowKey(oldPath);
@@ -277,16 +280,17 @@
         rw.endElement("select");
         if (isRtl)
         {
-          _renderChoiceLabel(context, arc, rw, isRtl, bean);
+          _renderChoiceLabel(context, rc, rw, isRtl, component, bean);
         }
         {
-          _renderChoiceButton(context, arc, rw, isRtl, choiceSelectId);
+          _renderChoiceButton(context, rc, rw, isRtl, choiceSelectId);
         }
       }
     }
   }
 
-  protected boolean hasChildren(UIComponent component)
+  protected boolean hasChildren(
+    UIComponent component)
   {
     int childCount = component.getChildCount();
     return childCount > 0;
@@ -297,34 +301,38 @@
    * styleClass
    */
   private void _renderStyleAttributes(
-    FacesContext        context,
-    RenderingContext arc,
-    FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
-    String renderingHint = _getHint(bean);
-    
-    // Since navigation items are rendered vertically for narrow-screen PDAs, 
-    // Tab style class, which sets the navigationPane's height, is no longer 
+    String renderingHint = _getHint(component, bean);
+
+    // Since navigation items are rendered vertically for narrow-screen PDAs,
+    // Tab style class, which sets the navigationPane's height, is no longer
     // applicable for narrow-screen PDAs
-    if (!supportsNarrowScreen(arc) && 
+    if (!supportsNarrowScreen(rc) &&
                 NavigationPaneRenderer._HINT_TABS.equals(renderingHint))
-    { 
-      renderStyleAttributes(context, arc, bean,
+    {
+      renderStyleAttributes(context, rc, component, bean,
                             SkinSelectors.AF_NAVIGATION_LEVEL_TABS_STYLE_CLASS);
     }
     else if (NavigationPaneRenderer._HINT_BAR.equals(renderingHint))
     {
-      renderStyleAttributes(context, arc, bean,
+      renderStyleAttributes(context, rc, component, bean,
                             SkinSelectors.AF_NAVIGATION_LEVEL_BAR_STYLE_CLASS);
     }
     else
     {
-      renderStyleAttributes(context, arc, bean,
+      renderStyleAttributes(context, rc, component, bean,
                             SkinSelectors.AF_NAVIGATION_LEVEL_STYLE_CLASS);
     }
   }
 
-  private String _getHint(FacesBean bean)
+  private String _getHint(
+    UIComponent component,
+    FacesBean   bean)
   {
     String renderingHint = toString(bean.getProperty(_hintKey));
 
@@ -336,12 +344,16 @@
     return renderingHint;
   }
 
-  protected String getTitle(FacesBean bean)
+  protected String getTitle(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_titleKey));
   }
 
-  protected boolean getDisabled(FacesBean bean)
+  protected boolean getDisabled(
+    UIComponent component,
+    FacesBean   bean)
   {
     Object o = bean.getProperty(_disabledKey);
     if (o == null)
@@ -386,8 +398,8 @@
 
   private void _collectNavItemData(
     NavItemData navItemData,
-    UIXCommand commandChild,
-    int        rowIndex,
+    UIXCommand  commandChild,
+    int         rowIndex,
     UIXHierarchy component)
   {
     int itemDataIndex = navItemData.getItemCount();
@@ -440,7 +452,8 @@
     navItemData.addItemData(itemDataMap);
   }
 
-  protected boolean getBooleanFromProperty(Object value)
+  protected boolean getBooleanFromProperty(
+    Object value)
   {
     if (value == null)
     {
@@ -453,7 +466,7 @@
 
   private Object _getCommandChildProperty(
     UIXCommand commandChild,
-    String propertyName)
+    String     propertyName)
   {
     FacesBean childFacesBean = commandChild.getFacesBean();
     FacesBean.Type type = childFacesBean.getType();
@@ -473,40 +486,40 @@
   }
 
   private void _renderNavigationItem(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
+    FacesContext        context,
+    RenderingContext    rc,
+    ResponseWriter      rw,
     Map<String, Object> itemData,
-    String renderingHint,
-    boolean isRtl
+    String              renderingHint,
+    boolean             isRtl
     ) throws IOException
   {
     if (_HINT_BAR.equals(renderingHint))
     {
-      renderNonOverlappingItem(context, arc, rw, itemData, isRtl, true, false);
+      renderNonOverlappingItem(context, rc, rw, itemData, isRtl, true, false);
     }
     else if (_HINT_BUTTONS.equals(renderingHint))
     {
-      renderNonOverlappingItem(context, arc, rw, itemData, isRtl, false, false);
+      renderNonOverlappingItem(context, rc, rw, itemData, isRtl, false, false);
     }
     else if (_HINT_CHOICE.equals(renderingHint))
     {
-      _renderChoiceItem(context, arc, rw, itemData);
+      _renderChoiceItem(context, rc, rw, itemData);
     }
     else if (_HINT_LIST.equals(renderingHint))
     {
-      renderNonOverlappingItem(context, arc, rw, itemData, isRtl, false, true);
+      renderNonOverlappingItem(context, rc, rw, itemData, isRtl, false, true);
     }
     else // _HINT_TABS
     {
-      renderTabItem(context, arc, rw, itemData, isRtl);
+      renderTabItem(context, rc, rw, itemData, isRtl);
     }
   }
 
   protected void writeInlineStyles(
     ResponseWriter rw,
-    Object userInlineStyle,
-    String appendedInlineStyle
+    Object         userInlineStyle,
+    String         appendedInlineStyle
     ) throws IOException
   {
     if (userInlineStyle == null)
@@ -537,12 +550,12 @@
   }
 
   private void _writeInlineTbodyStyles(
-    RenderingContext arc,
-    ResponseWriter rw
+    RenderingContext rc,
+    ResponseWriter   rw
     ) throws IOException
   {
     // IE and Firefox require the TABLE to be "inline".
-    if (arc.getAgent().getAgentName() == Agent.AGENT_GECKO)
+    if (rc.getAgent().getAgentName() == Agent.AGENT_GECKO)
     {
       // Firefox 1.5 also requires the TBODY to be "inline":
       rw.writeAttribute("style", "display: inline;", null);
@@ -550,32 +563,32 @@
   }
 
   protected void appendIconAndText(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
-    String iconUri,
+    FacesContext        context,
+    RenderingContext    rc,
+    ResponseWriter      rw,
+    String              iconUri,
     Map<String, Object> itemData,
-    boolean isDisabled,
-    boolean isRtl
+    boolean             isDisabled,
+    boolean             isRtl
     ) throws IOException
   {
     if ( (iconUri != null) && !isRtl )
     {
-      _appendIcon(context, rw, iconUri, isRtl, arc);
+      _appendIcon(context, rw, iconUri, isRtl, rc);
     }
-     _writeItemLink(context, arc, rw, itemData, isDisabled);
+     _writeItemLink(context, rc, rw, itemData, isDisabled);
     if ( (iconUri != null) && isRtl )
     {
-      _appendIcon(context, rw, iconUri, isRtl, arc);
+      _appendIcon(context, rw, iconUri, isRtl, rc);
     }
   }
 
   private void _appendIcon(
-    FacesContext context,
-    ResponseWriter rw,
-    String iconUri,
-    boolean isRtl,
-    RenderingContext arc
+    FacesContext     context,
+    ResponseWriter   rw,
+    String           iconUri,
+    boolean          isRtl,
+    RenderingContext rc
     ) throws IOException
   {
     String styleAppender = "";
@@ -583,7 +596,7 @@
     rw.writeAttribute("border", "0", null);
     rw.writeAttribute("align", "absmiddle", null);
 
-    if (isPDA(arc))
+    if (isPDA(rc))
     {
       if (isRtl)
       {
@@ -616,7 +629,8 @@
   @SuppressWarnings("unchecked")
   private void _renderCommandChildren(
     FacesContext context,
-    UIXCommand uiComp) throws IOException
+    UIXCommand   uiComp
+    ) throws IOException
   {
     for(UIComponent child : (List<UIComponent>)uiComp.getChildren())
     {
@@ -625,8 +639,9 @@
   }
 
   private void _renderText(
-    ResponseWriter rw,
-    Map<String, Object> itemData) throws IOException
+    ResponseWriter      rw,
+    Map<String, Object> itemData
+    ) throws IOException
   {
     String text = toString(itemData.get("text"));
     if(text != null)
@@ -636,11 +651,11 @@
   }
 
   private void _writeItemLink(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
+    FacesContext        context,
+    RenderingContext    rc,
+    ResponseWriter      rw,
     Map<String, Object> itemData,
-    boolean isDisabled
+    boolean             isDisabled
     ) throws IOException
   {
 
@@ -661,63 +676,63 @@
       partialSubmit = getBooleanFromProperty(itemData.get("partialSubmit"));
       if (partialSubmit)
       {
-        AutoSubmitUtils.writeDependencies(context, arc);
+        AutoSubmitUtils.writeDependencies(context, rc);
       }
       String clientId = commandChild.getClientId(context);
       // Make sure we don't have anything to save
-      assert(arc.getCurrentClientId() == null);
-      arc.setCurrentClientId(clientId);
+      assert(rc.getCurrentClientId() == null);
+      rc.setCurrentClientId(clientId);
 
       // Find the params up front, and save them off -
       // getOnClick() doesn't have access to the UIComponent
       String extraParams = AutoSubmitUtils.getParameters(commandChild);
-      arc.getProperties().put(_EXTRA_SUBMIT_PARAMS_KEY, extraParams);
+      rc.getProperties().put(_EXTRA_SUBMIT_PARAMS_KEY, extraParams);
     }
 
     boolean isActive = getBooleanFromProperty(itemData.get("isActive"));
-    boolean isDesktop = (arc.getAgent().getType().equals(Agent.TYPE_DESKTOP));
-    
-    boolean nonJavaScriptSubmit = (!supportsScripting(arc))
-                                             && (destination == null);    
-    
+    boolean isDesktop = (rc.getAgent().getType().equals(Agent.TYPE_DESKTOP));
+
+    boolean nonJavaScriptSubmit = (!supportsScripting(rc))
+                                             && (destination == null);
+
     // For non-javascript browsers, we need to render a submit element
     // instead of an anchor tag if the anchor tag doesn't have a destination
-    
+
     if (nonJavaScriptSubmit)
     {
-    
+
       rw.startElement("input", commandChild);
-    
+
       rw.writeAttribute("type", "submit", null);
       rw.writeAttribute("value", toString(itemData.get("text")), "text");
-    
+
       String clientId = getClientId(context, commandChild);
       rw.writeAttribute("id", clientId, "id");
-      
-      
-      
-      // For Non-JavaScript browsers, encode the name attribute with the 
-      // parameter name and value thus it would enable the browsers to 
+
+
+
+      // For Non-JavaScript browsers, encode the name attribute with the
+      // parameter name and value thus it would enable the browsers to
       // include the name of this element in its payLoad if it submits the
       // page.
-       
+
       rw.writeAttribute("name", XhtmlUtils.getEncodedParameter
                                   (XhtmlConstants.SOURCE_PARAM)
                                    + clientId, null);
-      renderStyleClass(context, arc, 
+      renderStyleClass(context, rc,
                   SkinSelectors.AF_COMMAND_BUTTON_STYLE_CLASS);
-      String linkConverter = 
+      String linkConverter =
              "border:none;background:inherit;text-decoration:underline;";
-    
+
       // Few mobile browsers couldn't apply css property for active elements
       // so making it inline
       if (isActive && !isDesktop)
       {
         linkConverter = linkConverter + "font-weight: bold;";
       }
-    
+
       writeInlineStyles(rw, null,linkConverter);
-    
+
     }
     else
     {
@@ -740,7 +755,7 @@
         renderEncodedActionURI(context, "href", destination);
         String targetFrame = toString(itemData.get("targetFrame"));
         if ( (targetFrame != null) && !Boolean.FALSE.equals(
-          arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_TARGET)) )
+          rc.getAgent().getCapabilities().get(TrinidadAgent.CAP_TARGET)) )
         {
           rw.writeAttribute("target", targetFrame, null);
         }
@@ -751,10 +766,10 @@
       // Cannot use super.renderEventHandlers(context, bean); because the wrong
       // property keys would be in use so must do it this way:
       // Also render the events only if the browser supports JavaScript
-      if (supportsScripting(arc))
+      if (supportsScripting(rc))
       {
         _writeOnclickProperty(
-          arc,
+          rc,
           rw,
           commandChild,
           (destination == null),
@@ -771,18 +786,18 @@
         _writeCommandChildProperty(rw, commandChild, "onmouseup");
       }
     }
-    
+
     String accessKey = toString(itemData.get("accessKey"));
     if ( !isDisabled && (accessKey != null) )
     {
       rw.writeAttribute("accessKey", accessKey, null);
     }
-    
-    // In the case of HTML basic browsers, we render an input element. Hence, 
+
+    // In the case of HTML basic browsers, we render an input element. Hence,
     // we cannot render any children, so skip calling _renderCommandChildren
     if (nonJavaScriptSubmit)
-    { 
-      rw.endElement("input"); 
+    {
+      rw.endElement("input");
     }
     else
     {
@@ -790,18 +805,18 @@
       _renderCommandChildren(context, commandChild);
       rw.endElement("a"); // linkElement
     }
-    
+
     if (destination == null)
     {
-      arc.setCurrentClientId(null);
-      arc.getProperties().remove(_EXTRA_SUBMIT_PARAMS_KEY);
+      rc.setCurrentClientId(null);
+      rc.getProperties().remove(_EXTRA_SUBMIT_PARAMS_KEY);
     }
   }
 
   private void _writeCommandChildProperty(
     ResponseWriter rw,
-    UIXCommand commandChild,
-    String propertyName
+    UIXCommand     commandChild,
+    String         propertyName
     ) throws IOException
   {
     rw.writeAttribute(
@@ -811,18 +826,18 @@
   }
 
   private void _writeOnclickProperty(
-    RenderingContext arc,
-    ResponseWriter rw,
-    UIXCommand commandChild,
-    boolean actionSpecialCase,
-    boolean immediate,
-    boolean partialSubmit
+    RenderingContext rc,
+    ResponseWriter   rw,
+    UIXCommand       commandChild,
+    boolean          actionSpecialCase,
+    boolean          immediate,
+    boolean          partialSubmit
     ) throws IOException
   {
     if (actionSpecialCase)
     {
       String onclick = (String)_getCommandChildProperty(commandChild, "onclick");
-      String script = _getAutoSubmitScript(arc, immediate, partialSubmit);
+      String script = _getAutoSubmitScript(rc, immediate, partialSubmit);
       rw.writeAttribute(
         "onclick", XhtmlUtils.getChainedJS(onclick, script, true), "onclick");
     }
@@ -833,21 +848,21 @@
   }
 
   private String _getAutoSubmitScript(
-    RenderingContext arc,
-    boolean immediate,
-    boolean partialSubmit
+    RenderingContext rc,
+    boolean          immediate,
+    boolean          partialSubmit
     )
   {
-    String id = arc.getCurrentClientId();
+    String id = rc.getCurrentClientId();
 
     String extraParams = (String)
-      arc.getProperties().get(_EXTRA_SUBMIT_PARAMS_KEY);
+      rc.getProperties().get(_EXTRA_SUBMIT_PARAMS_KEY);
 
     String script;
     if (partialSubmit)
     {
       script = AutoSubmitUtils.getSubmitScript(
-        arc, id, immediate, false,
+        rc, id, immediate, false,
         null/* no event*/,
         extraParams,
         false);
@@ -855,7 +870,7 @@
     else
     {
       script = AutoSubmitUtils.getFullPageSubmitScript(
-        arc, id, immediate,
+        rc, id, immediate,
         null/*no event*/,
         extraParams,
         false/* return false*/);
@@ -864,25 +879,25 @@
   }
 
   protected void renderNonOverlappingItem(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
+    FacesContext        context,
+    RenderingContext    rc,
+    ResponseWriter      rw,
     Map<String, Object> itemData,
-    boolean isRtl,
-    boolean isBar,
-    boolean isList
+    boolean             isRtl,
+    boolean             isBar,
+    boolean             isList
     ) throws IOException
   {
     rw.startElement("table", null);
-    OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+    OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
     String appendedStyle = null;
     if (!isList)
     {
       appendedStyle = "display: inline;"; // style to make the table inline
-      
-      // In Safari and webkit browsers display:inline doesn't work as expected, and 
+
+      // In Safari and webkit browsers display:inline doesn't work as expected, and
       // display:inline-block need to be used to make the table inline.
-      if (arc.getAgent().getAgentName() == Agent.AGENT_WEBKIT)
+      if (rc.getAgent().getAgentName() == Agent.AGENT_WEBKIT)
       {
         appendedStyle = "display: inline-block;";
       }
@@ -979,11 +994,11 @@
         }
       }
     }
-    renderStyleClass(context, arc, itemStyleClass.toString());
+    renderStyleClass(context, rc, itemStyleClass.toString());
     rw.startElement("tbody", null);
     if (!isList)
     {
-      _writeInlineTbodyStyles(arc, rw);
+      _writeInlineTbodyStyles(rc, rw);
     }
     rw.startElement("tr", null);
 
@@ -992,7 +1007,7 @@
       rw.startElement("td", null); // bulletCell
       renderStyleClass(
         context,
-        arc,
+        rc,
         SkinSelectors.AF_NAVIGATION_LEVEL_LIST_BULLET_STYLE_CLASS);
       rw.startElement("div", null); // bulletContent
       rw.write(" ");
@@ -1004,22 +1019,22 @@
     rw.startElement("div", null); // centerContent
     if (isList)
     {
-      renderStyleClass(context, arc,
+      renderStyleClass(context, rc,
         SkinSelectors.AF_NAVIGATION_LEVEL_LIST_CONTENT_STYLE_CLASS);
     }
     else if (isBar)
     {
-      renderStyleClass(context, arc,
+      renderStyleClass(context, rc,
         SkinSelectors.AF_NAVIGATION_LEVEL_BAR_CONTENT_STYLE_CLASS);
     }
     else
     {
-      renderStyleClass(context, arc,
+      renderStyleClass(context, rc,
         SkinSelectors.AF_NAVIGATION_LEVEL_BUTTONS_CONTENT_STYLE_CLASS);
     }
     appendIconAndText(
       context,
-      arc,
+      rc,
       rw,
       toString(itemData.get("icon")),
       itemData,
@@ -1034,12 +1049,12 @@
       rw.startElement("div", null); // rightContent
       if (isBar)
       {
-        renderStyleClass(context, arc,
+        renderStyleClass(context, rc,
           SkinSelectors.AF_NAVIGATION_LEVEL_BAR_SEPARATOR_STYLE_CLASS);
       }
       else
       {
-        renderStyleClass(context, arc,
+        renderStyleClass(context, rc,
           SkinSelectors.AF_NAVIGATION_LEVEL_BUTTONS_SEPARATOR_STYLE_CLASS);
       }
       rw.write("|");
@@ -1057,35 +1072,36 @@
    * This is used only for hint="bar" and hint="buttons"
    * @param index
    * @param context
-   * @param arc
+   * @param rc
    * @param child
    * @param isLastItem
    * @param hint
    * @throws IOException
    */
   protected void renderNonCommandChild(
-    int index,
-    FacesContext context,
-    RenderingContext arc,
-    UIComponent child,
-    boolean isLastItem,
-    String hint) throws IOException
+    int              index,
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      child,
+    boolean          isLastItem,
+    String           hint
+    ) throws IOException
   {
     ResponseWriter rw = context.getResponseWriter();
     rw.startElement("table", null);
-    OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+    OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
     String appendedStyle = null;
-    appendedStyle = "display: inline;"; // style to make the table inline    
-      
-    // In Safari and webkit browsers display:inline doesn't work as expected, and 
+    appendedStyle = "display: inline;"; // style to make the table inline
+
+    // In Safari and webkit browsers display:inline doesn't work as expected, and
     // display:inline-block need to be used to make the table inline.
-    if (arc.getAgent().getAgentName() == Agent.AGENT_WEBKIT)
+    if (rc.getAgent().getAgentName() == Agent.AGENT_WEBKIT)
     {
       appendedStyle = "display: inline-block;";
     }
     writeInlineStyles(rw, null, appendedStyle);
     rw.startElement("tbody", null);
-    _writeInlineTbodyStyles(arc, rw);
+    _writeInlineTbodyStyles(rc, rw);
     rw.startElement("tr", null);
     rw.startElement("td", null);
     rw.startElement("div", null);
@@ -1098,12 +1114,12 @@
       rw.startElement("div", null); // rightContent
       if (hint == _HINT_BAR)
       {
-        renderStyleClass(context, arc,
+        renderStyleClass(context, rc,
           SkinSelectors.AF_NAVIGATION_LEVEL_BAR_SEPARATOR_STYLE_CLASS);
       }
       else
       {
-        renderStyleClass(context, arc,
+        renderStyleClass(context, rc,
           SkinSelectors.AF_NAVIGATION_LEVEL_BUTTONS_SEPARATOR_STYLE_CLASS);
       }
 
@@ -1117,9 +1133,9 @@
   }
 
   private void _renderChoiceItem(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
+    FacesContext        context,
+    RenderingContext    rc,
+    ResponseWriter      rw,
     Map<String, Object> itemData
     ) throws IOException
   {
@@ -1128,7 +1144,7 @@
     // If the agent, doesn't support disabled options, don't render anything
     // for such options
     if ( !isDisabled ||
-         Boolean.TRUE.equals(arc.getAgent().getCapabilities().get(
+         Boolean.TRUE.equals(rc.getAgent().getCapabilities().get(
                 TrinidadAgent.CAP_SUPPORTS_DISABLED_OPTIONS)))
     {
       boolean isActive = getBooleanFromProperty(itemData.get("isActive"));
@@ -1136,16 +1152,16 @@
       String destination = null;
       boolean partialSubmit = false;
       if (!isDisabled)
-      {  
+      {
          // Write the script to evaluate once the item is selected
          commandChild = (UIXCommand)itemData.get("component");
          destination = toString(itemData.get("destination"));
          if (destination == null)
-         { 
+         {
            partialSubmit = getBooleanFromProperty(itemData.get("partialSubmit"));
            if (partialSubmit)
            {
-             AutoSubmitUtils.writeDependencies(context, arc);
+             AutoSubmitUtils.writeDependencies(context, rc);
            }
          }
       }
@@ -1165,27 +1181,27 @@
           immediate = getBooleanFromProperty(itemData.get("immediate"));
           String clientId = commandChild.getClientId(context);
           // Make sure we don't have anything to save
-          assert(arc.getCurrentClientId() == null);
-          arc.setCurrentClientId(clientId);
+          assert(rc.getCurrentClientId() == null);
+          rc.setCurrentClientId(clientId);
 
           // Find the params up front, and save them off -
           // getOnClick() doesn't have access to the UIComponent
           String extraParams = AutoSubmitUtils.getParameters(commandChild);
-          arc.getProperties().put(_EXTRA_SUBMIT_PARAMS_KEY, extraParams);
+          rc.getProperties().put(_EXTRA_SUBMIT_PARAMS_KEY, extraParams);
         }
         _renderCommandChildId(context, commandChild);
         String selectionScript;
-        
-        // For Non-javaScript browsers, set the value attribute to the id of 
+
+        // For Non-javaScript browsers, set the value attribute to the id of
         // the element instead of a javascript code
-         
-        if (!supportsScripting(arc))
+
+        if (!supportsScripting(rc))
         {
-          selectionScript = arc.getCurrentClientId();
+          selectionScript = rc.getCurrentClientId();
         }
         else if (destination == null)
         {
-          selectionScript = _getAutoSubmitScript(arc, immediate, partialSubmit);
+          selectionScript = _getAutoSubmitScript(rc, immediate, partialSubmit);
 
           // Trim off the "return false;" because we will be performing an
           // "eval" on the script and a "return" will yield a runtime error:
@@ -1199,7 +1215,7 @@
           String targetFrame = toString(itemData.get("targetFrame"));
           StringBuilder sb = new StringBuilder();
           if ( (targetFrame != null) && !Boolean.FALSE.equals(
-            arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_TARGET)) )
+            rc.getAgent().getCapabilities().get(TrinidadAgent.CAP_TARGET)) )
           {
             sb.append("window.open('");
             sb.append(encodedDestination);
@@ -1219,8 +1235,8 @@
 
         if (destination == null)
         {
-          arc.setCurrentClientId(null);
-          arc.getProperties().remove(_EXTRA_SUBMIT_PARAMS_KEY);
+          rc.setCurrentClientId(null);
+          rc.getProperties().remove(_EXTRA_SUBMIT_PARAMS_KEY);
         }
       }
 
@@ -1230,17 +1246,18 @@
   }
 
   private void _renderChoiceLabel(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
-    boolean isRtl,
-    FacesBean bean
+    FacesContext     context,
+    RenderingContext rc,
+    ResponseWriter   rw,
+    boolean          isRtl,
+    UIComponent      component,
+    FacesBean        bean
     ) throws IOException
   {
-    String chooseText = getTitle(bean);
+    String chooseText = getTitle(component, bean);
     if ( (chooseText == null) || (chooseText.length() == 0) )
     {
-      chooseText = getShortDesc(bean);
+      chooseText = getShortDesc(component, bean);
     }
 
     if ( (chooseText != null) && (chooseText.length() != 0) )
@@ -1250,7 +1267,7 @@
         _renderSpace(rw);
       }
       rw.startElement("span", null);
-      renderStyleClass(context, arc,
+      renderStyleClass(context, rc,
         SkinSelectors.AF_NAVIGATION_LEVEL_CHOICE_LABEL_STYLE_CLASS);
       rw.write(chooseText);
       rw.endElement("span");
@@ -1262,11 +1279,11 @@
   }
 
   private void _renderChoiceButton(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
-    boolean isRtl,
-    String choiceSelectId
+    FacesContext     context,
+    RenderingContext rc,
+    ResponseWriter   rw,
+    boolean          isRtl,
+    String           choiceSelectId
     ) throws IOException
   {
     if (!isRtl)
@@ -1275,32 +1292,32 @@
     }
     //The button html element is not supported on all browsers;  use "input"
     //if it is not
-    boolean useButtonTag = supportsAdvancedForms(arc);
+    boolean useButtonTag = supportsAdvancedForms(rc);
     String element = useButtonTag ? "button" : "input";
 
     rw.startElement(element, null);
-    renderStyleClass(context, arc,
+    renderStyleClass(context, rc,
       SkinSelectors.AF_NAVIGATION_LEVEL_CHOICE_BUTTON_STYLE_CLASS);
-    String goText = arc.getSkin().getTranslatedString(
-      arc.getLocaleContext(),
+    String goText = rc.getSkin().getTranslatedString(
+      rc.getLocaleContext(),
       _GO_BUTTON_LABEL_KEY);
 
     rw.writeAttribute("type", useButtonTag ? "button"  : "submit", null);
-    
-    // For Non-JavaScript browsers, encode the name attribute with the 
-    // parameter name and value thus it would enable the browsers to 
+
+    // For Non-JavaScript browsers, encode the name attribute with the
+    // parameter name and value thus it would enable the browsers to
     // include the name of this element in its payLoad if it submits
     // the page.
-    
-    if (!supportsScripting(arc) )
+
+    if (!supportsScripting(rc) )
     {
-    
+
       String nameAttri = XhtmlUtils.getEncodedParameter
                                      (XhtmlConstants.MULTIPLE_VALUE_PARAM)
                                      + choiceSelectId;
-    
+
       rw.writeAttribute("name", nameAttri, null);
-    
+
     }
     else
     {
@@ -1341,21 +1358,21 @@
   }
 
   protected void renderTabItem(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
+    FacesContext        context,
+    RenderingContext    rc,
+    ResponseWriter      rw,
     Map<String, Object> itemData,
-    boolean isRtl
+    boolean             isRtl
     ) throws IOException
   {
     rw.startElement("table", null);
-    OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
-    
-    String appendedStyle = "display: inline;";    
-      
-    // In Safari and webkit browsers display:inline doesn't work as expected, and 
+    OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
+
+    String appendedStyle = "display: inline;";
+
+    // In Safari and webkit browsers display:inline doesn't work as expected, and
     // display:inline-block need to be used to make the table inline.
-    if (arc.getAgent().getAgentName() == Agent.AGENT_WEBKIT)
+    if (rc.getAgent().getAgentName() == Agent.AGENT_WEBKIT)
     {
       appendedStyle = "display: inline-block;";
     }
@@ -1393,9 +1410,9 @@
       sectionStyleClass1 =
         SkinSelectors.AF_NAVIGATION_LEVEL_TABS_INACTIVE_STYLE_CLASS;
     }
-    renderStyleClass(context, arc, itemStyleClass.toString());
+    renderStyleClass(context, rc, itemStyleClass.toString());
     rw.startElement("tbody", null);
-    _writeInlineTbodyStyles(arc, rw);
+    _writeInlineTbodyStyles(rc, rw);
     rw.startElement("tr", null);
 
     boolean isFirst = getBooleanFromProperty(itemData.get("isFirst"));
@@ -1409,7 +1426,7 @@
       rw.startElement("td", null);
       _renderTabSection(
         context,
-        arc,
+        rc,
         rw,
         sectionStyleClass1,
         sectionStyleClass2,
@@ -1427,7 +1444,7 @@
       rw.startElement("td", null);
       _renderTabSection(
         context,
-        arc,
+        rc,
         rw,
         sectionStyleClass1,
         sectionStyleClass2,
@@ -1445,7 +1462,7 @@
       rw.startElement("td", null);
       _renderTabSection(
         context,
-        arc,
+        rc,
         rw,
         sectionStyleClass1,
         sectionStyleClass2,
@@ -1463,7 +1480,7 @@
       rw.startElement("td", null);
       _renderTabSection(
         context,
-        arc,
+        rc,
         rw,
         sectionStyleClass1,
         sectionStyleClass2,
@@ -1480,7 +1497,7 @@
     rw.startElement("td", null);
     _renderTabSection(
       context,
-      arc,
+      rc,
       rw,
       sectionStyleClass1,
       sectionStyleClass2,
@@ -1498,7 +1515,7 @@
       rw.startElement("td", null);
       _renderTabSection(
         context,
-        arc,
+        rc,
         rw,
         sectionStyleClass1,
         sectionStyleClass2,
@@ -1516,7 +1533,7 @@
       rw.startElement("td", null);
       _renderTabSection(
         context,
-        arc,
+        rc,
         rw,
         sectionStyleClass1,
         sectionStyleClass2,
@@ -1535,39 +1552,39 @@
   }
 
   private void _renderTabSection(
-    FacesContext context,
-    RenderingContext arc,
-    ResponseWriter rw,
-    String sectionStyleClass1,
-    String sectionStyleClass2,
-    String topStyleClass,
-    String bottomStyleClass,
-    String bottomContentStyleClass,
+    FacesContext        context,
+    RenderingContext    rc,
+    ResponseWriter      rw,
+    String              sectionStyleClass1,
+    String              sectionStyleClass2,
+    String              topStyleClass,
+    String              bottomStyleClass,
+    String              bottomContentStyleClass,
     Map<String, Object> itemData,
-    boolean isDisabled,
-    boolean isRtl
+    boolean             isDisabled,
+    boolean             isRtl
     ) throws IOException
   {
     rw.startElement("table", null);
-    OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+    OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
     if (sectionStyleClass2 == null)
     {
-      renderStyleClass(context, arc, sectionStyleClass1);
+      renderStyleClass(context, rc, sectionStyleClass1);
     }
     else
     {
       String[] sectionStyleClasses = { sectionStyleClass1, sectionStyleClass2 };
-      renderStyleClasses(context, arc, sectionStyleClasses);
+      renderStyleClasses(context, rc, sectionStyleClasses);
     }
     rw.startElement("tbody", null);
     rw.startElement("tr", null);
     rw.startElement("td", null);
-    renderStyleClass(context, arc, topStyleClass);
+    renderStyleClass(context, rc, topStyleClass);
     if (itemData != null)
     {
       appendIconAndText(
         context,
-        arc,
+        rc,
         rw,
         toString(itemData.get("icon")),
         itemData,
@@ -1578,11 +1595,11 @@
     rw.endElement("tr");
     rw.startElement("tr", null);
     rw.startElement("td", null);
-    renderStyleClass(context, arc, bottomStyleClass);
+    renderStyleClass(context, rc, bottomStyleClass);
     if (bottomContentStyleClass != null)
     {
       rw.startElement("div", null);
-      renderStyleClass(context, arc, bottomContentStyleClass);
+      renderStyleClass(context, rc, bottomContentStyleClass);
       rw.endElement("div");
     }
     rw.endElement("td");
@@ -1635,7 +1652,8 @@
   /**
    * Check if a component is on a focus path
    */
-  private static boolean _isOnFocusPath(UIXHierarchy component)
+  private static boolean _isOnFocusPath(
+    UIXHierarchy component)
   {
     boolean isOnFocusPath = false;
     Object focusKey = component.getFocusRowKey();

Modified: myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputDocumentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputDocumentRenderer.java?rev=889345&r1=889344&r2=889345&view=diff
==============================================================================
--- myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputDocumentRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputDocumentRenderer.java Thu Dec 10 17:46:13 2009
@@ -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
@@ -29,6 +29,7 @@
 import org.apache.myfaces.trinidad.component.core.output.CoreOutputDocument;
 import org.apache.myfaces.trinidad.context.RenderingContext;
 
+
 /**
  */
 public class OutputDocumentRenderer extends ValueRenderer
@@ -43,16 +44,17 @@
    */
   @Override
   protected void encodeBegin(
-      FacesContext context,
-      RenderingContext arc,
-      UIComponent comp,
-      FacesBean bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      comp,
+    FacesBean        bean
+    ) throws IOException
   {
     ResponseWriter rw = context.getResponseWriter();
     rw.startElement(_ROOT_ELEMENT, comp);
 
     renderId(context, comp);
-    renderAllAttributes(context, arc, bean);
+    renderAllAttributes(context, rc, comp, bean);
   }
 
   /**
@@ -60,26 +62,27 @@
    */
   @Override
   public void encodeEnd(
-      FacesContext context,
-      RenderingContext arc,
-      UIComponent comp,
-      FacesBean bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      comp,
+    FacesBean        bean
+    ) throws IOException
   {
     ResponseWriter rw = context.getResponseWriter();
     String value = getConvertedString(context, comp, bean);
-    
-    _renderTitle(context, arc, comp, bean);
+
+    _renderTitle(context, rc, comp, bean);
 
     boolean firstParagraphRendered = false;
-    
+
     UIComponent separator = getFacet(comp, CoreOutputDocument.SEPARATOR_FACET);
-    // Cache the separator existence in a variable in order to 
+    // Cache the separator existence in a variable in order to
     // evaluate a potential rendered EL only once.
     boolean hasSeparator = separator != null;
-    
+
     int length = value.length();
     StringBuilder builder = new StringBuilder(length);
-    
+
     for (int i = 0; i < length; i++)
     {
       char character = value.charAt(i);
@@ -97,22 +100,22 @@
       {
         if (builder.length() == 0)
         {
-          // The first character that is not a line break found 
+          // The first character that is not a line break found
           // for the current paragraph, so start a new one
           if (firstParagraphRendered && hasSeparator)
           {
-            // If a separator was specified and the paragraph being rendered 
+            // If a separator was specified and the paragraph being rendered
             // is not the first, render the separator
-            _renderSeparator(context, arc, separator, bean);
+            _renderSeparator(context, rc, separator, bean);
           }
 
-          _renderParagraphStart(context, arc);
+          _renderParagraphStart(context, rc);
         }
 
         builder.append(character);
       }
     }
-    
+
     // There's more characters to print
     if(builder.length() > 0)
     {
@@ -126,7 +129,8 @@
    * {@inheritDoc}
    */
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
 
@@ -135,29 +139,33 @@
   }
 
   /**
-   * Gets the separator class of the rendered document. That class will be 
+   * Gets the separator class of the rendered document. That class will be
    * combined with the skin class, not override it.
-   * 
+   *
    * @param bean the property holder for the rendered document.
-   * 
+   *
    * @return the separator class for the rendered document or <code>null</code>
    *         if none was specified.
    */
-  protected String getSeparatorClass(FacesBean bean)
+  protected String getSeparatorClass(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_separatorClassKey));
   }
 
   /**
-   * Gets the title class of the rendered document. That class will be 
+   * Gets the title class of the rendered document. That class will be
    * combined with the skin class, not override it.
-   * 
+   *
    * @param bean the property holder for the rendered document.
-   * 
+   *
    * @return the title class for the rendered document or <code>null</code>
    *         if none was specified.
    */
-  protected String getTitleClass(FacesBean bean)
+  protected String getTitleClass(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_titleClassKey));
   }
@@ -167,34 +175,36 @@
    */
   @Override
   protected void renderStyleAttributes(
-      FacesContext context,
-      RenderingContext arc,
-      FacesBean bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
-    renderStyleAttributes(context, arc, bean, _ROOT_SELECTOR);
+    renderStyleAttributes(context, rc, component, bean, _ROOT_SELECTOR);
   }
-  
+
   /**
-   * Gets the array of style classes to be used by the currently rendered 
+   * Gets the array of style classes to be used by the currently rendered
    * document's facet.
-   * 
+   *
    * @param arc          the current adf rendering context
    * @param bean         the property holder for the rendered document.
-   * @param key          the property key of the style class property for the 
+   * @param key          the property key of the style class property for the
    *                     current facet being rendered.
-   * @param skinSelector the skin selector associated with the currently 
+   * @param skinSelector the skin selector associated with the currently
    *                     rendered facet.
-   *                     
+   *
    * @return the array of style classes to add to the current facet.
    */
   private String[] _getStyleClasses(
-      FacesBean bean,
-      PropertyKey key,
-      String skinSelector)
+    FacesBean bean,
+    PropertyKey key,
+    String skinSelector)
   {
     // Pre-conditions that would cause NullPointerException if not met
     assert bean != null;
-    
+
     String specifiedClass = toString(bean.getProperty(key));
     if (specifiedClass != null)
     {
@@ -207,84 +217,88 @@
   }
 
   /**
-   * Determiens if the specified character can be considered as a line feed 
+   * Determiens if the specified character can be considered as a line feed
    * for the purpose of separating the paragraphs
-   * 
+   *
    * @param character the character to evaluate
-   * 
-   * @return <code>true</code> if the specified character can be considered a 
+   *
+   * @return <code>true</code> if the specified character can be considered a
    *         line feed, <code>false</code> otherwise.
    */
-  private boolean _isLineFeed(char character)
+  private boolean _isLineFeed(
+    char character)
   {
     return character == _LINE_FEED || character == _CARRIAGE_RETURN;
   }
 
   /**
-   * Renders the currently opened paragraph with the currently buffered content, 
+   * Renders the currently opened paragraph with the currently buffered content,
    * escaping it if necessary, then close it and flush the buffer.
-   * 
-   * @param rw      the response writer used to put content in the underlying 
+   *
+   * @param rw      the response writer used to put content in the underlying
    *                response.
    * @param bean    the property holder for the rendered document.
    * @param builder the content buffer
-   * 
-   * @throws IOException if a problem occurs while writing the content to the 
+   *
+   * @throws IOException if a problem occurs while writing the content to the
    *                     underlying response.
    */
   private void _renderParagraph(
-      FacesContext context,
-      StringBuilder builder) throws IOException
+    FacesContext  context,
+    StringBuilder builder
+    ) throws IOException
   {
     // Pre-conditions that would cause NullPointerException if not met
     assert builder != null;
     assert context != null;
-    
+
     renderFormattedText(context, builder.toString());
-    
+
     context.getResponseWriter().endElement(_PARAGRAPH_ELEMENT);
-    
+
     // Clear buffer content
     builder.delete(0, builder.length());
   }
 
   /**
    * Renders the beginning of a paragraph.
-   * 
+   *
    * @param context the current Faces context
-   * @param arc     the current rendering context
+   * @param rc     the current rendering context
    * @param bean    the property holder for the rendered document.
-   * 
-   * @throws IOException if a problem occurs while writing the content to the 
+   *
+   * @throws IOException if a problem occurs while writing the content to the
    *                     underlying response.
    */
   private void _renderParagraphStart(
-      FacesContext context,
-      RenderingContext arc) throws IOException
+    FacesContext     context,
+    RenderingContext rc
+    ) throws IOException
   {
     ResponseWriter rw = context.getResponseWriter();
 
     rw.startElement(_PARAGRAPH_ELEMENT, null);
-    
-    renderStyleClasses(context, arc, new String[]{_PARAGRAPH_SELECTOR});
+
+    renderStyleClasses(context, rc, new String[]{_PARAGRAPH_SELECTOR});
   }
 
   /**
    * Renders a separator between 2 paragraphs.
-   * 
+   *
    * @param context   the current Faces context
-   * @param arc       the current rendering context
+   * @param rc       the current rendering context
    * @param separator the component to render as a separator
    * @param bean      the property holder for the rendered document.
-   * 
-   * @throws IOException if a problem occurs while writing the content to the 
+   *
+   * @throws IOException if a problem occurs while writing the content to the
    *                     underlying response.
    */
   private void _renderSeparator(
-      FacesContext context,
-      RenderingContext arc,
-      UIComponent separator,
-      FacesBean bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      separator,
+    FacesBean        bean
+    ) throws IOException
   {
     ResponseWriter rw = context.getResponseWriter();
 
@@ -294,7 +308,7 @@
                                         _separatorClassKey,
                                         _SEPARATOR_SELECTOR);
 
-    renderStyleClasses(context, arc, classes);
+    renderStyleClasses(context, rc, classes);
 
     encodeChild(context, separator);
 
@@ -303,36 +317,37 @@
 
   /**
    * Renders the title of the rendered document.
-   * 
+   *
    * @param context the current Faces context
-   * @param arc     the current rendering context
+   * @param rc     the current rendering context
    * @param comp    the document component
    * @param bean    the property holder for the rendered document.
-   * 
-   * @throws IOException if a problem occurs while writing the content to the 
+   *
+   * @throws IOException if a problem occurs while writing the content to the
    *                     underlying response.
    */
   private void _renderTitle(
-      FacesContext context,
-      RenderingContext arc,
-      UIComponent comp,
-      FacesBean bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      comp,
+    FacesBean        bean
+    ) throws IOException
   {
     UIComponent title = getFacet(comp, CoreOutputDocument.TITLE_FACET);
     if (title != null)
     {
       ResponseWriter rw = context.getResponseWriter();
-  
+
       rw.startElement(_TITLE_ELEMENT, null);
-  
+
       String[] classes = _getStyleClasses(bean,
                                           _titleClassKey,
                                           _TITLE_SELECTOR);
-  
-      renderStyleClasses(context, arc, classes);
-  
+
+      renderStyleClasses(context, rc, classes);
+
       encodeChild(context, title);
-  
+
       rw.endElement(_TITLE_ELEMENT);
     }
   }
@@ -354,19 +369,18 @@
   private static final String _SEPARATOR_CLASS_ATTRIBUTE = "separatorClass";
 
   private static final String _TITLE_CLASS_ATTRIBUTE = "titleClass";
-  
+
   // Skin selectors
   private static final String _PARAGRAPH_SELECTOR = SkinSelectors.AF_OUTPUT_DOCUMENT_PARAGRAPH_STYLE_CLASS;
-  
+
   private static final String _ROOT_SELECTOR = SkinSelectors.AF_OUTPUT_DOCUMENT_STYLE_CLASS;
-  
+
   private static final String _SEPARATOR_SELECTOR = SkinSelectors.AF_OUTPUT_DOCUMENT_SEPARATOR_STYLE_CLASS;
-  
+
   private static final String _TITLE_SELECTOR = SkinSelectors.AF_OUTPUT_DOCUMENT_TITLE_STYLE_CLASS;
 
   // Property keys
   private PropertyKey _separatorClassKey;
 
   private PropertyKey _titleClassKey;
-
 }

Modified: myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputFormattedRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputFormattedRenderer.java?rev=889345&r1=889344&r2=889345&view=diff
==============================================================================
--- myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputFormattedRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputFormattedRenderer.java Thu Dec 10 17:46:13 2009
@@ -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
@@ -19,6 +19,7 @@
 package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
 import java.io.IOException;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -31,15 +32,17 @@
 import org.apache.myfaces.trinidad.component.core.output.CoreOutputFormatted;
 import org.apache.myfaces.trinidad.context.RenderingContext;
 
+
 public class OutputFormattedRenderer extends ValueRenderer
 {
   public OutputFormattedRenderer()
   {
     super(CoreOutputFormatted.TYPE);
   }
-  
+
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
     _styleUsageKey = type.findKey("styleUsage");
@@ -53,37 +56,42 @@
 
   @Override
   protected void encodeAll(
-    FacesContext        context,
-    RenderingContext arc,
-    UIComponent         comp,
-    FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      comp,
+    FacesBean        bean
+    ) throws IOException
   {
-    if (canSkipRendering(context, arc, comp))
+    if (canSkipRendering(context, rc, comp))
       return;
 
     ResponseWriter rw = context.getResponseWriter();
     rw.startElement("span", comp);
-    
+
     renderId(context, comp);
-    renderAllAttributes(context, arc, bean);
+    renderAllAttributes(context, rc, comp, bean);
 
     String value = getConvertedString(context, comp, bean);
     renderFormattedText(context, value);
     rw.endElement("span");
   }
 
-  protected String getStyleUsage(FacesBean bean)
+  protected String getStyleUsage(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_styleUsageKey));
   }
 
   @Override
-  protected String getStyleClass(FacesBean bean)
+  protected String getStyleClass(
+    UIComponent component,
+    FacesBean   bean)
   {
-    String styleClass = super.getStyleClass(bean);
+    String styleClass = super.getStyleClass(component, bean);
     if (styleClass == null)
     {
-      String usage = getStyleUsage(bean);
+      String usage = getStyleUsage(component, bean);
       if (usage != null)
       {
         styleClass = _USAGES.get(usage);



Mime
View raw message