myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arobinso...@apache.org
Subject svn commit: r889345 [4/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/BodyRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/BodyRenderer.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/BodyRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/BodyRenderer.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
@@ -22,7 +22,6 @@
 
 import java.io.IOException;
 
-
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
@@ -30,8 +29,8 @@
 import org.apache.myfaces.trinidad.bean.FacesBean;
 import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.component.html.HtmlBody;
-import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
 import org.apache.myfaces.trinidad.skin.Skin;
 import org.apache.myfaces.trinidad.util.Service;
@@ -49,13 +48,15 @@
     this(HtmlBody.TYPE);
   }
 
-  protected BodyRenderer(FacesBean.Type type)
+  protected BodyRenderer(
+    FacesBean.Type type)
   {
     super(type);
   }
 
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
     _firstClickPassedKey = type.findKey("firstClickPassed");
@@ -66,51 +67,54 @@
 
   @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();
     writer.startElement("body", component);
     renderId(context, component);
-    renderAllAttributes(context, arc, bean);
-    super.encodeAll(context, arc, component, bean);
+    renderAllAttributes(context, rc, component, bean);
+    super.encodeAll(context, rc, component, bean);
 
     // Output a version comment at the bottom of the body
-    _writeVersionInformation(context, arc);
+    _writeVersionInformation(context, rc);
   }
 
   @Override
   protected void renderAtEnd(
-    FacesContext context,
-    RenderingContext arc) throws IOException
+    FacesContext     context,
+    RenderingContext rc
+    ) throws IOException
   {
     _encodeServiceScripts(context);
 
     // trigger the rendering of targeted resource
-    // for the BODY, on UIViewRoot - if there are 
+    // for the BODY, on UIViewRoot - if there are
     // any...
     encodeComponentResources(context, "body");
     context.getResponseWriter().endElement("body");
 
-    _renderInitialFocusScript(context, arc);
+    _renderInitialFocusScript(context, rc);
   }
 
   @Override
   protected void renderPPRSupport(
-    FacesContext        context,
-    RenderingContext arc,
-    UIComponent         component,
-    FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
-    super.renderPPRSupport(context, arc, component, bean);
-    if (getFirstClickPassed(bean))
+    super.renderPPRSupport(context, rc, component, bean);
+    if (getFirstClickPassed(component, bean))
     {
       ResponseWriter writer = context.getResponseWriter();
       writer.startElement("script", null);
-      renderScriptDeferAttribute(context, arc);
-      renderScriptTypeAttribute(context, arc);
+      renderScriptDeferAttribute(context, rc);
+      renderScriptTypeAttribute(context, rc);
       writer.writeText("var _pprFirstClickPass=true;", null);
       writer.endElement("script");
     }
@@ -118,64 +122,67 @@
 
   @Override
   protected void renderContent(
-    FacesContext        context,
-    RenderingContext arc,
-    UIComponent         component,
-    FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
-    boolean isPartialPass = PartialPageUtils.isPartialRenderingPass(arc);
+    boolean isPartialPass = PartialPageUtils.isPartialRenderingPass(rc);
 
     _renderAnchorForTop(context);
-    
-    // Since we are supporting Non-JavaScript browsers of generic PDA, 
-    // we don't need to prompt any message in the client side regarding 
+
+    // Since we are supporting Non-JavaScript browsers of generic PDA,
+    // we don't need to prompt any message in the client side regarding
     // the JavaScript capability of generic PDA browsers.
 
-    if (supportsScripting(arc))
+    if (supportsScripting(rc))
     {
-      _renderNoScript(context, arc);
-      _storeInitialFocus(arc, bean);
+      _renderNoScript(context, rc);
+      _storeInitialFocus(rc, component, bean);
     }
 
     if (!isPartialPass)
     {
       // start the span here, and end it in postrender
-      _renderPartialBackSupportSpan(context, arc, true);
+      _renderPartialBackSupportSpan(context, rc, true);
     }
 
-    super.renderContent(context, arc, component, bean);
+    super.renderContent(context, rc, component, bean);
 
     if (!isPartialPass)
     {
       // end the span for PPR Back button support (and render the hidden fields)
-      _renderPartialBackSupportSpan(context, arc, false);
+      _renderPartialBackSupportSpan(context, rc, false);
     }
   }
 
   @Override
   protected void renderEventHandlers(
     FacesContext context,
-    FacesBean    bean) throws IOException
+    UIComponent  component,
+    FacesBean    bean
+    ) throws IOException
   {
-    super.renderEventHandlers(context, bean);
-    RenderingContext arc = RenderingContext.getCurrentInstance();
+    super.renderEventHandlers(context, component, bean);
+    RenderingContext rc = RenderingContext.getCurrentInstance();
     ResponseWriter rw = context.getResponseWriter();
 
-    if (PartialPageUtils.isPartialRenderingPass(arc))
+    if (PartialPageUtils.isPartialRenderingPass(rc))
     {
       rw.writeAttribute("onunload", _PARTIAL_ONUNLOAD_HANDLER, null);
     }
     else
     {
-      rw.writeAttribute("onload", getOnload(arc, bean), "onload");
-      rw.writeAttribute("onunload", getOnunload(arc, bean), "onunload");
+      rw.writeAttribute("onload", getOnload(rc, component, bean), "onload");
+      rw.writeAttribute("onunload", getOnunload(rc, component, bean), "onunload");
 
       // If partial back is supported,
       // render an onbeforeunload event handler. This javascript function
       // will save the page's state when the page is unloaded. This way if the
       // user goes back to the page via the Back button, we'll be able to
       // restore the state: the html and the javascript.
-      if (_isPartialBackSupported(arc))
+      if (_isPartialBackSupported(rc))
       {
         rw.writeAttribute("onbeforeunload",
                           _PPR_BACK_UNLOAD_SCRIPT,
@@ -184,7 +191,9 @@
     }
   }
 
-  protected boolean getFirstClickPassed(FacesBean bean)
+  protected boolean getFirstClickPassed(
+    UIComponent component,
+    FacesBean   bean)
   {
     // =-=AEW firstClickPassed is not currently supported on document
     if (_firstClickPassedKey == null)
@@ -196,12 +205,17 @@
     return Boolean.TRUE.equals(o);
   }
 
-  protected String getInitialFocusId(FacesBean bean)
+  protected String getInitialFocusId(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_initialFocusIdKey));
   }
 
