cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r161272 - in cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib: UIComponentTag.java ValidateDoubleRangeTag.java ValidateLongRangeTag.java
Date Thu, 14 Apr 2005 13:03:02 GMT
Author: vgritsenko
Date: Thu Apr 14 06:03:01 2005
New Revision: 161272

URL: http://svn.apache.org/viewcvs?view=rev&rev=161272
Log:
      Faces Block: ValidateLongRangeTag, ValidateDoubleRangeTag should use long
      and double to set minimum and maximum, not int.

Modified:
    cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/UIComponentTag.java
    cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateDoubleRangeTag.java
    cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateLongRangeTag.java

Modified: cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/UIComponentTag.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/UIComponentTag.java?view=diff&r1=161271&r2=161272
==============================================================================
--- cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/UIComponentTag.java
(original)
+++ cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/UIComponentTag.java
Thu Apr 14 06:03:01 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -41,7 +41,7 @@
 import java.util.Map;
 
 /**
- * @version CVS $Id$
+ * @version $Id$
  */
 public abstract class UIComponentTag extends XMLProducerTagSupport {
 
@@ -110,11 +110,29 @@
 
     protected final int evaluateInteger(String value) {
         if (FacesUtils.isExpression(value)) {
-            Integer obj = (Integer) createValueBinding(value).getValue(getFacesContext());
+            Number obj = (Number) createValueBinding(value).getValue(getFacesContext());
             return obj.intValue();
         }
 
         return Integer.parseInt(value);
+    }
+
+    protected final long evaluateLong(String value) {
+        if (FacesUtils.isExpression(value)) {
+            Number obj = (Number) createValueBinding(value).getValue(getFacesContext());
+            return obj.longValue();
+        }
+
+        return Long.parseLong(value);
+    }
+
+    protected final double evaluateDouble(String value) {
+        if (FacesUtils.isExpression(value)) {
+            Number obj = (Number) createValueBinding(value).getValue(getFacesContext());
+            return obj.doubleValue();
+        }
+
+        return Double.parseDouble(value);
     }
 
     //

Modified: cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateDoubleRangeTag.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateDoubleRangeTag.java?view=diff&r1=161271&r2=161272
==============================================================================
--- cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateDoubleRangeTag.java
(original)
+++ cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateDoubleRangeTag.java
Thu Apr 14 06:03:01 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -23,7 +23,7 @@
 import javax.faces.validator.Validator;
 
 /**
- * @version CVS $Id$
+ * @version $Id$
  */
 public class ValidateDoubleRangeTag extends ValidatorTag {
 
@@ -49,10 +49,10 @@
         DoubleRangeValidator validator = (DoubleRangeValidator) super.createValidator();
 
         if (maximum != null) {
-            validator.setMaximum(tag.evaluateInteger(maximum));
+            validator.setMaximum(tag.evaluateDouble(maximum));
         }
         if (minimum != null) {
-            validator.setMinimum(tag.evaluateInteger(minimum));
+            validator.setMinimum(tag.evaluateDouble(minimum));
         }
 
         return validator;

Modified: cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateLongRangeTag.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateLongRangeTag.java?view=diff&r1=161271&r2=161272
==============================================================================
--- cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateLongRangeTag.java
(original)
+++ cocoon/blocks/unsupported/faces/trunk/java/org/apache/cocoon/faces/taglib/ValidateLongRangeTag.java
Thu Apr 14 06:03:01 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -23,7 +23,7 @@
 import javax.faces.validator.Validator;
 
 /**
- * @version CVS $Id$
+ * @version $Id$
  */
 public class ValidateLongRangeTag extends ValidatorTag {
 
@@ -49,10 +49,10 @@
         LongRangeValidator validator = (LongRangeValidator) super.createValidator();
 
         if (maximum != null) {
-            validator.setMaximum(tag.evaluateInteger(maximum));
+            validator.setMaximum(tag.evaluateLong(maximum));
         }
         if (minimum != null) {
-            validator.setMinimum(tag.evaluateInteger(minimum));
+            validator.setMinimum(tag.evaluateLong(minimum));
         }
 
         return validator;



Mime
View raw message