empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject empire-db git commit: EMPIREDB-220
Date Mon, 27 Jul 2015 12:30:05 GMT
Repository: empire-db
Updated Branches:
  refs/heads/master eb3c91179 -> 64e6d238d


EMPIREDB-220

Project: http://git-wip-us.apache.org/repos/asf/empire-db/repo
Commit: http://git-wip-us.apache.org/repos/asf/empire-db/commit/64e6d238
Tree: http://git-wip-us.apache.org/repos/asf/empire-db/tree/64e6d238
Diff: http://git-wip-us.apache.org/repos/asf/empire-db/diff/64e6d238

Branch: refs/heads/master
Commit: 64e6d238df328261fb022a1902f2088fa182523e
Parents: eb3c911
Author: Rainer Döbele <doebele@apache.org>
Authored: Mon Jul 27 14:30:00 2015 +0200
Committer: Rainer Döbele <doebele@apache.org>
Committed: Mon Jul 27 14:30:00 2015 +0200

----------------------------------------------------------------------
 .../org/apache/empire/jsf2/controls/InputControl.java  |  2 +-
 .../apache/empire/jsf2/controls/TextInputControl.java  | 13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/64e6d238/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
----------------------------------------------------------------------
diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
index 5001d85..77cd091 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/InputControl.java
@@ -505,7 +505,7 @@ public abstract class InputControl
         return (format!=null ? format.indexOf(option)>=0 : false);
     }
     
-    private String getFormatOption(ValueInfo vi, String option)
+    protected String getFormatOption(ValueInfo vi, String option)
     {
         // Is unit supplied with format
         String format = vi.getFormat();

http://git-wip-us.apache.org/repos/asf/empire-db/blob/64e6d238/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
----------------------------------------------------------------------
diff --git a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
index 54f8472..7d561b6 100644
--- a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
+++ b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
@@ -60,6 +60,9 @@ public class TextInputControl extends InputControl
     public static final String DATE_FORMAT = "date-format:";
     public static final String DATE_FORMAT_ATTRIBUTE = "format:date";
     
+    public static final String GROUP_SEPARATOR = "group-separator:";
+    public static final String FRACTION_DIGITS = "fraction-digits:";
+    
     private Class<? extends javax.faces.component.html.HtmlInputText> inputComponentClass;
     
     public TextInputControl(String name, Class<? extends HtmlInputText> inputComponentClass)
@@ -253,7 +256,7 @@ public class TextInputControl extends InputControl
         }
         if (dataType == DataType.DECIMAL || dataType == DataType.FLOAT)
         { // Dezimal oder Double
-            NumberFormat nf = getNumberFormat(dataType, vi.getLocale(), column);
+            NumberFormat nf = getNumberFormat(dataType, vi);
             return nf.format(value);
         }
         if (dataType == DataType.DATE || dataType == DataType.DATETIME)
@@ -457,8 +460,10 @@ public class TextInputControl extends InputControl
         return DataType.UNKNOWN;
     }
     
-    protected NumberFormat getNumberFormat(DataType dataType, Locale locale, Column column)
+    protected NumberFormat getNumberFormat(DataType dataType, ValueInfo vi)
     {
+        Column column = vi.getColumn();
+        Locale locale = vi.getLocale();
         if (column==null)
             return NumberFormat.getNumberInstance(locale); 
         // Column is supplied
@@ -469,10 +474,10 @@ public class TextInputControl extends InputControl
         else
             nf = NumberFormat.getNumberInstance(locale);
         // Groups Separator?
-        Object groupSep = column.getAttribute(InputControl.NUMBER_GROUPSEP_ATTRIBUTE);
+        Object groupSep = getFormatOption(vi, GROUP_SEPARATOR, NUMBER_GROUPSEP_ATTRIBUTE);

         nf.setGroupingUsed(groupSep!=null && ObjectUtils.getBoolean(groupSep));
         // Fraction Digits?
-        Object fractDigit = column.getAttribute(InputControl.NUMBER_FRACTION_DIGITS);
+        Object fractDigit = getFormatOption(vi, FRACTION_DIGITS, InputControl.NUMBER_FRACTION_DIGITS);
         if (fractDigit!=null)
         {   int fractionDigits = ObjectUtils.getInteger(fractDigit);
             nf.setMaximumFractionDigits(fractionDigits);


Mime
View raw message