myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r819086 - in /myfaces/trinidad/trunk/trinidad-impl/src/main: java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/ java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ resources/META-INF/adf/styles/ resources/META-INF/agent/
Date Sat, 26 Sep 2009 01:44:16 GMT
Author: jwaldman
Date: Sat Sep 26 01:44:15 2009
New Revision: 819086

URL: http://svn.apache.org/viewvc?rev=819086&view=rev
Log:
TRINIDAD-1551  BlackBerry browsers not supporting labelWidth or fieldWidth attribute of <tr:panelFormLayout>,
changed PanelFormLayoutRenderer
TRINIDAD-1552 In Blackberry browsers, command buttons in <tr:panelGroupLayout> overlap,
changed minimal-pda.xss and blackberry9000.xml
TRINIDAD-1553 Mobile browsers not supporting inlineStyle attribute of <tr:navigatioPane>,
changed PdaNavigationPaneRenderer
TRINIDAD-1554 BlackBerry browsers incorrectly handles accessKey attribute of <tr:outputLabel>,
changed OutputLabelRenderer
TRINIDAD-1555 In mobile browsers, children of <tr:commandLink are not rendered,  changed
PdaCommandLinkRenderer

Thanks for the patch Mamallan Uthaman.

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaNavigationPaneRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelFormLayoutRenderer.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/minimal-pda.xss
    myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/agent/blackberry9000.xml

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java?rev=819086&r1=819085&r2=819086&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaCommandLinkRenderer.java
Sat Sep 26 01:44:15 2009
@@ -65,6 +65,7 @@
     if (supportsScripting(arc))
     {
       encodeBegin(context, arc, component, bean);
+      encodeAllChildren(context, component);
       encodeEnd(context, arc, component, bean);
       return;
     }
@@ -122,9 +123,13 @@
 
     rw.writeAttribute("id", clientId , "id");
     rw.writeAttribute("value", text, "text");
-    //This style makes an input element appear as a link
-    rw.writeAttribute("style",
-       "border:none;background:inherit;text-decoration:underline;", null);
+    renderStyleClass(context, arc, 
+                  SkinSelectors.AF_COMMAND_BUTTON_STYLE_CLASS);
+    String style = getInlineStyle(bean);
+        
+    // Append an inlineStyle that makes an input element appear as a link
+    _writeInlineStyles(rw, style,
+            "border:none;background:inherit;text-decoration:underline;");
     rw.endElement(element);
     arc.setCurrentClientId(null);
   }
@@ -154,4 +159,50 @@
     } 
   }
 
+  
+  /**
+   * This method renders the stylesClass attribute
+   * @param FacesContext - FacesContext for this request
+   * @param arc - RenderingContext for this request
+   * @param bean - FacesBean of the component to render
+   * @param defaultStyleClass - default styleClass of the component  
+   */
+  @Override
+  protected void renderStyleAttributes(
+    FacesContext        context,
+    RenderingContext    arc,
+    FacesBean           bean,
+    String              defaultStyleClass) throws IOException
+  { 
+    // Skip for HTML basic browsers since it is already handled
+    if (supportsScripting(arc))
+    {
+      super.renderStyleAttributes(context, arc, bean, defaultStyleClass);
+    }
+  } 
+  
+  /**
+   * This method renders the inlineStyle attribute
+   * @param rw - the response writer
+   * @param userInlineStyle - the value of inlineStyle attribute
+   * @param appendedInlineStyle - inlineStyle that is applied by default
+   */
+  private void _writeInlineStyles(
+    ResponseWriter rw,
+    String userInlineStyle,
+    String appendedInlineStyle ) throws IOException
+  {
+    if (userInlineStyle == null)
+    {
+      rw.writeAttribute("style", appendedInlineStyle, "inlineStyle");
+    }
+    else
+    {
+      StringBuilder linkInlineStyle = new StringBuilder();
+      linkInlineStyle.append(appendedInlineStyle);
+      linkInlineStyle.append(userInlineStyle.trim());
+      rw.writeAttribute("style", linkInlineStyle.toString(), "inlineStyle");
+    }
+  }
+  
 }

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaNavigationPaneRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaNavigationPaneRenderer.java?rev=819086&r1=819085&r2=819086&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaNavigationPaneRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaNavigationPaneRenderer.java
Sat Sep 26 01:44:15 2009
@@ -152,6 +152,8 @@
           renderStyleClass(context, arc, 
                            SkinSelectors.AF_NAVIGATION_LEVEL_BUTTONS_CONTENT_STYLE_CLASS);
         }
+        
+        writeInlineStyles(rw, toString(itemData.get("inlineStyle")), null);
         appendIconAndText(context, arc, rw, 
                            toString(itemData.get("icon")), 
                            itemData, isDisabled, isRtl);

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java?rev=819086&r1=819085&r2=819086&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java
Sat Sep 26 01:44:15 2009
@@ -145,6 +145,22 @@
                             Character.valueOf(accessKey),
                             "accessKey");
           
+          // BlackBerry browsers underline the entire text instead of just  
+          // the accessKey character in cases where the accessKey character   
+          // happens to be the first character in the text. Rendering an   
+          // empty span element before rendering the text fixes this problem.
+          
+          Agent agent = arc.getAgent();
+               
+          if ((accessKeyIndex == 0) && 
+               Agent.AGENT_BLACKBERRY.equals(agent.getAgentName()))
+          {
+            rw.startElement("span", null);
+            // Since an empty span element is not rendered, lets 
+            // include some attribute to the span element 
+            rw.writeAttribute("style", "display:inline", null);
+            rw.endElement("span");
+          }
         }                   
       }
       

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelFormLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelFormLayoutRenderer.java?rev=819086&r1=819085&r2=819086&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelFormLayoutRenderer.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelFormLayoutRenderer.java
Sat Sep 26 01:44:15 2009
@@ -42,6 +42,7 @@
 import org.apache.myfaces.trinidad.component.UIXEditableValue;
 import org.apache.myfaces.trinidad.component.UIXPanel;
 import org.apache.myfaces.trinidad.component.core.layout.CorePanelFormLayout;
