incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r449124 - in /incubator/adffaces/trunk/trinidad/trinidad-impl/src: main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/
Date Fri, 22 Sep 2006 23:31:55 GMT
Author: jwaldman
Date: Fri Sep 22 16:31:54 2006
New Revision: 449124

URL: http://svn.apache.org/viewvc?view=rev&rev=449124
Log:
ADFFACES-167 Add 'autoSubmit' support for basic input components on PDAs. Committed for Piyush
Hari.

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectBooleanRadioRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneChoiceRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-minimalPPC-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-simple-minimalPPC-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-minimalPPC-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-simple-minimalPPC-golden.xml

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java?view=diff&rev=449124&r1=449123&r2=449124
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
Fri Sep 22 16:31:54 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright  2000-2006 The Apache Software Foundation.
- * 
+ *
  * Licensed 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 KIND, either express or implied.
@@ -38,7 +38,7 @@
 import org.apache.myfaces.trinidad.context.RequestContext;
 
 import org.apache.myfaces.trinidad.context.Agent;
-
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
 import org.apache.myfaces.trinidadinternal.renderkit.FormData;
 import org.apache.myfaces.trinidadinternal.renderkit.PartialPageContext;
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
@@ -64,9 +64,9 @@
   public void decode(FacesContext context,
                      UIComponent component)
   {
-    Map<String, String> paramMap = 
+    Map<String, String> paramMap =
       context.getExternalContext().getRequestParameterMap();
-    
+
     Object formName = paramMap.get(CoreResponseStateManager.FORM_FIELD_NAME);
     boolean submitted = false;
 
@@ -272,6 +272,26 @@
     //a partial page submission.
     if (isPIE && pprContext == null)
     {
+      //PH: Add hidden elements in the form for enabling PPR on IE Mobile.
+
+      Object domLevel =  arc.getAgent().getCapabilities().get(
+                    TrinidadAgent.CAP_DOM);
+
+      if(
+         domLevel == null ||
+         domLevel == TrinidadAgent.DOM_CAP_NONE ||
+         domLevel == TrinidadAgent.DOM_CAP_FORM)
+      {
+        FormData formData = arc.getFormData();
+        if(formData != null)
+        {
+          formData.addNeededValue(XhtmlConstants.EVENT_PARAM);
+          formData.addNeededValue(XhtmlConstants.SOURCE_PARAM);
+          formData.addNeededValue(XhtmlConstants.PARTIAL_TARGETS_PARAM);
+          formData.addNeededValue(XhtmlConstants.PARTIAL_PARAM);
+        }
+      }
+
       _renderNeededValues(context, arc);
     }
 
@@ -517,7 +537,7 @@
     writer.writeText(jsID, null);
 
     // get the form validators
-    List<CoreFormData.ConvertValidate> validatorInfoList = 
+    List<CoreFormData.ConvertValidate> validatorInfoList =
       fData.getFormValidatorsInfo(false);
 
     if (validatorInfoList == null)
@@ -607,7 +627,7 @@
       Integer globalFormatIndex = fData.addGlobalMessageFormat(arc);
 
       writer.writeText("]],", null);
-      writer.writeText(globalFormatIndex, null);      
+      writer.writeText(globalFormatIndex, null);
       writer.writeText(");if(fl.length>0){_validationAlert('", null);
       writer.writeText(XhtmlUtils.escapeJS(
                           arc.getTranslatedString("af_form.SUBMIT_ERRORS")),
@@ -671,7 +691,7 @@
 
         writer.writeText("};", null);
 
-      }    
+      }
     }
 
     //
@@ -726,7 +746,7 @@
     ResponseWriter writer = context.getResponseWriter();
     List<String> subforms =
       SubformRenderer.getSubformList(context, false, false);
-    
+
     writer.writeText("var ", null);
     writer.writeText(jsID, null);
     writer.writeText("_SF={", null);