-  protected String getOnload(RenderingContext arc, FacesBean bean)
+  protected String getOnload(
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean)
   {
     String onload;
     if (_onloadKey == null)
@@ -217,7 +231,7 @@
     //Therefore, created another function _checkLoadNoPPR() This function is
     //called by the onLoad JS handler of body tag when device does not support
     //PPR
-    if (PartialPageUtils.supportsPartialRendering(arc))
+    if (PartialPageUtils.supportsPartialRendering(rc))
     {
       // Don't short circuit...
       //PH:_checkLoad(event) is replaced by _checkLoad() because on certain
@@ -230,23 +244,26 @@
     {
       //HKuhn - in printable mode we don't need PPR checking
       // Check only, if Agents supports Navigation or Editing
-      if (supportsNavigation(arc) || supportsEditing(arc))
+      if (supportsNavigation(rc) || supportsEditing(rc))
         checkLoad = "_checkLoadNoPPR()";
     }
-    
+
     onload = XhtmlUtils.getChainedJS(checkLoad, onload, false);
 
     return onload;
   }
 
-  protected String getOnunload(RenderingContext arc, FacesBean bean)
+  protected String getOnunload(
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean)
   {
     String onunload;
     if (_onunloadKey == null)
       onunload = null;
     else
       onunload = toString(bean.getProperty(_onunloadKey));
-    if (PartialPageUtils.supportsPartialRendering(arc))
+    if (PartialPageUtils.supportsPartialRendering(rc))
     {
       // Don't short circuit...
       onunload = XhtmlUtils.getChainedJS("_checkUnload(event)",
@@ -257,8 +274,6 @@
     return onunload;
   }
 
-
-
   /**
    * Renders a top anchor at the top of the page
    * In quirks mode this is not required,but Mozilla will complain
@@ -266,7 +281,9 @@
    * @param context
    * @throws IOException
    */
-  private void _renderAnchorForTop(FacesContext context) throws IOException
+  private void _renderAnchorForTop(
+    FacesContext context
+    ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
     writer.startElement("a",null);
@@ -275,8 +292,9 @@
   }
 
   private void _renderNoScript(
-    FacesContext        context,
-    RenderingContext arc) throws IOException
+    FacesContext     context,
+    RenderingContext rc
+    ) throws IOException
   {
     // Some accessibility standards rather oddly claim that NOSCRIPT
     // tags are essential for compliance.  So, render NOSCRIPT, at
@@ -286,24 +304,25 @@
     // largely there for JDev 10.1.3 preview, which was rendering
     // the contents of any NOSCRIPT tags in the VE, but it's
     // a check that does no harm.
-    if (!isInaccessibleMode(arc) && !Beans.isDesignTime())
+    if (!isInaccessibleMode(rc) && !Beans.isDesignTime())
     {
       ResponseWriter writer = context.getResponseWriter();
       writer.startElement("noscript",null);
-      String message = arc.getTranslatedString("NO_SCRIPT_MESSAGE");
+      String message = rc.getTranslatedString("NO_SCRIPT_MESSAGE");
       writer.writeText(message, null);
       writer.endElement("noscript");
     }
   }
 
   private void _storeInitialFocus(
-    RenderingContext arc,
-    FacesBean           bean)
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean)
   {
 
     // The initialFocus functionality is only supported in inaccessible mode,
     // and only platforms that support scripting.
-    if (!isInaccessibleMode(arc) || !supportsScripting(arc))
+    if (!isInaccessibleMode(rc) || !supportsScripting(rc))
     {
       return;
     }
@@ -311,7 +330,7 @@
     // initial focus is the id of the component to which you want the
     // focus to be when the page full-page loads. In a PPR, the focus is
     // not set, which is a good thing.
-    String initialFocusID = getInitialFocusId(bean);
+    String initialFocusID = getInitialFocusId(component, bean);
     if (initialFocusID != null)
     {
       // Put the initial focus id on the rendering context for use in
@@ -322,7 +341,7 @@
       // NavigationBar creates a special id for the Next button, and sticks
       // this id back on the AdfRenderingContext for the body to know about in
       // postrender.
-      arc.getProperties().put(XhtmlConstants.INITIAL_FOCUS_CONTEXT_PROPERTY,
+      rc.getProperties().put(XhtmlConstants.INITIAL_FOCUS_CONTEXT_PROPERTY,
                               initialFocusID);
     }
   }
@@ -331,14 +350,14 @@
   // Writes a small script that sets the _initialFocusID variable on the page.
   //
   private void _renderInitialFocusScript(
-    FacesContext        context,
-    RenderingContext arc
+    FacesContext     context,
+    RenderingContext rc
     ) throws IOException
   {
 
     // The initialFocus functionality is not supported if not inaccessible mode
     // nor on Netscape nor on platforms that do not support scripting.
-    if (!isInaccessibleMode(arc) || !supportsScripting(arc))
+    if (!isInaccessibleMode(rc) || !supportsScripting(rc))
     {
       return;
     }
@@ -346,14 +365,14 @@
     // Render the initial focus id, if it exists on the rendering context.
     // The initial focus id was initially set in prerender, and may have
     // been overwritten by the component's renderer if need be.
-    String initialFocusID = (String) arc.getProperties().get(
+    String initialFocusID = (String) rc.getProperties().get(
                                     XhtmlConstants.INITIAL_FOCUS_CONTEXT_PROPERTY);
 
     if (initialFocusID != null)
     {
       ResponseWriter writer = context.getResponseWriter();
       writer.startElement("script", null);
-      XhtmlRenderer.renderScriptTypeAttribute(context, arc);
+      XhtmlRenderer.renderScriptTypeAttribute(context, rc);
       writer.writeText("_initialFocusID='", null);
       writer.writeText(initialFocusID, null);
       writer.writeText("';", null);
@@ -367,12 +386,12 @@
   // when the user leaves the page. This way we can restore the html if
   // the user used the Back button to go back to the page.
   private static void _renderPartialBackSupportSpan(
-    FacesContext        context,
-    RenderingContext arc,
-    boolean             isStart
+    FacesContext     context,
+    RenderingContext rc,
+    boolean          isStart
     ) throws IOException
   {
-    if (_isPartialBackSupported(arc))
+    if (_isPartialBackSupported(rc))
     {
       ResponseWriter writer = context.getResponseWriter();
 
@@ -400,10 +419,9 @@
   // not go to the server when the form is submitted.
   private static void _renderPartialBackSupportHiddenFields(
     ResponseWriter writer,
-    String       fieldName
+    String         fieldName
     ) throws IOException
   {
-
     writer.startElement("input", null);
 
     writer.writeAttribute("id", fieldName, null);
@@ -415,8 +433,7 @@
 
 
   private static boolean _isPartialBackSupported(
-    RenderingContext arc
-    )
+    RenderingContext rc)
   {
     /*
       // Only supported on IE  - but comment this out while
@@ -434,9 +451,9 @@
   // Writes version information about the page.
   //
   static private void _writeVersionInformation(
-    FacesContext context,
-    RenderingContext arc)
-    throws IOException
+    FacesContext     context,
+    RenderingContext rc
+    ) throws IOException
   {
     String comment = _VERSION_COMMENT;
 
@@ -451,9 +468,9 @@
     comment += versionInfo;
 
     String accessibilityMode = null;
-    if (isInaccessibleMode(arc))
+    if (isInaccessibleMode(rc))
       accessibilityMode = "disabled";
-    else if (isScreenReaderMode(arc))
+    else if (isScreenReaderMode(rc))
       accessibilityMode = "enhanced";
 
     if (accessibilityMode != null)
@@ -462,7 +479,7 @@
     }
 
     // Tack on the Skin id
-    Skin skin = arc.getSkin();
+    Skin skin = rc.getSkin();
     String skinId = skin.getId();
     if (skinId != null)
     {
@@ -478,9 +495,9 @@
     context.getResponseWriter().writeComment(comment);
   }
 
-
-  static private void _encodeServiceScripts(FacesContext context)
-    throws IOException
+  static private void _encodeServiceScripts(
+    FacesContext context
+    ) throws IOException
   {
     ExtendedRenderKitService service =
       Service.getRenderKitService(context, ExtendedRenderKitService.class);
@@ -490,7 +507,9 @@
     }
   }
 
-  static private String _getVersionInfo(Package apiPackage, Package implPackage)
+  static private String _getVersionInfo(
+    Package apiPackage,
+    Package implPackage)
   {
 
     String versionInfo    = "";

Modified: myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/BreadCrumbsRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/BreadCrumbsRenderer.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/BreadCrumbsRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/BreadCrumbsRenderer.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,7 +19,9 @@
 package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
 import java.io.IOException;
+
 import java.text.Bidi;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -35,8 +37,9 @@
 import org.apache.myfaces.trinidad.component.core.nav.CoreBreadCrumbs;
 import org.apache.myfaces.trinidad.component.core.nav.CoreCommandLink;
 import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
 import org.apache.myfaces.trinidad.skin.Icon;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
+
 
 public class BreadCrumbsRenderer extends XhtmlRenderer
 {
@@ -44,9 +47,10 @@
   {
     super(CoreBreadCrumbs.TYPE);
   }
-  
+
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
     _orientationKey = type.findKey("orientation");
@@ -57,30 +61,31 @@
   {
     return true;
   }
-  
+
   @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();
-    
+
     writer.startElement("span", component);
-    renderAllAttributes(context, arc, bean);
+    renderAllAttributes(context, rc, component, bean);
     renderId(context, component);
-        
+
     int renderedItemCount = _getItemCount((UIXHierarchy)component);
-    int minItemCount = _getMinItemCount(arc);
+    int minItemCount = _getMinItemCount(rc);
 
     // no kids, no NavigationPath -- but you still get the span.
     if (renderedItemCount > minItemCount )
     {
-      renderContent(context, arc, 
+      renderContent(context, rc,
                     (UIXHierarchy)component, bean);
     }
-    
+
     writer.endElement("span");
   }
 
@@ -88,47 +93,47 @@
    * Gets the stamp to use to render each link
    */
   protected UIComponent getStamp(
-    FacesContext        context,
-    RenderingContext arc,
-    UIXHierarchy        component,
-    FacesBean           bean
+    FacesContext     context,
+    RenderingContext rc,
+    UIXHierarchy     component,
+    FacesBean        bean
     )
   {
-    UIComponent stamp = component.getFacet("nodeStamp");   
+    UIComponent stamp = component.getFacet("nodeStamp");
     return stamp;
   }
 
   @SuppressWarnings("unchecked")
   protected void renderContent(
-    FacesContext        context,
-    RenderingContext arc,
-    UIXHierarchy        component,
-    FacesBean           bean
+    FacesContext     context,
+    RenderingContext rc,
+    UIXHierarchy     component,
+    FacesBean        bean
     ) throws IOException
   {
 
     boolean isVertical;
-     
+
     // To reduce the breadcrumb's width, render vertically for narrow-screen
     // PDAs.
-    if (supportsNarrowScreen(arc))
-    { 
+    if (supportsNarrowScreen(rc))
+    {
       isVertical = true;
     }
     else
     {
       isVertical = _isVertical(bean);
     }
-    
-    boolean shouldRenderLastChild = shouldRenderLastChild(arc);    
+
+    boolean shouldRenderLastChild = shouldRenderLastChild(rc);
     boolean isLastChild   = false;
     boolean isFirstChild  = true;
     int renderedCount     = 0;
     int nextVisChildIndex = 1;
-    UIComponent stamp = getStamp(context, arc, component, bean);
-    Icon separatorIcon = arc.getIcon(
-                            SkinSelectors.AF_NAVIGATION_PATH_SEPARATOR_ICON_NAME); 
- 
+    UIComponent stamp = getStamp(context, rc, component, bean);
+    Icon separatorIcon = rc.getIcon(
+                            SkinSelectors.AF_NAVIGATION_PATH_SEPARATOR_ICON_NAME);
+
     // use the focusKey to stamp out path
     if(stamp != null)
     {
@@ -137,12 +142,12 @@
       Object focusPath = _getFocusRowKey(component);
       if (focusPath == null)
         return;
-      
-      List<Object> paths = 
+
+      List<Object> paths =
         new ArrayList<Object>(component.getAllAncestorContainerRowKeys(focusPath));
-      
+
       paths.add(focusPath);
-      int size = paths.size();        
+      int size = paths.size();
 
       for (int i = 0; i < size; i++)
       {
@@ -152,15 +157,15 @@
           nextVisChildIndex=NO_CHILD_INDEX;
         else
           nextVisChildIndex = i + 1;
-        
-        isLastChild = (nextVisChildIndex == NO_CHILD_INDEX);  
+
+        isLastChild = (nextVisChildIndex == NO_CHILD_INDEX);
         component.setRowKey(paths.get(i));
 
-        renderNode(context, arc, separatorIcon, stamp, renderedCount,
+        renderNode(context, rc, separatorIcon, stamp, renderedCount,
                    shouldRenderLastChild, isFirstChild, isLastChild, isVertical);
         renderedCount++;
         isFirstChild = false;
-        
+
       }
 
       // Restore the old path
@@ -174,46 +179,47 @@
       nextVisChildIndex = getNextRenderedChildIndex(children, -1);
       while (nextVisChildIndex != NO_CHILD_INDEX)
       {
-        UIComponent child = children.get(nextVisChildIndex);        
-        nextVisChildIndex = getNextRenderedChildIndex(children, 
+        UIComponent child = children.get(nextVisChildIndex);
+        nextVisChildIndex = getNextRenderedChildIndex(children,
                                                       nextVisChildIndex);
-        isLastChild = (nextVisChildIndex == NO_CHILD_INDEX);           
-        renderNode(context, arc, separatorIcon, child, renderedCount,
+        isLastChild = (nextVisChildIndex == NO_CHILD_INDEX);
+        renderNode(context, rc, separatorIcon, child, renderedCount,
                    shouldRenderLastChild, isFirstChild, isLastChild, isVertical);
-        renderedCount++;           
+        renderedCount++;
         isFirstChild = false;
       }
     }
-    
+
   }
 
-  protected boolean hasChildren(UIComponent component)
+  protected boolean hasChildren(
+    UIComponent component)
   {
     int childCount = component.getChildCount();
     return childCount > 0;
   }
 
   protected void renderNode(
-    FacesContext        context,
-    RenderingContext    arc,
-    Icon                separatorIcon,
-    UIComponent         child,
-    int                 renderedCount,
-    boolean             shouldRenderLastChild,
-    boolean             isFirstChild,
-    boolean             isLastChild,
-    boolean             isVertical
+    FacesContext     context,
+    RenderingContext rc,
+    Icon             separatorIcon,
+    UIComponent      child,
+    int              renderedCount,
+    boolean          shouldRenderLastChild,
+    boolean          isFirstChild,
+    boolean          isLastChild,
+    boolean          isVertical
     ) throws IOException
-  {      
-    
-    boolean separatorOnNewRow = shouldRenderSeparatorOnNewLineWhenVertical(arc);
+  {
+
+    boolean separatorOnNewRow = shouldRenderSeparatorOnNewLineWhenVertical(rc);
 
     if (!isLastChild || shouldRenderLastChild)
     {
       renderStartOfLink(context, isVertical);
-      
+
       ResponseWriter writer = context.getResponseWriter();
-      
+
       // if oriented vertically, then indent the levels
       if(!isFirstChild && isVertical)
       {
@@ -221,51 +227,52 @@
         chars[0] = XhtmlConstants.NBSP_CHAR;
 
         int indents = separatorOnNewRow ? renderedCount - 1 : renderedCount;
-        int indentSpaces = indents * getNumberOfIndentSpaces(arc);
+        int indentSpaces = indents * getNumberOfIndentSpaces(rc);
         for(int i = 0; i < indentSpaces; i++)
         {
           writer.writeText(chars, 0, 1);
         }
       }
-      
-      if (arc.isRightToLeft())
+
+      if (rc.isRightToLeft())
       {
         writer.startElement(XhtmlConstants.SPAN_ELEMENT, null);
         writer.writeAttribute(XhtmlConstants.DIR_ATTRIBUTE_VALUE, "rtl", null);
       }
-      
+
       if (!isFirstChild && (isVertical && separatorOnNewRow) )
       {
-        OutputUtils.renderIcon(context, arc, separatorIcon, "", null );
+        OutputUtils.renderIcon(context, rc, separatorIcon, "", null );
       }
 
-      renderLink(context, arc, child, renderedCount, isLastChild);
+      renderLink(context, rc, child, renderedCount, isLastChild);
 
       if (!isLastChild && (!isVertical || !separatorOnNewRow) )
       {
-        OutputUtils.renderIcon(context, arc, separatorIcon, "", null );
-      }      
-      
-      if (arc.isRightToLeft())
+        OutputUtils.renderIcon(context, rc, separatorIcon, "", null );
+      }
+
+      if (rc.isRightToLeft())
       {
          writer.endElement(XhtmlConstants.SPAN_ELEMENT);
       }
-      
+
       renderEndOfLink(context, isVertical);
-      
+
     }
   }
 
   protected void renderLink(
-    FacesContext context,
-    RenderingContext arc,
-    UIComponent child,
-    int renderedCount,
-    boolean isLastChild) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      child,
+    int              renderedCount,
+    boolean          isLastChild
+    ) throws IOException
   {
     if (isLastChild)
-      ((CoreRenderingContext) arc).setLinkDisabled(true);    
-  
+      ((CoreRenderingContext) rc).setLinkDisabled(true);
+
     boolean isBidi = false;
     String text = toString(child.getAttributes().get(CoreCommandLink.TEXT_KEY.getName()));
     if ((text != null) && (text.length() > 0))
@@ -274,11 +281,11 @@
       firstChar[0] = text.charAt(0);
       isBidi = Bidi.requiresBidi(firstChar, 0, 1);
     }
-    
-    Map<String, String> originalResourceKeyMap = arc.getSkinResourceKeyMap();
+
+    Map<String, String> originalResourceKeyMap = rc.getSkinResourceKeyMap();
     try
     {
-      arc.setSkinResourceKeyMap(_RESOURCE_KEY_MAP);
+      rc.setSkinResourceKeyMap(_RESOURCE_KEY_MAP);
       if (!isBidi)
       {
         ResponseWriter writer = context.getResponseWriter();
@@ -288,47 +295,48 @@
         writer.endElement(XhtmlConstants.SPAN_ELEMENT);
       }
       else
-        encodeChild(context, child);      
-      
+        encodeChild(context, child);
+
       if (isLastChild)
-        ((CoreRenderingContext) arc).setLinkDisabled(false);       
+        ((CoreRenderingContext) rc).setLinkDisabled(false);
     }
     finally
     {
-      arc.setSkinResourceKeyMap(originalResourceKeyMap);
-    }       
+      rc.setSkinResourceKeyMap(originalResourceKeyMap);
+    }
   }
- 
+
   protected boolean shouldRenderLastChild(
-    RenderingContext arc
+    RenderingContext rc
   )
   {
-    Object propValue = arc.getSkin().getProperty(
+    Object propValue = rc.getSkin().getProperty(
                       SkinProperties.AF_NAVIGATIONPATH_SHOW_LAST_ITEM_PROPERTY_KEY);
-                      
-    return Boolean.TRUE.equals(propValue);                      
+
+    return Boolean.TRUE.equals(propValue);
   }
 
-  /** 
+  /**
    * renderStyleAttributes - use the NavigationPath style class as the default
    * styleClass
    */
   @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, 
+    renderStyleAttributes(context, rc, component, bean,
                           SkinSelectors.AF_NAVIGATION_PATH_STYLE_CLASS);
   }
 
-
-
-  protected String getOrientation(FacesBean bean)
+  protected String getOrientation(
+    FacesBean bean)
   {
     return toString(bean.getProperty(_orientationKey));
-  }  
+  }
 
 
   //
@@ -339,8 +347,9 @@
    * for explanation, do we still need this code?
    */
   protected final void renderStartOfLink(
-    FacesContext        context,
-    boolean             isVertical) throws IOException
+    FacesContext context,
+    boolean      isVertical
+    ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
 
@@ -360,41 +369,41 @@
   // Renders everything that goes after the link
   //
   protected final void renderEndOfLink(
-    FacesContext        context,
-    boolean             isVertical
+    FacesContext context,
+    boolean      isVertical
     ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
 
     writer.endElement("nobr");
-  
+
     if(isVertical)
     {
       writer.endElement("div");
     }
   }
-  
+
   private Object _getFocusRowKey(
-    UIXHierarchy    component
+    UIXHierarchy component
   )
-  {  
+  {
     return component.getFocusRowKey();
   }
 
   private int _getMinItemCount(
-    RenderingContext arc
+    RenderingContext rc
   )
   {
     int minChildCount = 0;
-    boolean shouldRenderLastChild = shouldRenderLastChild(arc);
+    boolean shouldRenderLastChild = shouldRenderLastChild(rc);
     if ( !shouldRenderLastChild)
       minChildCount = 1;
-      
+
     return minChildCount;
   }
 
   private int _getItemCount(
-    UIXHierarchy    component
+    UIXHierarchy component
     )
   {
     Object focusPath = _getFocusRowKey(component);
@@ -411,33 +420,34 @@
    * defaults to horizontal.
    * @return true if the orientation is vertical
    */
-  private boolean _isVertical(FacesBean bean)
+  private boolean _isVertical(
+    FacesBean bean)
   {
     String orientation = getOrientation(bean);
     return XhtmlConstants.ORIENTATION_VERTICAL.equals(orientation);
   }
 
   protected boolean shouldRenderSeparatorOnNewLineWhenVertical(
-    RenderingContext arc
+    RenderingContext rc
   )
   {
-    Object propValue = arc.getSkin().getProperty(
+    Object propValue = rc.getSkin().getProperty(
                                   SkinProperties.AF_BREAD_CRUMBS_SEPARATOR_ON_NEW_LINE);
     return Boolean.TRUE.equals(propValue);
   }
 
   protected int getNumberOfIndentSpaces(
-      RenderingContext arc
+    RenderingContext rc
   )
   {
-    // In the case of narrow-screen PDAs, the number of indent spaces is 
+    // In the case of narrow-screen PDAs, the number of indent spaces is
     // reduced to decrease the overall breadcrumb's width.
-    if (supportsNarrowScreen(arc))
-    { 
+    if (supportsNarrowScreen(rc))
+    {
       return NARROW_SCREEN_INDENT_SPACES;
     }
-    
-    Object propValue = arc.getSkin().getProperty(
+
+    Object propValue = rc.getSkin().getProperty(
                                       SkinProperties.AF_BREAD_CRUMBS_INDENT_SPACES);
 
     int intValue = _INDENT_SPACES;
@@ -451,28 +461,26 @@
     return intValue;
   }
 
-
   private PropertyKey _orientationKey;
-  
 
   // # of hard spaces to use in indenting vertical breadcrumbs
-  private static final int _INDENT_SPACES = 10;  
-  
-  // # of hard spaces to use in indenting vertical breadcrumbs 
+  private static final int _INDENT_SPACES = 10;
+
+  // # of hard spaces to use in indenting vertical breadcrumbs
   // in the case of narrow-screen PDAs
-  private static final int NARROW_SCREEN_INDENT_SPACES = 3; 
-  
+  private static final int NARROW_SCREEN_INDENT_SPACES = 3;
+
   private static final Map<String, String> _RESOURCE_KEY_MAP;
   static
   {
     _RESOURCE_KEY_MAP  =  new HashMap<String, String>();
-    
+
     _RESOURCE_KEY_MAP.put(
       SkinSelectors.LINK_STYLE_CLASS,
       SkinSelectors.AF_NAVIGATION_PATH_STEP_STYLE_CLASS);
     // the selected step is disabled, which is why we map these two styles
     _RESOURCE_KEY_MAP.put(
       SkinSelectors.LINK_DISABLED_STYLE_CLASS,
-      SkinSelectors.AF_NAVIGATION_PATH_SELECTED_STEP_STYLE_CLASS); 
+      SkinSelectors.AF_NAVIGATION_PATH_SELECTED_STEP_STYLE_CLASS);
   }
 }

Modified: myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ChooseDateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ChooseDateRenderer.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/ChooseDateRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ChooseDateRenderer.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,11 +19,12 @@
 package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
 import java.io.IOException;
+
 import java.text.DateFormatSymbols;
+
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
-
 import java.util.TimeZone;
 
 import javax.faces.component.UIComponent;
@@ -33,16 +34,16 @@
 import org.apache.myfaces.trinidad.bean.FacesBean;
 import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.component.core.input.CoreChooseDate;
+import org.apache.myfaces.trinidad.context.LocaleContext;
 import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.skin.Icon;
-import org.apache.myfaces.trinidad.util.IntegerUtils;
 import org.apache.myfaces.trinidad.util.FastMessageFormat;
-
+import org.apache.myfaces.trinidad.util.IntegerUtils;
 import org.apache.myfaces.trinidadinternal.renderkit.core.pages.GenericEntry;
-import org.apache.myfaces.trinidad.context.LocaleContext;
 import org.apache.myfaces.trinidadinternal.share.url.EncoderUtils;
 
+
 /**
  * Renders the calendar.
  * <p>
@@ -63,13 +64,15 @@
     this(CoreChooseDate.TYPE);
   }
 
-  protected ChooseDateRenderer(FacesBean.Type type)
+  protected ChooseDateRenderer(
+    FacesBean.Type type)
   {
     super(type);
   }
 
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
     _maxValueKey = type.findKey("maxValue");
@@ -96,68 +99,69 @@
 
   @Override
   protected final void encodeAll(
-    FacesContext        context,
-    RenderingContext    arc,
-    UIComponent         component,
-    FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
     // Currently, we require scripting to render anything
-    if (!supportsScripting(arc))
+    if (!supportsScripting(rc))
       return;
 
-    if (canSkipRendering(context, arc, component))
+    if (canSkipRendering(context, rc, component))
       return;
 
     // If we are running in inline mode, make sure that we are
     // in an environment that supports partial page rendering.
     // If not, render nothing - the user will need to use the
     // secondary window to select a date.
-    boolean isInline = isInline(bean);
-    if (isInline && !isInlineSupported(arc))
+    boolean isInline = isInline(component, bean);
+    if (isInline && !isInlineSupported(rc))
       return;
 
     // TRINIDAD-1349: The client converter assumes a fixed timezone offset
     // between the server and itself. It calculates that by passing the
-    // server's timezone offset at the current date-time, as _uixLocaleTZ. 
-    // However, if we are rendering a month in which daylight savings occurs in 
+    // server's timezone offset at the current date-time, as _uixLocaleTZ.
+    // However, if we are rendering a month in which daylight savings occurs in
     // the application timezone, the offset value may be different. In that case
-    // pass the new offset value for the client to use. 
-    TimeZone tz = arc.getLocaleContext().getTimeZone();
-    
+    // pass the new offset value for the client to use.
+    TimeZone tz = rc.getLocaleContext().getTimeZone();
+
     // TRINIDAD-1419: chooseDate golden files should stay the same even if
-    // the server runs in different timezones. 
+    // the server runs in different timezones.
     long currTimeMillis = 0;
     Object currTimeValue =  bean.getProperty (_currTimeKey);
     if (currTimeValue != null)
       currTimeMillis = ((Date) currTimeValue).getTime();
     else
       currTimeMillis = System.currentTimeMillis();
-    
+
     int baseTZOffsetMinutes = tz.getOffset(currTimeMillis/(1000*60));
 
-    boolean isDesktop = isDesktop(arc);
+    boolean isDesktop = isDesktop(rc);
     ResponseWriter writer = context.getResponseWriter();
     writer.startElement("table", component);
     renderId(context, component);
-    renderAllAttributes(context, arc, bean);
+    renderAllAttributes(context, rc, component, bean);
     if (isDesktop)
-      OutputUtils.renderLayoutTableAttributes(context, arc, "0", null);
+      OutputUtils.renderLayoutTableAttributes(context, rc, "0", null);
     else
-      OutputUtils.renderLayoutTableAttributes(context, arc, "0", "100%");
+      OutputUtils.renderLayoutTableAttributes(context, rc, "0", "100%");
 
 
     // Get the styles that we'll use to render the calendar
     CalendarStyles styles = _getCalendarStyles(isInline);
 
     // get the calendar of the minimum displayable time
-    long minTime = _getMinTime(arc, bean);
+    long minTime = _getMinTime(rc, bean);
 
     // get the calendar of the maximum displayable time
-    long maxTime = _getMaxTime(arc, bean);
+    long maxTime = _getMaxTime(rc, bean);
 
     // get the currently selected Time
-    long selectedTime = _getSelectedTime(arc, bean, minTime, maxTime);
-    
+    long selectedTime = _getSelectedTime(rc, bean, minTime, maxTime);
+
     // get the id
     String id = getClientId(context, component);
 
@@ -168,11 +172,11 @@
            context,
            GenericEntry.INLINE_DATE_PICKER_ENTRY);
     else
-      destString = getDestination(bean);
+      destString = getDestination(component, bean);
 
 
      // get the calendar of the currently displayed time
-    Calendar displayedCalendar = _getDisplayedCalendar(arc,
+    Calendar displayedCalendar = _getDisplayedCalendar(rc,
                                                        bean,
                                                        minTime,
                                                        maxTime,
@@ -180,7 +184,7 @@
 
     int firstDOM = _getActualMinimumDayOfMonth(displayedCalendar);
     int lastDOM  = _getActualMaximumDayOfMonth(displayedCalendar);
-    
+
     // determine the the starting times and ending times of the first and
     // last days of the month
     // Create a copy of the calendar so we don't hammer the current values
@@ -195,7 +199,7 @@
     calcCal.add(Calendar.DATE, 1);
     long lastDOMTime = calcCal.getTimeInMillis() - 1;
 
-    DateFormatSymbols dateSymbols = _getDateFormatSymbols(arc);
+    DateFormatSymbols dateSymbols = _getDateFormatSymbols(rc);
 
     int firstDOW = displayedCalendar.getMinimum(Calendar.DAY_OF_WEEK);
     int lastDOW = displayedCalendar.getMaximum(Calendar.DAY_OF_WEEK);
@@ -207,13 +211,13 @@
     // If we're running in inline mode, make sure we have
     // access to the necessary scripts
     if (isInline)
-      XhtmlUtils.addLib(context, arc, "_calsd()");
+      XhtmlUtils.addLib(context, rc, "_calsd()");
 
 
     // make sure that the js lib is added
-    XhtmlUtils.addLib(context, arc, "_updateCal()");
+    XhtmlUtils.addLib(context, rc, "_updateCal()");
 
-    String baseNavURL = _createNavURL(arc,
+    String baseNavURL = _createNavURL(rc,
                                       destString,
                                       minTime,
                                       maxTime,
@@ -224,7 +228,7 @@
 
     // render the previous button
     _renderNextPrev(context,
-                    arc,
+                    rc,
                     component,
                     bean,
                     true,
@@ -235,13 +239,13 @@
 
     writer.startElement("td", null);
     writer.writeAttribute("colspan", IntegerUtils.getString(dowCount - 2), null);
-    renderStyleClass(context, arc, styles.TITLE_STYLE);
+    renderStyleClass(context, rc, styles.TITLE_STYLE);
 
     // don't wrap the month and year controls
     writer.writeAttribute("nowrap", Boolean.TRUE, null);
 
     _renderMonthAndYear(context,
-                        arc,
+                        rc,
                         minTime,
                         maxTime,
                         displayedCalendar,
@@ -254,7 +258,7 @@
 
     // render the next button
     _renderNextPrev(context,
-                    arc,
+                    rc,
                     component,
                     bean,
                     false,
@@ -274,22 +278,22 @@
     writer.startElement("table", null);
     //fix for bug 4410632: added summary attribute
     OutputUtils.renderDataTableAttributes(context,
-                                            arc,
+                                            rc,
                                             "0", "0", "0", "100%",
-                        arc.getTranslatedString("af_chooseDate.SUMMARY"));
-    renderStyleClass(context, arc, styles.CONTENT_STYLE);
+                        rc.getTranslatedString("af_chooseDate.SUMMARY"));
+    renderStyleClass(context, rc, styles.CONTENT_STYLE);
 
     //
     // Write the day of the week headers
     //
     writer.startElement("tr", null);
-    renderStyleClass(context, arc, styles.HEADER_STYLE);
+    renderStyleClass(context, rc, styles.HEADER_STYLE);
 
     String[] shortWeekdays;
     // Bug 2388968:  Java's "short" weekdays in Arabic are single
     // letters, which we're told are inadequate.  Output entire
     // names instead.
-    if ("ar".equals(arc.getLocaleContext().getFormattingLocale().getLanguage()))
+    if ("ar".equals(rc.getLocaleContext().getFormattingLocale().getLanguage()))
       shortWeekdays = dateSymbols.getWeekdays();
     else
       shortWeekdays = dateSymbols.getShortWeekdays();
@@ -337,7 +341,7 @@
         // is way too big - unless we render the disabled style class.
         if (isInline)
         {
-          renderStyleClass(context, arc, styles.DISABLED_STYLE);
+          renderStyleClass(context, rc, styles.DISABLED_STYLE);
         }
 
         writer.writeText(String.valueOf(i), null);
@@ -380,7 +384,7 @@
 
         if (isInline && !enabledDay)
         {
-         renderStyleClass(context, arc, styles.DISABLED_STYLE);
+         renderStyleClass(context, rc, styles.DISABLED_STYLE);
         }
 
         boolean selectedDay = false;
@@ -402,7 +406,7 @@
           // a date in the date field. (see bug #1482511)
           //
           writer.startElement("a", null);
-          renderSelectDayAttributes(arc,
+          renderSelectDayAttributes(rc,
                                     context,
                                     keysAndValues,
                                     id,
@@ -416,7 +420,7 @@
         if (selectedDay)
         {
           writer.startElement("span", null);
-          renderStyleClass(context, arc, styles.SELECTED_STYLE);
+          renderStyleClass(context, rc, styles.SELECTED_STYLE);
         }
 
         writer.writeText(String.valueOf(currDOM), null);
@@ -454,7 +458,7 @@
         break;
       }
     } while (true);
-    
+
     // Reset the calendar
     displayedCalendar.set(Calendar.DAY_OF_MONTH, firstDOM);
 
@@ -478,7 +482,7 @@
 
         if (isInline)
         {
-          renderStyleClass(context, arc, styles.DISABLED_STYLE);
+          renderStyleClass(context, rc, styles.DISABLED_STYLE);
         }
 
         writer.writeText(String.valueOf(i), null);
@@ -497,22 +501,22 @@
 
 
   protected void renderSelectDayAttributes(
-    RenderingContext arc,
-    FacesContext context,
-    String[] keysAndValues,
-    String id,
-    long currTime,
-    int baseTZOffsetMinutes,
-    boolean isInline,
-    boolean isDesktop,
-    String destString
+    RenderingContext rc,
+    FacesContext     context,
+    String[]         keysAndValues,
+    String           id,
+    long             currTime,
+    int              baseTZOffsetMinutes,
+    boolean          isInline,
+    boolean          isDesktop,
+    String           destString
     ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
-    
+
     if (isDesktop)
     {
-      TimeZone tz = arc.getLocaleContext().getTimeZone();
+      TimeZone tz = rc.getLocaleContext().getTimeZone();
       int tzOffsetMinutes = tz.getOffset(currTime)/(1000*60);
 
       StringBuilder clickRef = new StringBuilder(30);
@@ -559,8 +563,8 @@
    * Render the next and previous buttons of the calendar dialog.
    */
   protected void renderNextPrev(
-    FacesContext        context,
-    RenderingContext arc,
+    FacesContext     context,
+    RenderingContext rc,
     UIComponent      component,
     FacesBean        bean,
     boolean          isPrev,
@@ -571,11 +575,11 @@
     String           onClick
     ) throws IOException
   {
-    CalendarStyles styles = _getCalendarStyles(bean);
+    CalendarStyles styles = _getCalendarStyles(component, bean);
 
     ResponseWriter writer = context.getResponseWriter();
     writer.startElement("td", null);
-    renderStyleClass(context, arc, styles.NAV_STYLE);
+    renderStyleClass(context, rc, styles.NAV_STYLE);
 
     writer.writeAttribute("align", halign, null);
 
@@ -587,7 +591,7 @@
     }
 
     String iconName;
-    if(isInline(bean))
+    if(isInline(component, bean))
     {
       if (isPrev)
       {
@@ -618,13 +622,13 @@
       }
     }
 
-    Icon icon = arc.getIcon(iconName);
+    Icon icon = rc.getIcon(iconName);
 
     // If we've got an Icon, render it
     if (icon != null)
     {
       OutputUtils.renderIcon(context,
-                             arc,
+                             rc,
                              icon,
                              altText,
                              null);
@@ -638,7 +642,9 @@
     writer.endElement("td");
   }
 
-  protected String getDestination(FacesBean bean)
+  protected String getDestination(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_destinationKey));
   }
@@ -646,24 +652,26 @@
   /**
    * Tests whether the calendar is running in "inline" mode.
    */
-  protected boolean isInline(FacesBean bean)
+  protected boolean isInline(
+    UIComponent component,
+    FacesBean   bean)
   {
     // For now, we assume that a null destination means that
     // we are running in inline mode, since CalendarDialogJSP *always*
     // sets the destination.  Perhaps it would be safer if we
     // didn't make this assumption but instead used some explicit
     // attribute which indicates the mode.
-    return (getDestination(bean) == null);
+    return (getDestination(component, bean) == null);
   }
 
   /**
    * Render the next and previous buttons of the calendar dialog.
    */
   private void _renderNextPrev(
-    FacesContext        context,
-    RenderingContext arc,
-    UIComponent         component,
-    FacesBean           bean,
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean,
     boolean          isPrev,
     long             compareTime,
     long             buttonTime,
@@ -682,7 +690,7 @@
       // move to the last day in the previous month
       buttonTime -= _MILLIS_IN_DAY;
 
-      iconDesc = arc.getTranslatedString("af_chooseDate.PREVIOUS_MONTH_TIP");
+      iconDesc = rc.getTranslatedString("af_chooseDate.PREVIOUS_MONTH_TIP");
       halign   = "left";
     }
     else
@@ -692,7 +700,7 @@
       // move to the first day in the next month
       buttonTime += _MILLIS_IN_DAY;
 
-      iconDesc = arc.getTranslatedString("af_chooseDate.NEXT_MONTH_TIP");
+      iconDesc = rc.getTranslatedString("af_chooseDate.NEXT_MONTH_TIP");
       halign   = "right";
     }
 
@@ -713,7 +721,7 @@
     }
 
     renderNextPrev( context,
-                    arc,
+                    rc,
                     component,
                     bean,
                     isPrev,
@@ -725,13 +733,11 @@
 
   }
 
-
-
   /**
    * Creates the base navigation URL
    */
   private String _createNavURL(
-    RenderingContext arc,
+    RenderingContext rc,
     String           destinationString,
     long             minTime,
     long             maxTime,
@@ -742,7 +748,7 @@
     StringBuffer buffer = new StringBuffer();
 
 
-    String[] params = _createNavURLParams( arc,
+    String[] params = _createNavURLParams( rc,
                                            minTime,
                                            maxTime,
                                            selectedTime,
@@ -753,16 +759,15 @@
     return buffer.toString();
   }
 
-
   /**
    * Creates the params for navigation URL
    */
   private String[] _createNavURLParams(
-    RenderingContext  arc,
-    long                 minTime,
-    long                 maxTime,
-    long                 selectedTime,
-    String               id
+    RenderingContext rc,
+    long             minTime,
+    long             maxTime,
+    long             selectedTime,
+    String           id
     )
   {
     return new String[] {
@@ -775,13 +780,10 @@
       XhtmlConstants.VALUE_PARAM,
       String.valueOf(selectedTime),
       LOC_PARAM,
-      arc.getLocaleContext().getFormattingIANALocaleString()
+      rc.getLocaleContext().getFormattingIANALocaleString()
     };
   }
 
-
-
-
   /**
    * Returns the change handler to use for the choices
    */
@@ -805,22 +807,21 @@
     return buffer.toString();
   }
 
-
   private void _renderMonthChoice(
-    FacesContext        context,
-    RenderingContext arc,
-    String[]          months,
-    Calendar          currentTime,
-    int               visibleMonth,
-    int               minimumMonth,
-    int               maximumMonth,
-    long              offset,
-    String            onChange,
-    String            baseId
+    FacesContext     context,
+    RenderingContext rc,
+    String[]         months,
+    Calendar         currentTime,
+    int              visibleMonth,
+    int              minimumMonth,
+    int              maximumMonth,
+    long             offset,
+    String           onChange,
+    String           baseId
     ) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
-    String label = arc.getTranslatedString("af_chooseDate.MONTH_CHOICE_LABEL");
+    String label = rc.getTranslatedString("af_chooseDate.MONTH_CHOICE_LABEL");
     String id = MONTH_PARAM;
 
     // If we've got a baseID, tack it on.  This is necessary
@@ -839,7 +840,7 @@
     writer.writeAttribute("title", label, null);
     writer.writeAttribute("onchange", onChange, null);
     renderStyleClass(context,
-                     arc,
+                     rc,
                      SkinSelectors.AF_FIELD_TEXT_STYLE_CLASS);
 
     for (int currMonth = minimumMonth; currMonth <= maximumMonth; currMonth++)
@@ -868,7 +869,7 @@
     writer.endElement("select");
 
     HiddenLabelUtils.outputHiddenLabelIfNeeded(context,
-                                               arc,
+                                               rc,
                                                id,
                                                label,
                                                null);
@@ -876,8 +877,8 @@
 
 
   private void _renderYearChoice(
-    FacesContext        context,
-    RenderingContext arc,
+    FacesContext     context,
+    RenderingContext rc,
     Calendar         currentTime,
     int              year,
     int              minimumYear,
@@ -886,7 +887,7 @@
     String           baseId
     ) throws IOException
   {
-    String label = arc.getTranslatedString("af_chooseDate.YEAR_CHOICE_LABEL");
+    String label = rc.getTranslatedString("af_chooseDate.YEAR_CHOICE_LABEL");
     String id = YEAR_PARAM;
 
     // If we've got a baseID, tack it on.  This is necessary
@@ -904,7 +905,7 @@
     writer.writeAttribute("title", label, null);
     writer.writeAttribute("onchange", onChange, null);
     renderStyleClass(context,
-                     arc,
+                     rc,
                      SkinSelectors.AF_FIELD_TEXT_STYLE_CLASS);
 
     boolean needsPrevItem = false;
@@ -962,7 +963,7 @@
                        currentTime,
                        minimumYear - 1,
                        year,
-                       _getBeforeFormat(arc).format(
+                       _getBeforeFormat(rc).format(
                           new String[]{String.valueOf(minimumYear)}));
     }
 
@@ -985,14 +986,14 @@
                        currentTime,
                        maximumYear + 1,
                        year,
-                       _getAfterFormat(arc).format(
+                       _getAfterFormat(rc).format(
                               new String[]{String.valueOf(maximumYear)}));
     }
 
     writer.endElement("select");
 
     HiddenLabelUtils.outputHiddenLabelIfNeeded(context,
-                                               arc,
+                                               rc,
                                                id,
                                                label,
                                                null);
@@ -1005,12 +1006,11 @@
    */
   private void _writeYearOption(
     ResponseWriter writer,
-    Calendar     currentTime,
-    int          year,
-    int          selectedYear,
-    String       text
-    )
-    throws IOException
+    Calendar       currentTime,
+    int            year,
+    int            selectedYear,
+    String         text
+    ) throws IOException
   {
     writer.startElement("option", null);
 
@@ -1031,15 +1031,12 @@
     writer.endElement("option");
   }
 
-
-
-
   /**
    * Renders the month and year portion of the Calendar
    */
   private void _renderMonthAndYear(
-    FacesContext        context,
-    RenderingContext arc,
+    FacesContext      context,
+    RenderingContext  rc,
     long              minTime,
     long              maxTime,
     Calendar          displayedCalendar,
@@ -1050,8 +1047,8 @@
     ) throws IOException
   {
     String jsNavURL = _escapeJSURL(context, baseNavURL);
-    Calendar minCalendar = _getCalendar(arc, minTime);
-    Calendar maxCalendar = _getCalendar(arc, maxTime);
+    Calendar minCalendar = _getCalendar(rc, minTime);
+    Calendar maxCalendar = _getCalendar(rc, maxTime);
 
     int minYear = minCalendar.get(Calendar.YEAR);
     int maxYear = maxCalendar.get(Calendar.YEAR);
@@ -1083,7 +1080,7 @@
       // Initialize the calendar for the current year so that we
       // can compute the month offsets
       //
-      Calendar currentTime = _getCalendar(arc);
+      Calendar currentTime = _getCalendar(rc);
 
       _zeroOutTime(currentTime);
 
@@ -1101,7 +1098,7 @@
       currentTime.set(Calendar.DAY_OF_MONTH, 15);
 
       _renderMonthChoice( context,
-                          arc,
+                          rc,
                           monthNames,
                           currentTime,
                           monthIndex,
@@ -1125,7 +1122,7 @@
       currentTime.set(Calendar.MONTH, monthIndex);
 
       _renderYearChoice( context,
-                         arc,
+                         rc,
                          currentTime,
                          year,
                          minYear,
@@ -1138,7 +1135,7 @@
     else
     {
       // format used for combining months and years
-      FastMessageFormat titleFormat = _getTitleFormat(arc);
+      FastMessageFormat titleFormat = _getTitleFormat(rc);
 
       String monthName = monthNames[monthIndex];
       String yearName = String.valueOf(year);
@@ -1211,13 +1208,13 @@
         if (tzOffset < 0)
         {
           // Cast to (float) has a purpose
-          tzOffset = (long)Math.max((float)tzOffset, 
+          tzOffset = (long)Math.max((float)tzOffset,
                                     (float)Long.MIN_VALUE - (float)dateValueInMs);
         }
         else
         {
           // Cast to (float) has a purpose
-          tzOffset = (long)Math.min((float)tzOffset, 
+          tzOffset = (long)Math.min((float)tzOffset,
                                     (float)Long.MAX_VALUE - (float)dateValueInMs);
         }
 
@@ -1514,9 +1511,11 @@
 
   // Returns the CalendarStyles object to use when
   // rendering the specified calendar component
-  private CalendarStyles _getCalendarStyles(FacesBean bean)
+  private CalendarStyles _getCalendarStyles(
+    UIComponent component,
+    FacesBean   bean)
   {
-    return _getCalendarStyles(isInline(bean));
+    return _getCalendarStyles(isInline(component, bean));
   }
 
   // Gets the calendar styles for the specified mode
@@ -1584,7 +1583,7 @@
   // Rendering Context cache keys
   //
   private static final Object _DATE_SYMBOLS_KEY = new Object();
-  
+
   static
   {
     // =-= bts

Modified: myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnGroupRenderer.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/ColumnGroupRenderer.java (original)
+++ myfaces/trinidad/branches/ar_clientBehaviors/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnGroupRenderer.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.ArrayList;
 import java.util.List;
 
@@ -30,17 +31,18 @@
 import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.component.UIXCollection;
 import org.apache.myfaces.trinidad.component.core.data.CoreColumn;
+import org.apache.myfaces.trinidad.context.FormData;
+import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.model.SortCriterion;
+import org.apache.myfaces.trinidad.skin.Icon;
+import org.apache.myfaces.trinidad.util.IntegerUtils;
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
-import org.apache.myfaces.trinidad.context.FormData;
-import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.CellUtils;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.ColumnData;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.RenderStage;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableRenderingContext;
-import org.apache.myfaces.trinidad.skin.Icon;
-import org.apache.myfaces.trinidad.util.IntegerUtils;
+
 
 /**
  * @todo Kill the now-strange "compute mode", since we can
@@ -61,7 +63,8 @@
   }
 
   @Override
-  protected void findTypeConstants(FacesBean.Type type)
+  protected void findTypeConstants(
+    FacesBean.Type type)
   {
     super.findTypeConstants(type);
     _headerTextKey = type.findKey("headerText");
@@ -82,12 +85,16 @@
     return true;
   }
 
-  protected String getHeaderText(FacesBean bean)
+  protected String getHeaderText(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_headerTextKey));
   }
 
-  protected boolean getHeaderNoWrap(FacesBean bean)
+  protected boolean getHeaderNoWrap(
+    UIComponent component,
+    FacesBean   bean)
   {
     Object o = bean.getProperty(_headerNoWrapKey);
     if (o == null)
@@ -96,7 +103,9 @@
     return Boolean.TRUE.equals(o);
   }
 
-  protected boolean getNoWrap(FacesBean bean)
+  protected boolean getNoWrap(
+    UIComponent component,
+    FacesBean   bean)
   {
     Object o = bean.getProperty(_noWrapKey);
     if (o == null)
@@ -105,8 +114,9 @@
     return Boolean.TRUE.equals(o);
   }
 
-
-  protected boolean getRowHeader(FacesBean bean)
+  protected boolean getRowHeader(
+    UIComponent component,
+    FacesBean   bean)
   {
     Object o = bean.getProperty(_rowHeaderKey);
     if (o == null)
@@ -115,8 +125,9 @@
     return Boolean.TRUE.equals(o);
   }
 
-
-  protected boolean getSeparateRows(FacesBean bean)
+  protected boolean getSeparateRows(
+    UIComponent component,
+    FacesBean   bean)
   {
     Object o = bean.getProperty(_separateRowsKey);
     if (o == null)
@@ -125,18 +136,23 @@
     return Boolean.TRUE.equals(o);
   }
 
-  protected String getWidth(FacesBean bean)
+  protected String getWidth(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_widthKey));
   }
 
-  protected String getFormatType(FacesBean bean)
+  protected String getFormatType(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_alignKey));
   }
 
-
-  protected boolean getSortable(FacesBean bean)
+  protected boolean getSortable(
+    UIComponent component,
+    FacesBean   bean)
   {
     Object o = bean.getProperty(_sortableKey);
     if (o == null)
@@ -145,13 +161,16 @@
     return !Boolean.FALSE.equals(o);
   }
 
-
-  protected String getSortProperty(FacesBean bean)
+  protected String getSortProperty(
+    UIComponent component,
+    FacesBean   bean)
   {
     return toString(bean.getProperty(_sortPropertyKey));
   }
 
-  protected String getDefaultSortOrder(FacesBean bean)
+  protected String getDefaultSortOrder(
+    UIComponent component,
+    FacesBean   bean)
   {
     if (_defaultSortOrderKey == null)
       return null;
@@ -159,8 +178,8 @@
     return toString(bean.getProperty(_defaultSortOrderKey));
   }
 
-
-  static public String getDefaultHeaderStyleClass(TableRenderingContext tContext)
+  static public String getDefaultHeaderStyleClass(
+    TableRenderingContext tContext)
   {
     return ColumnData.selectFormat(tContext,
                                    SkinSelectors.AF_COLUMN_HEADER_TEXT_STYLE,
@@ -175,7 +194,8 @@
    * left-aligned for text, right-aligned for numbers and center-aligned
    * for icons.
    */
-  protected String getHeaderStyleClass(TableRenderingContext tContext)
+  protected String getHeaderStyleClass(
+    TableRenderingContext tContext)
   {
     return getDefaultHeaderStyleClass(tContext);
   }
@@ -185,10 +205,11 @@
    */
   @Override
   protected void encodeAll(
-    FacesContext        context,
-    RenderingContext arc,
-    UIComponent         component,
-    FacesBean           bean) throws IOException
+    FacesContext     context,
+    RenderingContext rc,
+    UIComponent      component,
+    FacesBean        bean
+    ) throws IOException
   {
     TableRenderingContext tContext =
       TableRenderingContext.getCurrentInstance();
@@ -201,7 +222,7 @@
       _computeMode(context, tContext, component);
       break;
     case RenderStage.COLUMN_HEADER_STAGE:
-      _renderHeaderMode(context, arc, tContext, component);
+      _renderHeaderMode(context, rc, tContext, component);
       break;
     // For these stages, simply render the children; we
     // need no special processing at the column group level
@@ -220,10 +241,11 @@
   }
 
   private void _renderHeaderMode(
-    FacesContext        context,
-    RenderingContext arc,
+    FacesContext          context,
+    RenderingContext      rc,
     TableRenderingContext tContext,
-    UIComponent           column) throws IOException
+    UIComponent           column
+    ) throws IOException
   {
     final NodeData parentNode = getParentNode(tContext);
     final boolean areWeRoot;
@@ -255,7 +277,7 @@
       // which row our children will start rendering:
       currentNode.waitUntilRow = rowSpan + row;
 
-      String headerID = _renderColumnHeader(context, arc, tContext, column,
+      String headerID = _renderColumnHeader(context, rc, tContext, column,
                                             rowSpan, currentNode.cols);
       if (headerID != null)
       {
@@ -295,17 +317,17 @@
    */
   private String _renderColumnHeader(
     FacesContext          context,
-    RenderingContext   arc,
+    RenderingContext      rc,
     TableRenderingContext tContext,
     UIComponent           column,
     int                   rowSpan,
-    int                   colSpan)
-    throws IOException
+    int                   colSpan
+    ) throws IOException
   {
     ColumnData colData = tContext.getColumnData();
 
     // only no-wrap header cells if specified
-    boolean isNoWrap = getHeaderNoWrap(getFacesBean(column));
+    boolean isNoWrap = getHeaderNoWrap(column, getFacesBean(column));
 
     // indicate to the headerNode that it is a column group header
     colData.setColumnGroupHeader(true);
@@ -313,7 +335,7 @@
     colData.setCurrentHeaderNoWrap(isNoWrap);
 
     final String colID =
-      renderHeaderAndSpan(context, arc, tContext, column,
+      renderHeaderAndSpan(context, rc, tContext, column,
                           rowSpan, colSpan);
     colData.setColumnGroupHeader(false);
     colData.setCurrentHeaderNoWrap(false);
@@ -342,12 +364,12 @@
    */
   protected final String renderHeaderAndSpan(
     FacesContext          context,
-    RenderingContext   arc,
+    RenderingContext      rc,
     TableRenderingContext tContext,
     UIComponent           column,
     int                   rowSpan,
-    int                   colSpan)
-    throws IOException
+    int                   colSpan
+    ) throws IOException
   {
     ColumnData colData = tContext.getColumnData();
     String colID;
@@ -362,8 +384,8 @@
     int physicalIndex = colData.getPhysicalColumnIndex();
     int sortability = getSortability(tContext, column);
     boolean sortable = (sortability != SORT_NO) &&
-                       supportsNavigation(arc);
-                       
+                       supportsNavigation(rc);
+
     if(sortable)
     {
       // the sortable script has a "state" parameter, so add this
@@ -371,18 +393,18 @@
       // generation of elements (on those that do, form data elements
       // can be created on the fly as necessary); see the JS
       // referenced in this.getSortingOnclick
-      Object domLevel = 
-        arc.getAgent().getCapabilities().get(TrinidadAgent.CAP_DOM);
+      Object domLevel =
+        rc.getAgent().getCapabilities().get(TrinidadAgent.CAP_DOM);
       if(
-        domLevel == null || 
-        domLevel == TrinidadAgent.DOM_CAP_NONE || 
+        domLevel == null ||
+        domLevel == TrinidadAgent.DOM_CAP_NONE ||
         domLevel == TrinidadAgent.DOM_CAP_FORM)
       {
-        FormData formData = arc.getFormData();
+        FormData formData = rc.getFormData();
         if(formData != null)
         {
           formData.addNeededValue(XhtmlConstants.STATE_PARAM);
-        }      
+        }
       }
     }
 
@@ -397,14 +419,14 @@
 
 
     String sortIconName = _getIconName(sortability);
-    Icon sortIcon = arc.getIcon(sortIconName);
+    Icon sortIcon = rc.getIcon(sortIconName);
     boolean hasSortingIcon = (sortIcon != null) && !sortIcon.isNull();
 
     // we do not want to wrap if there is an icon on the header:
     // On PDA, where screen width is limited, we cannot afford not to
     // wrap.  isPDA check is used in several places in this class.
     // PDA specific logic will be moved to PDA render kit in the future.
-    if (!isPDA(arc))
+    if (!isPDA(rc))
     {
       isNoWrap = isNoWrap || hasSortingIcon;
     }
@@ -426,15 +448,15 @@
     String styleClass = getSortableHeaderStyleClass(tContext, sortability);
     String borderStyleClass =
       CellUtils.getHeaderBorderStyle(tContext,
-                                     arc,
+                                     rc,
                                      true, //isColHeader
                                      sortable);
 
-    renderStyleClasses(context, arc, new String[]{ styleClass,
+    renderStyleClasses(context, rc, new String[]{ styleClass,
                                                    borderStyleClass});
 
-    String style = getHeaderInlineStyle(arc);
-    renderInlineStyleAttribute(context, arc, style);
+    String style = getHeaderInlineStyle(rc);
+    renderInlineStyleAttribute(context, rc, column, style);
 
     if (colSpan > 1)
       rw.writeAttribute("colspan", IntegerUtils.getString(colSpan), null);
@@ -445,11 +467,11 @@
       rw.writeAttribute("rowspan", IntegerUtils.getString(rowSpan), null);
 
     String sortOnclick = "";
-    if (supportsScripting(arc))
+    if (supportsScripting(rc))
     {
-      sortOnclick = getSortingOnclick(arc, tContext, column, sortability);
+      sortOnclick = getSortingOnclick(rc, tContext, column, sortability);
     }
-     
+
     //=-=AEW Review: Does this need to support any other handlers?
 
     //=-=AEW Apparently in PDA, we don't bother rendering
@@ -459,12 +481,12 @@
     //  be driven off an "event bubbling" agent property.
     // - HKuhn if printable mode (supportScripting is disabled),
     // then no need for rendering onclick
-    if (!isPDA(arc) && supportsScripting(arc))
+    if (!isPDA(rc) && supportsScripting(rc))
       rw.writeAttribute("onclick", sortOnclick, null);
 
     // TODO: we should pass in null for "event bubbling" systems
     renderHeaderContents(context,
-                         arc,
+                         rc,
                          tContext,
                          column,
                          sortability,
@@ -481,7 +503,8 @@
    * @return an inline style String to be rendered on headers (used on
    *  special subclasses)
    */
-  protected String getHeaderInlineStyle(RenderingContext arc)
+  protected String getHeaderInlineStyle(
+    RenderingContext rc)
   {
     return null;
   }
@@ -490,29 +513,29 @@
   /**
    */
   protected String getSortingOnclick(
-    RenderingContext   arc,
+    RenderingContext      rc,
     TableRenderingContext tContext,
     UIComponent           column,
     int                   sortability)
   {
     FacesBean bean = getFacesBean(column);
-    String onclick  = getOnclick(bean);
+    String onclick  = getOnclick(column, bean);
     if (sortability == SORT_NO)
       return onclick;
 
-    if (arc.getFormData() == null)
+    if (rc.getFormData() == null)
     {
       _LOG.warning("SORTING_DISABLED_TABLE_NOT_IN_FORM");
       return onclick;
     }
 
-    String formName = arc.getFormData().getName();
+    String formName = rc.getFormData().getName();
     String source   = tContext.getTableId();
-    String value    = getSortProperty(bean);
+    String value    = getSortProperty(column, bean);
     // Note that "state" refers to the current state, not
     // the state will be set after clicking
-    String state = findSortState(sortability, bean);
-    
+    String state = findSortState(sortability, column, bean);
+
     StringBuffer buffer = new StringBuffer(33+
                                            formName.length() +
                                            source.length() +
@@ -543,12 +566,13 @@
 
   protected void renderHeaderContents(
     FacesContext          context,
-    RenderingContext   arc,
+    RenderingContext      rc,
     TableRenderingContext tContext,
     UIComponent           column,
     int                   sortability,
     Icon                  sortIcon,
-    String                sortOnclick) throws IOException
+    String                sortOnclick
+    ) throws IOException
   {
     ResponseWriter rw = context.getResponseWriter();
     UIComponent header = getFacet(column, CoreColumn.HEADER_FACET);
@@ -558,43 +582,42 @@
     }
     else
     {
-      String headerText = getHeaderText(getFacesBean(column));
+      String headerText = getHeaderText(column, getFacesBean(column));
       if (headerText != null)
         rw.writeText(headerText, "headerText");
     }
 
-     renderSortOrderSymbol(context, arc, column, tContext,
+     renderSortOrderSymbol(context, rc, column, tContext,
                                     sortability, sortIcon, sortOnclick);
-    
+
   }
-  
-  
+
   /**
    * @todo IMPLEMENT
    */
   protected void renderSortOrderSymbol(
-    FacesContext       context,
-    RenderingContext arc,
+    FacesContext          context,
+    RenderingContext      rc,
     UIComponent           column,
     TableRenderingContext tContext,
-    int                 sortability,
-    Icon                icon,
-    String              sortOnclick
+    int                   sortability,
+    Icon                  icon,
+    String                sortOnclick
     ) throws IOException
   {
     if ((icon == null) || icon.isNull())
       return;
 
     ResponseWriter writer = context.getResponseWriter();
-    boolean supportNav = supportsNavigation(arc);
+    boolean supportNav = supportsNavigation(rc);
     boolean NonJavaScriptBrowser = false;
     boolean renderedInput = false;
     if (supportNav)
     {
-      if (isPDA(arc))
+      if (isPDA(rc))
         writer.writeText(XhtmlConstants.NBSP_STRING, null);
-        
-      NonJavaScriptBrowser = !supportsScripting(arc);  
+
+      NonJavaScriptBrowser = !supportsScripting(rc);
       if (NonJavaScriptBrowser)
       {
         renderedInput = true;
@@ -602,8 +625,8 @@
         writer.writeAttribute("type", "submit", null);
         String source = tContext.getTableId();
         FacesBean bean = getFacesBean(column);
-        String value = getSortProperty(bean);
-        String state = findSortState(sortability, bean);
+        String value = getSortProperty(column, bean);
+        String state = findSortState(sortability, column, bean);
         String nameAttri;
         if (state != "")
         {
@@ -639,15 +662,15 @@
         if (state.equals(XhtmlConstants.SORTABLE_ASCENDING))
         {
           writer.writeAttribute("value",
-                                    XhtmlConstants.NON_JS_DESC_ICON, null); 
+                                    XhtmlConstants.NON_JS_DESC_ICON, null);
         }
         else
         {
-          writer.writeAttribute("value", 
-                                    XhtmlConstants.NON_JS_ASC_ICON, null); 
+          writer.writeAttribute("value",
+                                    XhtmlConstants.NON_JS_ASC_ICON, null);
         }
 
-        writer.writeAttribute("class", 
+        writer.writeAttribute("class",
              SkinSelectors.SORTABLE_HEADER_SORT_ICON_STYLE_CLASS, null);
       }
       else
@@ -673,10 +696,10 @@
     }
 
 
-    String altText = arc.getTranslatedString(altTextKey);
+    String altText = rc.getTranslatedString(altTextKey);
+
+    Object align = OutputUtils.getMiddleIconAlignment(rc);
 
-    Object align = OutputUtils.getMiddleIconAlignment(arc);
-    
     //Don't render any child element for input element
     if (!renderedInput)
     {
@@ -684,7 +707,7 @@
       // allows text-based Icons to render their style class
       // and altText directly on the anchor itself
       OutputUtils.renderIcon(context,
-                             arc,
+                             rc,
                              icon,
                              altText,
                              align,
@@ -727,13 +750,13 @@
       return 0;
 
     // If there's no sort property, it's not sortable
-    String property = getSortProperty(bean);
+    String property = getSortProperty(column, bean);
     if (property == null)
       return SORT_NO;
 
     // And if the renderer-specific "sortable" property is set to false,
     // it's not sortable
-    if (!getSortable(bean))
+    if (!getSortable(column, bean))
       return SORT_NO;
 
     // Otherwise, look at the first sort criteria
@@ -754,8 +777,8 @@
   }
 
   protected boolean hasSortingIcon(
-    RenderingContext arc,
-    int                 sortability)
+    RenderingContext rc,
+    int              sortability)
   {
     return sortability != SORT_NO;
   }
@@ -763,7 +786,8 @@
   /**
    * gets the icon name to use
    */
-  private String _getIconName(int sortable)
+  private String _getIconName(
+    int sortable)
   {
     switch (sortable)
     {
@@ -779,9 +803,10 @@
   }
 
   private void _computeMode(
-    FacesContext        context,
+    FacesContext          context,
     TableRenderingContext tContext,
-    UIComponent           component) throws IOException
+    UIComponent           component
+    ) throws IOException
   {
     // since we use colSpan we need headers attributes on all the table's data
     // cells:
@@ -825,10 +850,11 @@
   }
 
   @SuppressWarnings("unchecked")
-  private void _renderChildren(FacesContext context,
-                               UIComponent  component,
-                               NodeData     parentNode)
-    throws IOException
+  private void _renderChildren(
+    FacesContext context,
+    UIComponent  component,
+    NodeData     parentNode
+    ) throws IOException
   {
     int i = 0;
     for(UIComponent child : (List<UIComponent>)component.getChildren())
@@ -840,22 +866,24 @@
         {
           parentNode.currentChild = i;
         }
-        
+
         encodeChild(context, child);
       }
-      
+
       i++;
     }
   }
 
-  protected final NodeData getParentNode(TableRenderingContext tContext)
+  protected final NodeData getParentNode(
+    TableRenderingContext tContext)
   {
     NodeList nl = _getNodeList(tContext, false);
     return (nl == null) ? null : nl.currentNode;
   }
 
-  private void _setParentNode(TableRenderingContext tContext,
-                              NodeData parentNode)
+  private void _setParentNode(
+    TableRenderingContext tContext,
+    NodeData              parentNode)
   {
     _getNodeList(tContext, true).currentNode = parentNode;
   }
@@ -867,8 +895,9 @@
    * @param sortability the value returned by getSortability()
    * @return the skinning selector for the header
    */
-  protected String getSortableHeaderStyleClass(TableRenderingContext tContext,
-                                      int sortability)
+  protected String getSortableHeaderStyleClass(
+    TableRenderingContext tContext,
+    int                   sortability)
   {
     ColumnData colData = tContext.getColumnData();
     // if we are a columnGroup header, then we must be centered:
@@ -899,8 +928,9 @@
     }
   }
 
-  private NodeList _getNodeList(TableRenderingContext tContext,
-                                boolean create)
+  private NodeList _getNodeList(
+    TableRenderingContext tContext,
+    boolean               create)
   {
     NodeList root =
       (NodeList) tContext.getHeaderNodesList();
@@ -970,13 +1000,14 @@
       return _kids[index];
     }
   }
-  
+
   /**
-   * @return the state of the sorting after the page submition 
+   * @return the state of the sorting after the page submition
    */
   private String findSortState(
-     int sortability, 
-     FacesBean bean )
+    int         sortability,
+    UIComponent component,
+    FacesBean   bean)
   {
     String state;
     if (sortability == SORT_ASCENDING)
@@ -987,7 +1018,7 @@
     {
       state = XhtmlConstants.SORTABLE_DESCENDING;
     }
-    else if ("descending".equals(getDefaultSortOrder(bean)))
+    else if ("descending".equals(getDefaultSortOrder(component, bean)))
     {
       state = XhtmlConstants.SORTABLE_ASCENDING;
     }
@@ -995,7 +1026,7 @@
     {
       state = "";
     }
-    
+
     return state;
   }
 



Mime
View raw message