Author: tchemit Date: 2014-02-11 12:23:30 +0100 (Tue, 11 Feb 2014) New Revision: 2790 Url: http://nuiton.org/projects/jaxx/repository/revisions/2790 Log: fixes #3073: NumberEditor does not support Double modelType Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java Modified: trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java =================================================================== --- trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2014-02-04 11:18:11 UTC (rev 2789) +++ trunk/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java 2014-02-11 11:23:30 UTC (rev 2790) @@ -302,7 +302,7 @@ // on a un nombre valide try { - Float f = Float.parseFloat(s); + Double f = Double.parseDouble(s); if (!editor.isUseSign() && s.startsWith("-")) { if (log.isDebugEnabled()) { log.debug("will skip since can not allow sign on this editor but was " + f); @@ -382,13 +382,10 @@ } } - private Number getRealValue(Float f) { + private Number getRealValue(Double f) { if (modelType == Integer.class) { return f.intValue(); } - if (modelType == Float.class) { - return f; - } if (modelType == Double.class) { return f; } @@ -401,9 +398,8 @@ if (modelType == BigDecimal.class) { return new BigDecimal(f + ""); } - if (editor.isUseFloat()) { - // use default float value - return f; + if (modelType == Float.class || editor.isUseFloat()) { + return f.floatValue(); } return f.intValue(); } @@ -506,7 +502,7 @@ if (newValue == null && !getAcceptNull()) { // valeur nulle sur une propriete primitive // on ne peut pas utiliser la valeur null, mais 0 à la place - newValue = getRealValue(0.0f); + newValue = getRealValue(0.0d); // if (editor.isUseFloat()) { // if (log.isInfoEnabled()) { // log.info("use float, check mutator default type = " + mutator.getParameterTypes()[0]);