@@ -734,7 +754,7 @@
     {
       List<String> defaultSubforms =
         SubformRenderer.getSubformList(context, true, false);
-      
+
       Iterator<String> ids = subforms.iterator();
       while (ids.hasNext())
       {
@@ -983,7 +1003,7 @@
 
   /**
    * Render each "needed" FormValue that hasn't already
-   * been rendered.  Called by FormRenderer.postrender(). 
+   * been rendered.  Called by FormRenderer.postrender().
    * @see FormRenderer#encodeEnd(FacesContext,RenderingContext, UIComponent, FacesBean)
    */
   static private void _renderNeededValues(

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectBooleanRadioRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectBooleanRadioRenderer.java?view=diff&rev=449124&r1=449123&r2=449124
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectBooleanRadioRenderer.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectBooleanRadioRenderer.java
Fri Sep 22 16:31:54 2006
@@ -23,6 +23,7 @@
 import org.apache.myfaces.trinidad.bean.FacesBean;
 import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.component.core.input.CoreSelectBooleanRadio;
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
 
 /**
@@ -164,9 +165,16 @@
     FacesBean    bean) throws IOException
   {
     ResponseWriter rw = context.getResponseWriter();
-    if ( isAutoSubmit(bean))
-      rw.writeAttribute("onclick", getAutoSubmitScript(bean) , null);
-      
+    
+    // PH: This condition is needed to set onclick on radio rather than on 
+    // enclosing span in an IE Mobile and PIE since these browsers don't have 
+    // onclick support on a span. 
+    
+    if(!isPDA(RenderingContext.getCurrentInstance()))
+    {
+      if ( isAutoSubmit(bean))
+        rw.writeAttribute("onclick", getAutoSubmitScript(bean) , null);
+    }
     rw.writeAttribute("ondblclick", getOndblclick(bean),  "ondblclick");
     rw.writeAttribute("onkeydown", getOnkeydown(bean),  "onkeydown");
     rw.writeAttribute("onkeyup", getOnkeyup(bean),  "onkeyup");
@@ -184,6 +192,16 @@
     FacesBean    bean) throws IOException
   {
     ResponseWriter writer = context.getResponseWriter();
+    
+    //PH: this condition is needed to set onclick on radio rather than on 
+    // enclosing span in an IE Mobile and PIE since these browsers don't have 
+    // onclick support on a span. 
+    if(isPDA(RenderingContext.getCurrentInstance()))
+    {
+      if ( isAutoSubmit(bean))
+        writer.writeAttribute("onclick", getAutoSubmitScript(bean) , null);
+    }
+    
     writer.writeAttribute("onclick", getOnclick(bean),  "onclick");
     writer.writeAttribute("onblur", getOnblur(bean),  "onblur");
     writer.writeAttribute("onfocus", getOnfocus(bean),  "onfocus");

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneChoiceRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneChoiceRenderer.java?view=diff&rev=449124&r1=449123&r2=449124
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneChoiceRenderer.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleSelectOneChoiceRenderer.java
Fri Sep 22 16:31:54 2006
@@ -31,6 +31,7 @@
 
 import org.apache.myfaces.trinidad.component.core.input.CoreSelectOneChoice;
 
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
 
 /**
@@ -134,7 +135,11 @@
   {
     RenderingContext arc = RenderingContext.getCurrentInstance();
     String onclick = super.getOnclick(bean);
-    if (isIE(arc) && isAutoSubmit(bean))
+    
+    //PH: onclick should be included only for desktop IE since PIE and 
+    //IE mobile do not support onclick on a select component
+    if (isIE(arc) && isDesktop(arc) 
+        && isAutoSubmit(bean) )
     {
       String auto = getAutoSubmitScript(arc, bean);
       // On IE, if we autosubmit,
@@ -149,11 +154,10 @@
       auto = _IE_ACTION_HANDLER_PREFIX + auto;
       onclick = XhtmlUtils.getChainedJS(onclick, auto, true);
     }
-
+    
     return onclick;
   }
-
-
+  
   /**
    * In Internet Explorer, handle autosubmit.
    */
@@ -163,14 +167,17 @@
   {
     RenderingContext arc = RenderingContext.getCurrentInstance();
     String onblur = super.getOnblur(bean);
-    if (isIE(arc) && isAutoSubmit(bean))
+    
+    //PH: onblur should be included only for desktop IE since PIE and 
+    //IE mobile do not support onblur on a select component    
+    if (isIE(arc) &&  isDesktop(arc) && isAutoSubmit(bean) )
     {
       String auto = getAutoSubmitScript(arc, bean);
       // See getOnclick()
       auto = _IE_ACTION_HANDLER_PREFIX + auto;
       onblur = XhtmlUtils.getChainedJS(onblur, auto, true);
     }
-
+     
     return onblur;
   }
 
@@ -190,8 +197,14 @@
     // Prepend the autosubmit script
     if (isAutoSubmit(bean))
     {
-      // See getOnclick() for the explanation of the IE code.
-      if (isIE(arc))
+       // See getOnclick() for the explanation of the IE code.
+       // PH: The weird behaviour of an IE SELECT element as mentioned in 
+       // the getOnclick method above is not seen on PIE and IE Mobile.
+       // Therefore, _CHOICE_CHANGE_TRACKER is not needed.
+       // Also, since PIE and IE Mobile do not support an 'onclick' javascript 
+       // handler on a SELECT element,
+       // autoSubmit script is added in the 'onchange' javascript handler.       
+      if (isIE(arc) && isDesktop(arc) )
         auto = _CHOICE_CHANGE_TRACKER;
       else
         auto = getAutoSubmitScript(arc, bean);
@@ -205,8 +218,8 @@
         auto = _SYNC_FUNC;
       else
         auto = (_SYNC_FUNC + ";") + auto;
-    }
-
+    }  
+    
     // And chain everything together
     return XhtmlUtils.getChainedJS(onchange, auto, true);
   }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-minimalPPC-golden.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-minimalPPC-golden.xml?view=diff&rev=449124&r1=449123&r2=449124
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-minimalPPC-golden.xml
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-minimalPPC-golden.xml
Fri Sep 22 16:31:54 2006
@@ -133,7 +133,6 @@
             <span
                  class="af_selectBooleanRadio_content"
                  id="mainId__xc_r"
-                 onclick="_radioSet_adfspu('formId',1,'mainId','mainId');return true;"
                 >
               
               <script
@@ -143,6 +142,7 @@
               <input
                    id="mainId"
                    name="groupTest"
+                   onclick="_radioSet_adfspu('formId',1,'mainId','mainId');return true;"
                    type="radio"
                    value="mainId"
                   >
@@ -192,12 +192,12 @@
             <span
                  class="af_selectBooleanRadio_content"
                  id="mainId__xc_r"
-                 onclick="_radioSet_adfspu('formId',0,'mainId','mainId');return true;"
                 >
               
               <input
                    id="mainId"
                    name="groupTest"
+                   onclick="_radioSet_adfspu('formId',0,'mainId','mainId');return true;"
                    type="radio"
                    value="mainId"
                   >

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-simple-minimalPPC-golden.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-simple-minimalPPC-golden.xml?view=diff&rev=449124&r1=449123&r2=449124
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-simple-minimalPPC-golden.xml
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-simple-minimalPPC-golden.xml
Fri Sep 22 16:31:54 2006
@@ -48,7 +48,6 @@
         
         <span
              class="af_selectBooleanRadio_content"
-             onclick="_radioSet_adfspu('formId',1,'mainId','mainId');return true;"
             >
           
           <script
@@ -58,6 +57,7 @@
           <input
                id="mainId"
                name="groupTest"
+               onclick="_radioSet_adfspu('formId',1,'mainId','mainId');return true;"
                type="radio"
                value="mainId"
               >
@@ -74,12 +74,12 @@
         
         <span
              class="af_selectBooleanRadio_content"
-             onclick="_radioSet_adfspu('formId',0,'mainId','mainId');return true;"
             >
           
           <input
                id="mainId"
                name="groupTest"
+               onclick="_radioSet_adfspu('formId',0,'mainId','mainId');return true;"
                type="radio"
                value="mainId"
               >

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-minimalPPC-golden.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-minimalPPC-golden.xml?view=diff&rev=449124&r1=449123&r2=449124
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-minimalPPC-golden.xml
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-minimalPPC-golden.xml
Fri Sep 22 16:31:54 2006
@@ -361,9 +361,7 @@
                  class="af_selectOneChoice_content"
                  id="mainId"
                  name="mainId"
-                 onblur="if(!_pprChoiceAction(event))return true;_adfspu('formId',1,'mainId','mainId');return
true;"
-                 onchange="return _pprChoiceChangeEvent(event);"
-                 onclick="if(!_pprChoiceAction(event))return true;_adfspu('formId',1,'mainId','mainId');return
true;"
+                 onchange="_adfspu('formId',1,'mainId','mainId');return true;"
                 >
               
               <option

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-simple-minimalPPC-golden.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-simple-minimalPPC-golden.xml?view=diff&rev=449124&r1=449123&r2=449124
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-simple-minimalPPC-golden.xml
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-simple-minimalPPC-golden.xml
Fri Sep 22 16:31:54 2006
@@ -177,9 +177,7 @@
              class="af_selectOneChoice_content"
              id="mainId"
              name="mainId"
-             onblur="if(!_pprChoiceAction(event))return true;_adfspu('formId',1,'mainId','mainId');return
true;"
-             onchange="return _pprChoiceChangeEvent(event);"
-             onclick="if(!_pprChoiceAction(event))return true;_adfspu('formId',1,'mainId','mainId');return
true;"
+             onchange="_adfspu('formId',1,'mainId','mainId');return true;"
             >
           
           <option



Mime
View raw message