myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mutha...@apache.org
Subject svn commit: r883182 - in /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: renderkit/core/xhtml/ ui/laf/base/pda/ ui/laf/base/xhtml/
Date Sun, 22 Nov 2009 23:19:27 GMT
Author: muthaman
Date: Sun Nov 22 23:19:26 2009
New Revision: 883182

URL: http://svn.apache.org/viewvc?rev=883182&view=rev
Log:
TRINIDAD-1616 - NOKIA S60 NOT SUPPORTING <TR:NAVIGATIONPANE>
TRINIDAD-1617 - In mobile browsers, PPR is not supported in <TR:PANELTABBED>
TRINIDAD-1619 - Width attribute of <tr:column> is not working

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PanelTabbedRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PdaHtmlLafUtils.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/ShowItemRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ShowItemRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java?rev=883182&r1=883181&r2=883182&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java
Sun Nov 22 23:19:26 2009
@@ -318,7 +318,27 @@
     FacesBean bean = getFacesBean(column);
     String userStyleClass = getStyleClass(bean);
     String userInlineStyle = getInlineStyle(bean);
-
+    
+    // Currently, a column's width is rendered in the column's header (<TH>).
+    // In cases where all columns of a table have empty headersTexts, no 
+    // column header is rendered. Hence, a column's width is not supported
+    // in the aforementioned case.
+    // To fix this problem, lets render the column's width in the  
+    // column's data-element (<TD>) that is in the first row.
+    Object width = tContext.getColumnWidth(physicalIndex);
+    
+    if ((!tContext.hasColumnHeaders()) && (width!= null))
+    {
+      int row = tContext.getRowData().getRangeIndex();
+      
+      // Find the data element in the first row. Also, if there are 
+      // subrows, it enough to render the width for the first subrow 
+      if ((row == 0) && (kidIndex < 1))
+      {
+        writer.writeAttribute("width", width, null);
+      }
+    }
+    
     renderStyleClasses(context, arc, new String[]{userStyleClass, cellClass, borderStyleClass});
 
     writer.writeAttribute("style", userInlineStyle, null);

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java?rev=883182&r1=883181&r2=883182&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java
Sun Nov 22 23:19:26 2009
@@ -882,7 +882,8 @@
       
       // 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)
+      // NokiaS60 has a webkit based browser
+      if (arc.getAgent().getAgentName() == Agent.AGENT_WEBKIT || isNokiaS60(arc))
       {
         appendedStyle = "display: inline-block;";
       }
@@ -1079,7 +1080,8 @@
       
     // 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)
+    // NokiaS60 has a webkit based browser
+    if (arc.getAgent().getAgentName() == Agent.AGENT_WEBKIT || isNokiaS60(arc))
     {
       appendedStyle = "display: inline-block;";
     }
@@ -1355,7 +1357,8 @@
       
     // 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)
