Author: matzew
Date: Mon Dec 18 08:50:55 2006
New Revision: 488335

URL: http://svn.apache.org/viewvc?view=rev&rev=488335
Log:
working on client side of length validator

Modified:
    
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js

Modified: 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js?view=diff&rev=488335&r1=488334&r2=488335
==============================================================================
--- 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
 (original)
+++ 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
 Mon Dec 18 08:50:55 2006
@@ -371,11 +371,13 @@
 
 function TrLengthValidator(
   maxValue,
-  minValue)
+  minValue,
+  messages)
 {
  
   this._maxValue = maxValue;
   this._minValue = minValue;
+  this._messages = messages;
 
   // for debugging
   this._class = "TrLengthValidator";
@@ -411,18 +413,44 @@
   {
     if(length < this._minValue) //to short
     {
-      facesMessage = 
_createFacesMessage("org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM",
+       var key = 
"org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM";
+       var facesMessage;
+       if(this._messages && this._messages["min"])
+       {
+        facesMessage = 
_createCustomFacesMessage(TrMessageFactory.getSummaryString(key),
+                                        this._messages["min"],
                                         label,
                                         string,
                                         ""+this._minValue);
+       }
+       else
+       {
+        facesMessage = _createFacesMessage(key,
+                                        label,
+                                        string,
+                                        ""+this._minValue);
+       }
       throw new TrConverterException(facesMessage);
     }
     if(length > this._maxValue) //to long
     {
-      facesMessage = 
_createFacesMessage("org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM",
+      var key = 
"org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM";
+      var facesMessage;
+      if(this._messages && this._messages["max"])
+      {
+        facesMessage = 
_createCustomFacesMessage(TrMessageFactory.getSummaryString(key),
+                                        this._messages["max"],
+                                        label,
+                                        string,
+                                        ""+this._maxValue);
+      }
+      else
+      {
+        facesMessage = _createFacesMessage(key,
                                         label,
                                         string,
                                         ""+this._maxValue);
+      }
       throw new TrConverterException(facesMessage);
     }
   }


Reply via email to