incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r497401 - in /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main: java/org/apache/myfaces/trinidadinternal/convert/ java/org/apache/myfaces/trinidadinternal/validator/ javascript/META-INF/adf/jsLibs/
Date Thu, 18 Jan 2007 11:26:34 GMT
Author: matzew
Date: Thu Jan 18 03:26:33 2007
New Revision: 497401

URL: http://svn.apache.org/viewvc?view=rev&rev=497401
Log:
updating some details regarding the hints (changing property names and avoid to send to many
messages (added notInRange for the max/min validators)

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DateTimeRangeValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DoubleRangeValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Locale.js

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java?view=diff&rev=497401&r1=497400&r2=497401
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java
Thu Jan 18 03:26:33 2007
@@ -174,7 +174,7 @@
       messages.put("detail", convMsgDet);
     }
     
-    String hint = getHintFormat();
+    String hint = getHint();
 
     if(hint != null)
     {

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DateTimeRangeValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DateTimeRangeValidator.java?view=diff&rev=497401&r1=497400&r2=497401
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DateTimeRangeValidator.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DateTimeRangeValidator.java
Thu Jan 18 03:26:33 2007
@@ -83,11 +83,12 @@
     String messageDetailMax = this.getMessageDetailMaximum();
     String messageDetailMin = this.getMessageDetailMinimum();
     String messageDetailRange = this.getMessageDetailNotInRange();
-    String hintMax = this.getHintMaximum();
+    String hintMax = "max YEAH {0} !!!"; //this.getHintMaximum();
     String hintMin = this.getHintMinimum();
+    String hintRange = this.getHintNotInRange();
     
     Map<String, String> cMessages = null;
-    if(messageDetailMax != null || messageDetailMin != null || messageDetailRange != null
|| hintMax != null || hintMin != null)
+    if(messageDetailMax != null || messageDetailMin != null || messageDetailRange != null
|| hintMax != null || hintMin != null|| hintRange != null)
     {
       cMessages = new HashMap<String, String>();
       cMessages.put("max", messageDetailMax);
@@ -95,6 +96,7 @@
       cMessages.put("range", messageDetailRange);
       cMessages.put("hintMax", hintMax);
       cMessages.put("hintMin", hintMin);
+      cMessages.put("hintRange", hintRange);
     }
     
     return _getTrDateTimeRangeValidator(context, component, maxStr, minStr, cMessages);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DoubleRangeValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DoubleRangeValidator.java?view=diff&rev=497401&r1=497400&r2=497401
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DoubleRangeValidator.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/DoubleRangeValidator.java
Thu Jan 18 03:26:33 2007
@@ -68,9 +68,10 @@
     String messageDetailRange = this.getMessageDetailNotInRange();
     String hintMax = this.getHintMaximum();
     String hintMin = this.getHintMinimum();
+    String hintRange = this.getHintNotInRange();
     
     Map<String, String> cMessages = null;
-    if(messageDetailMax != null || messageDetailMin != null || messageDetailRange != null
|| hintMax != null || hintMin != null)
+    if(messageDetailMax != null || messageDetailMin != null || messageDetailRange != null
|| hintMax != null || hintMin != null|| hintRange != null)
     {
       cMessages = new HashMap<String, String>();
       cMessages.put("max", messageDetailMax);
@@ -78,6 +79,7 @@
       cMessages.put("range", messageDetailRange);
       cMessages.put("hintMax", hintMax);
       cMessages.put("hintMin", hintMin);
+      cMessages.put("hintRange", hintRange);
     }
     
     return  _getTrRangeValidator(context, component, maxStr, minStr, cMessages);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java?view=diff&rev=497401&r1=497400&r2=497401
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java
Thu Jan 18 03:26:33 2007
@@ -65,15 +65,17 @@
     String messageDetailMin = this.getMessageDetailMinimum();
     String hintMax = this.getHintMaximum();
     String hintMin = this.getHintMinimum();
+    String hintRange = this.getHintNotInRange();
     
     Map<String, String> cMessages = null;
-    if(messageDetailMax != null || messageDetailMin != null || hintMax != null || hintMin
!= null)
+    if(messageDetailMax != null || messageDetailMin != null || hintMax != null || hintMin
!= null || hintRange != null)
     {
       cMessages = new HashMap<String, String>();
       cMessages.put("max", messageDetailMax);
       cMessages.put("min", messageDetailMin);
       cMessages.put("hintMax", hintMax);
       cMessages.put("hintMin", hintMin);
+      cMessages.put("hintRange", hintRange);
     }
     return _getTrLengthValidator(context, component, maxStr, minStr, cMessages);
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java?view=diff&rev=497401&r1=497400&r2=497401
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
Thu Jan 18 03:26:33 2007
@@ -69,9 +69,10 @@
     String messageDetailRange = this.getMessageDetailNotInRange();
     String hintMax = this.getHintMaximum();
     String hintMin = this.getHintMinimum();
+    String hintRange = this.getHintNotInRange();
     
     Map<String, String> cMessages = null;
-    if(messageDetailMax != null || messageDetailMin != null || messageDetailRange != null
|| hintMax != null || hintMin != null)
+    if(messageDetailMax != null || messageDetailMin != null || messageDetailRange != null
|| hintMax != null || hintMin != null|| hintRange != null)
     {
       cMessages = new HashMap<String, String>();
       cMessages.put("max", messageDetailMax);
@@ -79,6 +80,7 @@
       cMessages.put("range", messageDetailRange);
       cMessages.put("hintMax", hintMax);
       cMessages.put("hintMin", hintMin);
+      cMessages.put("hintRange", hintRange);
     }
     
     return _getTrRangeValidator(context, component, maxStr, minStr, cMessages);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java?view=diff&rev=497401&r1=497400&r2=497401
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java
Thu Jan 18 03:26:33 2007
@@ -86,7 +86,7 @@
       messages.put("detail", noMatchMsg);
     }
     
