incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r441747 - in /incubator/adffaces/trunk/trinidad: src/site/xdoc/devguide/ trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ trinidad-demo/src/main/webapp/convertValidate/ trinidad-demo/src/main/webapp/jsLibs/ trinidad-impl/src/mai...
Date Sat, 09 Sep 2006 06:31:59 GMT
Author: matzew
Date: Fri Sep  8 23:31:59 2006
New Revision: 441747

URL: http://svn.apache.org/viewvc?view=rev&rev=441747
Log:
apply patch for ADFFACES-163. client side validation: FastMessageFormatUtils should uses now
varargs in format method.(thanks to Gabrielle Crawford)

Modified:
    incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Locale.js

Modified: incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml?view=diff&rev=441747&r1=441746&r2=441747
==============================================================================
--- incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml (original)
+++ incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml Fri Sep
 8 23:31:59 2006
@@ -121,15 +121,14 @@
 
  /**
   * Formats the given array of strings based on the initial
-  * pattern.   It is legal for this array to be shorter
-  * than that indicated by the pattern, or to have null
-  * entries - these will simply be ignored.
-  * @param formatString an array of strings
-  * @param params an array of strings
+  * pattern.  
+  * @param {String} String to format
+  * @param {any...:undefined} Varargs objects to substitute for positional parameters.
+  * Each parameter will be converted to a String and substituted into the format.
   */
 FastMessageFormatUtils.format = function(
   formatString, // error format string with embedded indexes to be replaced
-  params        // array of objects to replace indexes
+  parameters    // {any...:undefined} Varargs objects to substitute for positional parameters.
   )
 </source>
       </p>
@@ -171,10 +170,7 @@
           var detail = this._messages[messageKey];
           if (detail != null)
           {
-            var patternArray = new Array();
-            patternArray[0] = label;
-            patternArray[1] = value;
-            detail = FastMessageFormatUtils.format(detail, patternArray);
+            detail = FastMessageFormatUtils.format(detail, label, value);
           }
         
           var facesMessage = new FacesMessage(

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java?view=diff&rev=441747&r1=441746&r2=441747
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ClientValidationBean.java
Fri Sep  8 23:31:59 2006
@@ -16,6 +16,7 @@
 package org.apache.myfaces.trinidaddemo;
 import java.math.BigDecimal;
 
+import java.util.Date;
 
 
 public class ClientValidationBean implements java.io.Serializable
@@ -76,6 +77,16 @@
     _long = longObj;
   }
 
+  public Long getLong2()
+  {
+    return _long2 ;
+  }
+
+  public void setLong2(Long longObj)
+  {
+    _long2 = longObj;
+  }  
+
   public Long getLongValue()
   {
     return _longValue ;
@@ -107,6 +118,28 @@
   }
 
 