+import org.apache.myfaces.trinidad.context.Agent;
 import org.apache.myfaces.trinidad.context.RenderingContext;
 
 public class PanelFormLayoutRenderer extends XhtmlRenderer
@@ -676,16 +677,37 @@
       labelRatio = Double.valueOf(labelWidth.substring(0, labelPercentCharIndex));
       int fieldPercentCharIndex = fieldWidth.indexOf("%");
       fieldRatio = Double.valueOf(fieldWidth.substring(0, fieldPercentCharIndex));
+      
+      // BlackBerry(BB) browsers cannot handle width if it is expressed in 
+      // percentage and the percentage value contains a decimal points like 
+      // 40.0%. So lets truncate the percentage value from the decimal point  
+      // for BB browsers. Example, instead of 40.0%, lets render 40%.
+      RenderingContext arc = RenderingContext.getCurrentInstance();
+      Agent agent = arc.getAgent();
+      
+      boolean isBlackBerry = 
+                 Agent.AGENT_BLACKBERRY.equals(agent.getAgentName());
 
       // Now normalize the percentages (including the footer label width):
       double ratioTotal = (labelRatio + fieldRatio) / 100;
       double effectiveLabelWidthDouble = labelRatio / ratioTotal;
-      effectiveLabelWidth = Math.floor(effectiveLabelWidthDouble) + "%";
-      effectiveFieldWidth = Math.floor(fieldRatio / ratioTotal) + "%";
       double footerLabel = effectiveLabelWidthDouble / actualColumns;
       double footerField = 100 - footerLabel;
-      effectiveFooterLabelWidth = _roundTo2DecimalPlaces(footerLabel) + "%";
-      effectiveFooterFieldWidth = _roundTo2DecimalPlaces(footerField) + "%";
+      
+      if (isBlackBerry)
+      {
+        effectiveLabelWidth = (int) effectiveLabelWidthDouble + "%";
+        effectiveFieldWidth = (int) (fieldRatio / ratioTotal) + "%"; 
+        effectiveFooterLabelWidth = (int) _roundTo2DecimalPlaces(footerLabel) + "%";
+        effectiveFooterFieldWidth = (int) _roundTo2DecimalPlaces(footerField) + "%";
+      }
+      else
+      {
+        effectiveLabelWidth = Math.floor(effectiveLabelWidthDouble) + "%";
+        effectiveFieldWidth = Math.floor(fieldRatio / ratioTotal) + "%"; 
+        effectiveFooterLabelWidth = _roundTo2DecimalPlaces(footerLabel) + "%";
+        effectiveFooterFieldWidth = _roundTo2DecimalPlaces(footerField) + "%";
+      }
     }
     else if ( labelWidthType.equals(WidthType.PIXEL) && fieldWidthType.equals(WidthType.PIXEL)
)
     {

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/minimal-pda.xss
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/minimal-pda.xss?rev=819086&r1=819085&r2=819086&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/minimal-pda.xss
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/adf/styles/minimal-pda.xss
Sat Sep 26 01:44:15 2009
@@ -389,6 +389,12 @@
     <style selector="af|column::sortable-header-text">
       <property name="border-width">1px</property>
     </style>    
+    
+    <!-- This style-class will be used by HTML basic browsers -->
+    <style selector="af|showDetailItem::selected">
+      <includeStyle name="AFDefaultBoldFont"/>
+      <includeStyle name="AFDarkForeground"/>
+    </style>
 
     <style selector=".OraButtonText">
         <includeStyle name="AFSmallFont"/>
@@ -541,15 +547,18 @@
       <includeStyle name="AFDefaultFont"/>
       <property name="font-size">xx-small</property>    
     </style>    
-  </styleSheet>    
-  
-  <styleSheet platforms="genericpda">
-  
-    <style selector="af|showDetailItem::selected">
-      <includeStyle name="AFDefaultBoldFont"/>
-      <includeStyle name="AFDarkForeground"/>
+
+    <!-- Since button elements, which have their own background, will no 
+         longer be used for BlackBerry, we need to set the background for
+         input elements which can act as buttons -->
+    <style selector="input[type='submit']">
+      <includeStyle name="AFLightAccentBackground"/>
     </style>
     
-  </styleSheet>  
+    <style selector="input[type='button']">
+      <includeStyle name="AFLightAccentBackground"/>
+    </style> 
+    
+  </styleSheet>    
   
 </styleSheetDocument>

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/agent/blackberry9000.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/agent/blackberry9000.xml?rev=819086&r1=819085&r2=819086&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/agent/blackberry9000.xml
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/resources/META-INF/agent/blackberry9000.xml
Sat Sep 26 01:44:15 2009
@@ -24,4 +24,5 @@
   <capability name="-adfinternal-cssSelectors" value="multiple"/> 
   <capability name="-adfinternal-imageStretch" value="true"/> 
   <capability name="partialRendering" value="true"/>
+  <capability name="-adfinternal-advancedForms" value="false"/> 
 </capabilityData>



Mime
View raw message