+    // NokiaS60 has a webkit based browser
+    if (arc.getAgent().getAgentName() == Agent.AGENT_WEBKIT || isNokiaS60(arc))
     {
       appendedStyle = "display: inline-block;";
     }

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PanelTabbedRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PanelTabbedRenderer.java?rev=883182&r1=883181&r2=883182&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PanelTabbedRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PanelTabbedRenderer.java
Sun Nov 22 23:19:26 2009
@@ -73,6 +73,14 @@
     UINode           node
     ) throws IOException
   {
+    
+    String partialTargets =  
+          (String) context.getProperty(MARLIN_NAMESPACE,
+                     PdaHtmlLafConstants.LINK_CONTAINER_PARTIAL_TARGETS_PROPERTY);
+    
+    if (partialTargets != null)
+      setPartialTargets(context, null);
+    
     ResponseWriter writer = context.getResponseWriter();
     writer.startElement( DIV_ELEMENT, null );
     renderStyleClassAttribute(context,
@@ -83,6 +91,9 @@
       super.renderContent(
              context, node.getIndexedChild(context, selectedChildIndex));
     writer.endElement( DIV_ELEMENT );
+    
+    if (partialTargets != null)
+      setPartialTargets(context, partialTargets);
   }
 
   @Override

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PdaHtmlLafUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PdaHtmlLafUtils.java?rev=883182&r1=883181&r2=883182&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PdaHtmlLafUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/PdaHtmlLafUtils.java
Sun Nov 22 23:19:26 2009
@@ -19,9 +19,13 @@
 package org.apache.myfaces.trinidadinternal.ui.laf.base.pda;
 
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
+import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafRenderer;
+import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafUtils;
 import org.apache.myfaces.trinidadinternal.ui.laf.LookAndFeelManager;
 import org.apache.myfaces.trinidadinternal.ui.laf.NameAndAgentScorer;
-import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafUtils;
+import org.apache.myfaces.trinidadinternal.ui.UINode;
+import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
 
 /**
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/laf/base/pda/PdaHtmlLafUtils.java#0
$) $Date: 10-nov-2005.18:55:02 $
@@ -44,6 +48,37 @@
   {
     manager.registerLookAndFeel(_SCORER, new PdaHtmlLookAndFeel());
   }
+  
+  /**
+   * This method returns the partial targets associated with the specified node
+   * @param context the rendering context
+   * @param node the current UINode
+   * @param id the component's id
+   */
+  public static String[] getPartialTargets(
+    UIXRenderingContext context,
+    UINode           node,
+    Object           id
+    ) 
+  {  
+    // Make sure partial page rendering is supported
+    if (!XhtmlLafRenderer.supportsPartialRendering(context))
+      return null;
+
+    if (!PartialPageUtils.isPPRActive(context.getFacesContext()))
+      return null;
+
+    // If the ID is null, get the ID from the node
+    if (id == null)
+      id = node.getAttributeValue(context, ID_ATTR);
+
+    // If we don't have an ID, we don't have any targets
+    if (id == null)
+      return null;
+
+    // We're all set... Use the node's ID as the partial target
+    return new String[] { id.toString() };
+  }
 
   private static final NameAndAgentScorer _SCORER =
     new NameAndAgentScorer(null,

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/ShowItemRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/ShowItemRenderer.java?rev=883182&r1=883181&r2=883182&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/ShowItemRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/ShowItemRenderer.java
Sun Nov 22 23:19:26 2009
@@ -25,8 +25,10 @@
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
 import org.apache.myfaces.trinidadinternal.share.url.URLEncoder;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.BaseLafUtils;
+import org.apache.myfaces.trinidadinternal.ui.laf.base.desktop.SubTabBarUtils;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.FormValueRenderer;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.LinkUtils;
+import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafUtils;
 import org.apache.myfaces.trinidadinternal.ui.UINode;
 import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
 
@@ -57,33 +59,38 @@
     UINode           node
     )
   {
-    /*String partialTargets = getAncestorPartialTargets(context);
-
-    if (partialTargets == null)
-      return null;
-    */
-
-    URLEncoder encoder = context.getURLEncoder();
-    //String partialTargetsKey = encoder.encodeParameter(PARTIAL_TARGETS_PARAM);
-    String eventParamKey = encoder.encodeParameter(EVENT_PARAM);
-    String sourceParamKey = encoder.encodeParameter(SOURCE_PARAM);
-    String sourceParam = BaseLafUtils.getStringAttributeValue(
-      context, node, ID_ATTR);
-
-    //PH: using getFormName returns null for panelTabbed because formSubmitted
-    //attribute  is 'null'. Use getParentFormName instead to submit to the
-    //containing form.
+    String partialTargets = getAncestorPartialTargets(context);
+    String sourceParam = BaseLafUtils.getStringAttributeValue(context,
+                                                       node, ID_ATTR);
     String formName = getParentFormName(context);
-
-    String partialChangeScript =
-      "submitForm ('" + formName + "',0,{"+
-      eventParamKey + ":'" + SHOW_EVENT + "'," +
-      sourceParamKey + ":'" + sourceParam + "'});return false";
-
-    //    String partialKey = context.getURLEncoder().encodeParameter(PARTIAL_PARAM);
-    FormValueRenderer.addNeededValue(context, formName, eventParamKey,
-                                      sourceParamKey, null,null);
-
+    
+    // Lets render fullpage submit if PPR is not enabled
+    if (partialTargets == null)
+    {
+      String fullPageSubmitScript = XhtmlLafUtils.
+                                       getFullPageSubmitScript(formName, "0",
+                                                               SHOW_EVENT,
+                                                               sourceParam);
+                                                               
+      FormValueRenderer.addNeededValue(context, formName, EVENT_PARAM,
+                                       SOURCE_PARAM, null,null);
+      return fullPageSubmitScript;                                
+    }
+    
+    String validate = 
+              Boolean.TRUE.equals(SubTabBarUtils.isUnvalidated(context)) ? 
+              "0" : "1"; 
+              
+    String partialChangeScript = XhtmlLafUtils.
+                                getPartialPageSubmitScript(formName,
+                                                           validate,
+                                                           partialTargets,
+                                                           SHOW_EVENT,
+                                                           sourceParam);
+                                                               
+    FormValueRenderer.addNeededValue(context, formName, EVENT_PARAM,
+                                     PARTIAL_TARGETS_PARAM, SOURCE_PARAM,
+                                     PARTIAL_PARAM);
     return partialChangeScript;
   }
 

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ShowItemRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ShowItemRenderer.java?rev=883182&r1=883181&r2=883182&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ShowItemRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ShowItemRenderer.java
Sun Nov 22 23:19:26 2009
@@ -21,10 +21,10 @@
 import java.io.IOException;
 
 import org.apache.myfaces.trinidadinternal.share.url.URLEncoder;
-import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
-import org.apache.myfaces.trinidadinternal.ui.UINode;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.BaseLafUtils;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.desktop.SubTabBarUtils;
+import org.apache.myfaces.trinidadinternal.ui.UINode;
+import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
 
 /**
  * Renderer for ShowItem
@@ -57,32 +57,37 @@
     )
   {
     String partialTargets = getAncestorPartialTargets(context);
-    
-    if (partialTargets == null)
-      return null;
-
-    URLEncoder encoder = context.getURLEncoder();
-    String partialTargetsKey = encoder.encodeParameter(PARTIAL_TARGETS_PARAM);
-    String eventParamKey = encoder.encodeParameter(EVENT_PARAM);
-    String sourceParamKey = encoder.encodeParameter(SOURCE_PARAM);
-    String sourceParam = BaseLafUtils.getStringAttributeValue(
-      context, node, ID_ATTR);
-    
+    String sourceParam = BaseLafUtils.getStringAttributeValue(context,
+                                                        node, ID_ATTR);
     String formName = getParentFormName(context);
+     
+    // Lets render fullpage submit if PPR is not enabled
+    if (partialTargets == null)
+    {
+      String fullPageSubmitScript = XhtmlLafUtils.
+                                        getFullPageSubmitScript(formName, "0",
+                                                                SHOW_EVENT,
+                                                                sourceParam);
 
-    char validate = Boolean.TRUE.equals(SubTabBarUtils.isUnvalidated(context)) ? 
-                      '0' : '1';
-    
-    String partialChangeScript = 
-      "_submitPartialChange('" + formName + "'," + validate + ",{"+
-      partialTargetsKey + ":'" + partialTargets + "'," +
-      eventParamKey + ":'" + SHOW_EVENT + "'," +
-      sourceParamKey + ":'" + sourceParam + "'});return false";
-    
-    String partialKey = context.getURLEncoder().encodeParameter(PARTIAL_PARAM);
-    FormValueRenderer.addNeededValue(context, formName, eventParamKey,
-                                     partialTargetsKey, sourceParamKey, partialKey);
-
+      FormValueRenderer.addNeededValue(context, formName, EVENT_PARAM,
+                                        SOURCE_PARAM, null,null);
+      return fullPageSubmitScript;
+    }
+     
+    String validate = 
+              Boolean.TRUE.equals(SubTabBarUtils.isUnvalidated(context)) ? 
+               "0" : "1"; 
+   
+    String partialChangeScript = XhtmlLafUtils.
+                                   getPartialPageSubmitScript(formName,
+                                                              validate,
+                                                              partialTargets,
+                                                              SHOW_EVENT,
+                                                              sourceParam);
+                                                               
+    FormValueRenderer.addNeededValue(context, formName, EVENT_PARAM,
+                                     PARTIAL_TARGETS_PARAM, SOURCE_PARAM,
+                                     PARTIAL_PARAM);
     return partialChangeScript;
   }
 }

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java?rev=883182&r1=883181&r2=883182&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafUtils.java
Sun Nov 22 23:19:26 2009
@@ -1007,7 +1007,47 @@
     Object readOnly = node.getAttributeValue(context, READ_ONLY_ATTR);
     return Boolean.TRUE.equals(readOnly);
   }
+  
+  /**
+   * This method returns a script for submitting a PPR request.
+   * @param formName the form name
+   * @param validate indicates whether to validate the form during PPR
+   * @param partialTargets the components to be refreshed during PPR
+   * @param event represents the event created by the component requesting PPR
+   * @param sourceParam id of the the component requesting PPR
+   */
+  public static String getPartialPageSubmitScript
+                               (String formName,
+                                String validate, 
+                                String partialTargets, 
+                                String event,
+                                String sourceParam)
+  {
+    return "_submitPartialChange('" + formName + "'," + validate + ",{"+
+                 PARTIAL_TARGETS_PARAM + ":'" + partialTargets + "'," +
+                 EVENT_PARAM + ":'" + event + "'," +
+                 SOURCE_PARAM + ":'" + sourceParam + "'});return false"; 
+  }
 
+  
+  /**
+   * This method returns a script for submitting the page.
+   * @param formName the form name
+   * @param validate indicates whether to validate the form
+   * @param event represents the event created by the submitting component
+   * @param sourceParam id of the the submitting component
+   */
+  public static String getFullPageSubmitScript
+                               (String formName,
+                                String validate, 
+                                String event,
+                                String sourceParam)
+  {
+    return "submitForm ('" + formName + "'," + validate + ",{"+
+            EVENT_PARAM + ":'" + SHOW_EVENT + "'," +
+            SOURCE_PARAM + ":'" + sourceParam + "'});return false";
+  }
+  
   // This utility method is used to strip /**/ style comments out of
   // JavaScript code.  We strip comments out of scripts that are
   // included in the partial page response, since we actually comment



Mime
View raw message