cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r503643 - /cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/
Date Mon, 05 Feb 2007 11:27:13 GMT
Author: cziegeler
Date: Mon Feb  5 03:27:11 2007
New Revision: 503643

URL: http://svn.apache.org/viewvc?view=rev&rev=503643
Log:
Make woody compilable

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDateConvertor.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDecimalConvertor.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingFloatConvertor.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingIntegerConvertor.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingLongConvertor.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDateConvertor.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDateConvertor.java?view=diff&rev=503643&r1=503642&r2=503643
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDateConvertor.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDateConvertor.java
Mon Feb  5 03:27:11 2007
@@ -16,12 +16,11 @@
  */
 package org.apache.cocoon.woody.datatype.convertor;
 
-import org.outerj.i18n.DateFormat;
-import org.outerj.i18n.I18nSupport;
-
 import java.util.Locale;
 import java.util.Date;
+import java.text.DateFormat;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 
 /**
  * A Convertor for {@link java.util.Date Date} objects backed by the
@@ -90,24 +89,28 @@
     }
 
     protected DateFormat getDateFormat(Locale locale) {
-        DateFormat dateFormat = null;
+        SimpleDateFormat dateFormat = null;
 
         switch (variant) {
             case DATE:
-                dateFormat = I18nSupport.getInstance().getDateFormat(style, locale);
+                dateFormat = (SimpleDateFormat)DateFormat.getDateInstance(style, locale);
                 break;
             case TIME:
-                dateFormat = I18nSupport.getInstance().getTimeFormat(style, locale);
+                dateFormat = (SimpleDateFormat)DateFormat.getTimeInstance(style, locale);
                 break;
             case DATE_TIME:
-                dateFormat = I18nSupport.getInstance().getDateTimeFormat(style, style, locale);
+                dateFormat = (SimpleDateFormat)DateFormat.getDateTimeInstance(style, style,
locale);
                 break;
         }
 
         String pattern = (String)localizedPatterns.get(locale);
 
         if (pattern != null)
-            dateFormat.applyLocalizedPattern(pattern);
+            // Note: this was previously using applyLocalizedPattern() which allows to use
+            // a locale-specific pattern syntax, e.g. in french "j" (jour) for "d" and
+            // "a" (annee) for "y". But the localized pattern syntax is very little known
and thus
+            // led to some weird pattern syntax error messages.
+            dateFormat.applyPattern(pattern);
         else if (nonLocalizedPattern != null)
             dateFormat.applyPattern(nonLocalizedPattern);
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDecimalConvertor.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDecimalConvertor.java?view=diff&rev=503643&r1=503642&r2=503643
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDecimalConvertor.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingDecimalConvertor.java
Mon Feb  5 03:27:11 2007
@@ -16,10 +16,9 @@
  */
 package org.apache.cocoon.woody.datatype.convertor;
 
-import org.outerj.i18n.I18nSupport;
-import org.outerj.i18n.DecimalFormat;
-
 import java.util.Locale;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
 import java.text.ParseException;
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -113,26 +112,29 @@
 
         switch (variant) {
             case INTEGER:
-                decimalFormat = I18nSupport.getInstance().getIntegerFormat(locale);
+                decimalFormat = (DecimalFormat)NumberFormat.getNumberInstance(locale);
+                decimalFormat.setMaximumFractionDigits(0);
+                decimalFormat.setDecimalSeparatorAlwaysShown(false);
+                decimalFormat.setParseIntegerOnly(true);
                 break;
             case NUMBER:
-                decimalFormat = I18nSupport.getInstance().getNumberFormat(locale);
+                decimalFormat = (DecimalFormat)NumberFormat.getNumberInstance(locale);
                 break;
             case CURRENCY:
-                decimalFormat = I18nSupport.getInstance().getCurrencyFormat(locale);
+                decimalFormat = (DecimalFormat)NumberFormat.getCurrencyInstance(locale);
                 break;
             case PERCENT:
-                decimalFormat = I18nSupport.getInstance().getPercentFormat(locale);
+                decimalFormat = (DecimalFormat)NumberFormat.getPercentInstance(locale);
                 break;
         }
 
         String pattern = (String)localizedPatterns.get(locale);
 
-        if (pattern != null)
-            decimalFormat.applyLocalizedPattern(pattern);
-        else if (nonLocalizedPattern != null)
+        if (pattern != null) {
+            decimalFormat.applyPattern(pattern);
+        } else if (nonLocalizedPattern != null) {
             decimalFormat.applyPattern(nonLocalizedPattern);
-
+        }
         return decimalFormat;
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingFloatConvertor.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingFloatConvertor.java?view=diff&rev=503643&r1=503642&r2=503643
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingFloatConvertor.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingFloatConvertor.java
Mon Feb  5 03:27:11 2007
@@ -16,10 +16,9 @@
  */
 package org.apache.cocoon.woody.datatype.convertor;
 
-import org.outerj.i18n.I18nSupport;
-import org.outerj.i18n.DecimalFormat;
-
 import java.util.Locale;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
 import java.text.ParseException;
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -110,16 +109,19 @@
 
         switch (variant) {
             case INTEGER:
-                decimalFormat = I18nSupport.getInstance().getIntegerFormat(locale);
+                decimalFormat = (DecimalFormat)NumberFormat.getNumberInstance(locale);
+                decimalFormat.setMaximumFractionDigits(0);
+                decimalFormat.setDecimalSeparatorAlwaysShown(false);
+                decimalFormat.setParseIntegerOnly(true);
                 break;
             case NUMBER:
-                decimalFormat = I18nSupport.getInstance().getNumberFormat(locale);
+                decimalFormat = (DecimalFormat)NumberFormat.getNumberInstance(locale);
                 break;
             case CURRENCY:
-                decimalFormat = I18nSupport.getInstance().getCurrencyFormat(locale);
+                decimalFormat = (DecimalFormat)NumberFormat.getCurrencyInstance(locale);
                 break;
             case PERCENT:
-                decimalFormat = I18nSupport.getInstance().getPercentFormat(locale);
+                decimalFormat = (DecimalFormat)NumberFormat.getPercentInstance(locale);
                 break;
         }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingIntegerConvertor.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingIntegerConvertor.java?view=diff&rev=503643&r1=503642&r2=503643
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingIntegerConvertor.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingIntegerConvertor.java
Mon Feb  5 03:27:11 2007
@@ -16,9 +16,8 @@
  */
 package org.apache.cocoon.woody.datatype.convertor;
 
-import org.outerj.i18n.DecimalFormat;
-
 import java.util.Locale;
+import java.text.DecimalFormat;
 import java.text.ParseException;
 
 /**

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingLongConvertor.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingLongConvertor.java?view=diff&rev=503643&r1=503642&r2=503643
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingLongConvertor.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/woody/datatype/convertor/FormattingLongConvertor.java
Mon Feb  5 03:27:11 2007
@@ -16,9 +16,8 @@
  */
 package org.apache.cocoon.woody.datatype.convertor;
 
-import org.outerj.i18n.DecimalFormat;
-
 import java.util.Locale;
+import java.text.DecimalFormat;
 import java.text.ParseException;
 
 /**



Mime
View raw message