chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1301920 - in /chemistry/opencmis/trunk: chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache...
Date Sat, 17 Mar 2012 11:30:29 GMT
Author: fmui
Date: Sat Mar 17 11:30:28 2012
New Revision: 1301920

URL: http://svn.apache.org/viewvc?rev=1301920&view=rev
Log:
Workbench: enabled very large integers and decimals in property editor

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java?rev=1301920&r1=1301919&r2=1301920&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
Sat Mar 17 11:30:28 2012
@@ -1756,6 +1756,8 @@ public class JSONConverter {
                             for (Object obj : values) {
                                 if (obj instanceof BigDecimal) {
                                     propertyValues.add((BigDecimal) obj);
+                                } else if (obj instanceof BigInteger) {
+                                    propertyValues.add(new BigDecimal((BigInteger) obj));
                                 } else {
                                     throw new CmisRuntimeException("Invalid property value:
" + obj);
                                 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java?rev=1301920&r1=1301919&r2=1301920&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
Sat Mar 17 11:30:28 2012
@@ -28,6 +28,8 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 import java.awt.event.KeyListener;
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.text.DecimalFormat;
 import java.text.Format;
 import java.text.NumberFormat;
@@ -509,9 +511,20 @@ public class PropertyEditorFrame extends
         private static final long serialVersionUID = 1L;
 
         public IntegerPropertyInputField(final Object value, final UpdateStatus status, final
Color bgColor) {
-            super(value, NumberFormat.getIntegerInstance(), status, bgColor);
+            super(value, createFormat(), status, bgColor);
             setHorizontalAlignment(JTextField.RIGHT);
         }
+
+        private static DecimalFormat createFormat() {
+            DecimalFormat result = new DecimalFormat("#,##0");
+            result.setParseBigDecimal(true);
+            result.setParseIntegerOnly(true);
+            return result;
+        }
+
+        public Object getPropertyValue() throws Exception {
+            return ((BigDecimal) super.getValue()).toBigIntegerExact();
+        }
     }
 
     /**
@@ -521,9 +534,15 @@ public class PropertyEditorFrame extends
         private static final long serialVersionUID = 1L;
 
         public DecimalPropertyInputField(final Object value, final UpdateStatus status, final
Color bgColor) {
-            super(value, new DecimalFormat("#,##0.##########"), status, bgColor);
+            super(value, createFormat(), status, bgColor);
             setHorizontalAlignment(JTextField.RIGHT);
         }
+
+        private static DecimalFormat createFormat() {
+            DecimalFormat result = new DecimalFormat("#,##0.#############################");
+            result.setParseBigDecimal(true);
+            return result;
+        }
     }
 
     /**



Mime
View raw message