[Bug #1183] Implement the replacement of decimal comma with dot in the client side.

FEA: ItEr75S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2011-10-13 19:09:22 +02:00
parent 06c579e4df
commit a6d08249a6
4 changed files with 23 additions and 18 deletions

View file

@ -43,22 +43,4 @@ public class LenientDecimalBox extends Decimalbox {
super(value);
}
@Override
protected Object coerceFromString(String value) throws WrongValueException {
return super
.coerceFromString(interpretCommasAndPointsAsDecimalSeparator(value));
}
private String interpretCommasAndPointsAsDecimalSeparator(String value) {
if (value == null) {
return null;
}
final DecimalFormatSymbols symbols = new DecimalFormatSymbols(
Locales.getCurrent());
char decimalSeparator = symbols.getDecimalSeparator();
return value.replace('.', decimalSeparator).replace(',',
decimalSeparator);
}
}

View file

@ -88,6 +88,12 @@
<macro-uri>/common/components/templateFinder.zul</macro-uri>
</component>
<component>
<component-name>LenientDecimalBox</component-name>
<component-class>org.navalplanner.web.common.LenientDecimalBox</component-class>
<widget-class>webcommon.LenientDecimalBox</widget-class>
</component>
<component>
<component-name>LimitingResourcesPanel</component-name>
<component-class>org.navalplanner.web.limitingresources.LimitingResourcesPanel</component-class>

View file

@ -0,0 +1,14 @@
zk.$package("webcommon");
webcommon.LenientDecimalBox = zk.$extends(zul.inp.Decimalbox,{
coerceFromString_: function (b) {
if(!b) {
return null;
}
//replace decimal comma with dot
b = b.replace(',','.');
//process normally
return this.$supers('coerceFromString_', arguments);
}
});

View file

@ -0,0 +1,3 @@
<package name="webcommon" language="xul/html" depends="zul.inp">
<widget name="LenientDecimalBox"/>
</package>