-    String hintPattern = getHintPattern();
+    String hintPattern = getHint();
     if(hintPattern != null)
     {
       messages.put("hint", hintPattern);

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=497401&r1=497400&r2=497401
==============================================================================
--- 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
Thu Jan 18 03:26:33 2007
@@ -323,14 +323,16 @@
   converter
   )
 {
-  return _returnHints(
+  return _returnRangeHints(
     this._messages,
     this._maxValue,
     this._minValue,
     "org.apache.myfaces.trinidad.validator.RangeValidator.MAXIMUM_HINT",
     "org.apache.myfaces.trinidad.validator.RangeValidator.MINIMUM_HINT",
+    "org.apache.myfaces.trinidad.validator.RangeValidator.RANGE_HINT",
     "hintMax",
-    "hintMin"
+    "hintMin",
+    "hintRange"
   );
 }
 TrRangeValidator.prototype.validate  = function(
@@ -450,14 +452,16 @@
   converter
   )
 {
-  return _returnHints(
+  return _returnRangeHints(
     this._messages,
     this._maxValue,
     this._minValue,
     "org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_HINT",
     "org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_HINT",
+    "org.apache.myfaces.trinidad.validator.LengthValidator.RANGE_HINT",
     "hintMax",
-    "hintMin"
+    "hintMin",
+    "hintRange"
   );
 }
 TrLengthValidator.prototype.validate  = function(
@@ -538,14 +542,16 @@
   converter
   )
 {
-  return _returnHints(
+  return _returnRangeHints(
     this._messages,
     converter.getAsString(new Date(this._maxValue)),
     converter.getAsString(new Date(this._minValue)),
     "org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM_HINT",
     "org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM_HINT",
+    "org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.RANGE_HINT",
     "hintMax",
-    "hintMin"
+    "hintMin",
+    "hintRange"
   );
 }
 TrDateTimeRangeValidator.prototype.validate  = function(
@@ -672,8 +678,6 @@
   converter
   )
 {
-	
-	
   return _returnHints(
     this._messages,
     this._translate(this._weekdaysValue, this._translatedWeekdaysMap, converter.getLocaleSymbols().getWeekdays()),
@@ -967,6 +971,91 @@
   }
 }
 
+function _returnRangeHints(
+  messages,
+  max,
+  min,
+  maxKey,
+  minKey,
+  rangeKey,
+  maxHint,
+  minHint,
+  rangeHint
+)
+{
+  var hints;
+  //we have both, max and min, so we only use the range Hint
+  if(max && min)
+  {
+  	hints = new Array();
+    if(messages && messages[rangeHint])
+    {
+      hints.push(
+        TrMessageFactory.createCustomMessage(
+        messages[rangeHint],
+        ""+min,
+        ""+max)
+  	  );
+    }
+    else
+    {
+      hints.push(
+        TrMessageFactory.createMessage(
+        rangeKey,
+        ""+min,
+	      ""+max)
+	    );
+    }
+    return hints;
+  }
+  
+  //only max
+  if(max)
+  {
+    hints = new Array();
+    if(messages && messages[maxHint])
+    {
+      hints.push(
+        TrMessageFactory.createCustomMessage(
+          messages[maxHint],
+	        ""+max)
+	    );
+    }
+    else
+    {
+      hints.push(
+        TrMessageFactory.createMessage(
+          maxKey,
+	        ""+max)
+	    );
+    }
+  }
+  //only min
+  if(min)
+  {
+    if(!hints)
+    {
+      hints = new Array();
+    }
+    if(messages && messages[minHint])
+    {
+      hints.push(
+        TrMessageFactory.createCustomMessage(
+          messages[minHint],
+	        ""+min)
+       );
+    }
+    else
+    {
+      hints.push(
+        TrMessageFactory.createMessage(
+          minKey,
+	        ""+min)
+       );
+    }
+  }
+  return hints;
+}
 function _returnHints(
   messages,
   max,

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=497401&r1=497400&r2=497401
==============================================================================
--- 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
Thu Jan 18 03:26:33 2007
@@ -825,7 +825,7 @@
   formatString, // error format string with embedded indexes to be replaced
   parameters    // {any...:undefined} Varargs objects to substitute for positional parameters.
   )
-{  
+{
   // I need to create an array here because I have to strip the first arg
   var tempArray = new Array();
   
@@ -920,17 +920,15 @@
 }
 TrMessageFactory.createCustomMessage = function(
   customMessage,
-  parameters
+  param1,
+  param2
   )
-{  
+{
   // the strings to create a facesMessage to use have been sent down
   var message;
   if ( customMessage != null )
   {
-    if ( parameters != null )
-    {
-      message = TrFastMessageFormatUtils.format(customMessage,parameters);
-    }
+  	message = TrFastMessageFormatUtils.format(customMessage, param1, param2);
   }
   return message;
 }



Mime
View raw message