comparison flys-client/src/main/java/de/intevation/flys/client/shared/model/DoubleProperty.java @ 3368:bf080e932d54

Use more idiomatic Java when parsing doubles and ints. flys-client/trunk@5055 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 19 Jul 2012 09:00:42 +0000
parents c21d14e48040
children 62332fa199bf
comparison
equal deleted inserted replaced
3367:cccd6183b046 3368:bf080e932d54
33 } 33 }
34 34
35 @Override 35 @Override
36 public Double getValue() { 36 public Double getValue() {
37 try { 37 try {
38 GWT.log("returning: " + Double.valueOf(this.value)); 38 Double value = Double.valueOf(this.value);
39 return Double.valueOf(this.value); 39 GWT.log("returning: " + value);
40 return value;
40 } 41 }
41 catch(NumberFormatException nfe) { 42 catch(NumberFormatException nfe) {
42 //Should never happen, if property is used correctly. 43 //Should never happen, if property is used correctly.
43 return null; 44 return null;
44 } 45 }
63 64
64 public String toUIString() { 65 public String toUIString() {
65 double dv; 66 double dv;
66 NumberFormat nf = NumberFormat.getDecimalFormat(); 67 NumberFormat nf = NumberFormat.getDecimalFormat();
67 try { 68 try {
68 dv = Double.valueOf(this.value).doubleValue(); 69 dv = Double.parseDouble(this.value);
69 } 70 }
70 catch (NumberFormatException nfe) { 71 catch (NumberFormatException nfe) {
71 return null; 72 return null;
72 } 73 }
73 return nf.format(dv); 74 return nf.format(dv);

http://dive4elements.wald.intevation.org