myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gcrawf...@apache.org
Subject svn commit: r777741 - in /myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main: java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java webapp/convertValidate/convertValidate.jspx
Date Fri, 22 May 2009 23:30:22 GMT
Author: gcrawford
Date: Fri May 22 23:30:21 2009
New Revision: 777741

URL: http://svn.apache.org/viewvc?rev=777741&view=rev
Log:
add a test case for bigdecimal so that there's a test case showing behavior before bug fix

Modified:
    myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
    myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/convertValidate/convertValidate.jspx

Modified: myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java?rev=777741&r1=777740&r2=777741&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
(original)
+++ myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ConverterValidatorBean.java
Fri May 22 23:30:21 2009
@@ -6,9 +6,9 @@
  *  to you 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
@@ -20,57 +20,81 @@
 
 import java.io.Serializable;
 
+import java.math.BigDecimal;
+
+import javax.faces.event.ValueChangeEvent;
+
 public class ConverterValidatorBean implements Serializable
 {
   public ConverterValidatorBean()
-  {    
+  {
   }
-  
+
   public Number getCurrencyValue()
   {
     return _currencyValue;
   }
-  
+
   public void setCurrencyValue(Number value)
   {
     _currencyValue = value;
   }
-  
+
   public Number getIntegerOnlyValue()
   {
     return _intOnlyValue;
   }
-    
+
   public void setIntegerOnlyValue(Number value)
   {
     _intOnlyValue =  value;
   }
-  
+
   public void setPercentValue(Number value)
   {
     _percentValue = value;
   }
-  
+
   public Number getPercentValue()
   {
     return _percentValue;
   }
-  
+
   public Number getGroupValue()
   {
     return _groupValue;
   }
-  
+
   public void setGroupValue(Number value)
   {
     _groupValue = value;
   }
   
+  public void setBigDecimalValue(BigDecimal bigDecimalValue)
+  {
+    _bigDecimalValue = bigDecimalValue;
+  }
+
+  public BigDecimal getBigDecimalValue()
+  {
+    return _bigDecimalValue;
+  }
+
+  public void valueChanged(ValueChangeEvent vce)
+  {
+    System.out.println("valueChangeListener called.");
+    System.out.println("   Old value = " + vce.getOldValue());
+    System.out.println("   New value = " + vce.getNewValue());
+  }
+
   private Number _currencyValue = new Double(78.57);
-  
+
   private Number _intOnlyValue = new Double(99.99);
-  
+
   private Number _percentValue = new Double(0.55);
-  
+
   private Number _groupValue   = new Double(77777.89);
+
+  private BigDecimal _bigDecimalValue   = new BigDecimal(2.00);
+
 }

Modified: myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/convertValidate/convertValidate.jspx
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/convertValidate/convertValidate.jspx?rev=777741&r1=777740&r2=777741&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/convertValidate/convertValidate.jspx
(original)
+++ myfaces/trinidad/branches/1.2.11.3-branch/trinidad-examples/trinidad-demo/src/main/webapp/convertValidate/convertValidate.jspx
Fri May 22 23:30:21 2009
@@ -16,7 +16,7 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
-	   
+     
 -->
 <jsp:root version="1.2" xmlns:tr="http://myfaces.apache.org/trinidad"
           xmlns:f="http://java.sun.com/jsf/core"
@@ -43,8 +43,15 @@
                 </f:facet>
                 <f:convertNumber type="number" integerOnly="true"/>
               </tr:inputText>
+              <tr:inputText valueChangeListener="#{converterValidator.valueChanged}" value="#{converterValidator.bigDecimalValue}"
label="number converter2">
+                <f:facet name="help">
+                  <tr:outputText value="value is bigDecimal"/>
+                </f:facet>
+                <f:convertNumber groupingUsed="false"
+                                  pattern="#,##0.00"/>
+              </tr:inputText>
               <tr:inputText value="#{converterValidator.currencyValue}"
-                            label="number converter2" readOnly="true">
+                            label="number converter3" readOnly="true">
                 <f:facet name="help">
                   <tr:outputText value="type='currency' locale='en_US' currencyCode='EUR'
- This results in EUR prefix before value"/>
                 </f:facet>
@@ -52,21 +59,21 @@
                                  currencyCode="EUR"/>
               </tr:inputText>
               <tr:inputText value="#{converterValidator.percentValue}"
-                            label="number converter3">
+                            label="number converter4">
                 <f:facet name="help">
                   <tr:outputText value="type='percent' locale='en_US' - This results in
fraction displayed as integer value with % symbol"/>
                 </f:facet>
                 <f:convertNumber type="percent" locale="en_US"/>
               </tr:inputText>
               <tr:inputText value="#{converterValidator.groupValue}"
-                            label="number converter4">
+                            label="number converter5">
                 <f:facet name="help">
                   <tr:outputText value="type='number' locale='en_US'"/>
                 </f:facet>
                 <f:convertNumber type="number" locale="en_US"/>
               </tr:inputText>
               <tr:inputText value="#{converterValidator.currencyValue}"
-                            label="number converter5" readOnly="true">
+                            label="number converter6" readOnly="true">
                 <f:facet name="help">
                   <tr:outputText value="type='currency' locale='en_US' currencySymbol='#'
- This results in # as prefix for value"/>
                 </f:facet>



Mime
View raw message