[Bug #1183] Implement the replacement of decimal comma with dot in the client side.
FEA: ItEr75S04BugFixing
This commit is contained in:
parent
06c579e4df
commit
a6d08249a6
4 changed files with 23 additions and 18 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<package name="webcommon" language="xul/html" depends="zul.inp">
|
||||
<widget name="LenientDecimalBox"/>
|
||||
</package>
|
||||
Loading…
Add table
Reference in a new issue