+  public Double getDouble2()
+  {
+    return _double2 ;
+  }
+
+  public void setDouble2(Double doubleObj)
+  {
+    _double2 = doubleObj;
+  }
+
+
+  public Double getDouble3()
+  {
+    return _double3 ;
+  }
+
+  public void setDouble3(Double doubleObj)
+  {
+    _double3 = doubleObj;
+  }
+
+
   public String getText()
   {
     return _text ;
@@ -146,6 +179,27 @@
   public void setByteLengthValue(String value)
   {
     _byteLegthValue = value;
+  }  
+  
+  
+  public String getLengthValue()
+  {
+    return _legthValue;
+  }
+  
+  public void setLengthValue(String value)
+  {
+    _legthValue = value;
+  }    
+  
+  public Date getDate()
+  {
+    return _date;
+  }
+  
+  public void setDate(Date date)
+  {
+    _date = date;
   }
 
 
@@ -155,14 +209,19 @@
   private BigDecimal _bigDecimal = null;
   private Long _long = null;
   private Long _longValue = null;
+  private Long _long2 = null;
   private Short _short = null;
   private Byte _byte = null;
   private Double _double = null;
+  private Double _double2 = null;
+  private Double _double3 = null;
   private Float _float = null;
 
   private String _regExpValue = null;
 
   private String _byteLegthValue = null;
+  private String _legthValue = null;
+  private Date _date = new Date();
 
 
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx?view=diff&rev=441747&r1=441746&r2=441747
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx
Fri Sep  8 23:31:59 2006
@@ -72,7 +72,14 @@
                 <f:facet name="help">
                   <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
                 </f:facet>
-              </tr:inputText>
+              </tr:inputText>  
+              <!--tr:inputText value="#{clientValidation.double2}"
+                            label="number converter">
+                <f:facet name="help">
+                  <tr:outputText value="must have 2 decimal places, examples of unconvertable
values: '1.1' or '1.111'"/>
+                </f:facet>
+                <f:convertNumber maxFractionDigits="2" minFractionDigits="2"/>    
           
+              </tr:inputText-->
               <tr:inputColor label="color converter">
                 <f:facet name="help">
                   <tr:outputText value="examples of unconvertable values: '9/05' or 'cat'"/>
@@ -87,27 +94,49 @@
             <tr:panelHeader text="Client Validators"/>
             <tr:spacer height="10"/>
             <tr:panelFormLayout>
-              <tr:inputText value="#{clientValidation.long}"
+              <tr:inputText value="#{clientValidation.long2}"
                             label="long range validator">
                 <f:facet name="help">
                   <tr:outputText value="examples of values that will fail validation:
'4' or '7'"/>
                 </f:facet>
                 <f:validateLongRange minimum="5" maximum="6"/>
-              </tr:inputText>
+              </tr:inputText> 
+              <!--tr:inputText value="#{clientValidation.double3}"
+                            label="double range validator">
+                <f:facet name="help">
+                  <tr:outputText value="examples of values that will fail validation:
'4' or '7'"/>
+                </f:facet>
+                <f:validateDoubleRange minimum="5.2" maximum="6.7"/>
+              </tr:inputText-->
               <tr:inputText value="#{clientValidation.regExpValue}"
                             label="reg exp validator">
                 <f:facet name="help">
                   <tr:outputText value="examples of values that will fail validation:
1','2','4' all values other than '9'"/>
                 </f:facet>
                 <tr:validateRegExp pattern="[9]"/>
-              </tr:inputText>
+              </tr:inputText>  
+              <!--tr:inputText value="#{clientValidation.lengthValue}"
+                            label="length validator">
+                <f:facet name="help">
+                  <tr:outputText value="values longer than 4 will fail, for example: '44444444'
or 'Seven'"/>
+                </f:facet>
+                <f:validateLength maximum="4"/>
+              </tr:inputText--> 
               <tr:inputText value="#{clientValidation.byteLengthValue}"
                             label="byte length validator">
                 <f:facet name="help">
-                  <tr:outputText value="examples of values that will fail validation:
'Four4' or 'Seven"/>
+                  <tr:outputText value="values longer than 4 bytes will fail, for example:
'44444444' or 'Seven'"/>
                 </f:facet>
                 <tr:validateByteLength encoding="ISO-8859-1" maximum="4"/>
-              </tr:inputText>
+              </tr:inputText>              
+              <!--tr:inputText value="#{clientValidation.date}"
+                            label="date range validator">
+                <f:facet name="help">
+                  <tr:outputText value="examples of values that will fail validation:
11-11-11"/>
+                </f:facet>
+                <tr:validateDateTimeRange minimum="2004-11-16"
+                                          maximum="2004-12-16"/>
+              </tr:inputText-->
             </tr:panelFormLayout>
             <tr:panelHeader text="Required"/>
             <tr:spacer height="10"/>

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js?view=diff&rev=441747&r1=441746&r2=441747
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js
Fri Sep  8 23:31:59 2006
@@ -46,10 +46,7 @@
     var detail = this._messages[messageKey];
     if (detail != null)
     {
-      var patternArray = new Array();
-      patternArray[0] = label;
-      patternArray[1] = value;
-      detail = FastMessageFormatUtils.format(detail, patternArray);
+      detail = FastMessageFormatUtils.format(detail, label, value);
     }
   
     var facesMessage = new FacesMessage(

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?view=diff&rev=441747&r1=441746&r2=441747
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
Fri Sep  8 23:31:59 2006
@@ -2543,12 +2543,7 @@
   // format the detail error string
   if (detail != null)
   {
-    var patternArray = new Array();
-    patternArray[0] = label;
-    patternArray[1] = value;
-    patternArray[2] = param2;
-    patternArray[3] = param3;
-    detail = _formatErrorString(detail, patternArray);
+    detail = FastMessageFormatUtils.format(detail, label, value, param2, param3);
   }
   
   return new FacesMessage(summary, 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Locale.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Locale.js?view=diff&rev=441747&r1=441746&r2=441747
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Locale.js
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Locale.js
Fri Sep  8 23:31:59 2006
@@ -777,16 +777,25 @@
 
  /**
   * Formats the given array of strings based on the initial
-  * pattern.   It is legal for this array to be shorter
-  * than that indicated by the pattern, or to have null
-  * entries - these will simply be ignored.
-  * @param formatString an array of strings
-  * @param params an array of strings
+  * pattern.  
+  * @param {String} String to format
+  * @param {any...:undefined} Varargs objects to substitute for positional parameters.
+  * Each parameter will be converted to a String and substituted into the format.
   */
 FastMessageFormatUtils.format = function(
   formatString, // error format string with embedded indexes to be replaced
-  params        // array of objects to replace indexes
+  parameters    // {any...:undefined} Varargs objects to substitute for positional parameters.
   )
-{
-  return _formatErrorString(formatString, params);
+{  
+  // I need to create an array here because I have to strip the first arg
+  var tempArray = new Array();
+  
+  for ( var i = 1; i < arguments.length; i++)
+  {
+    tempArray[i -1] = arguments[i];
+  }
+  
+  // TODO - move the code of the function below into here after 
+  //        simplifying it
+  return _formatErrorString(formatString, tempArray);
 }



Mime
View raw message