The numberDecimalSeparator
is used in Jmix components via property Datatype, when the value should be formatted for presentation.
In case of %.2f
we cannot configure which char will be used for group or decimal separation.
The example above just does not specify separator chars, but we can do the following:
@Autowired
private CurrentAuthentication currentAuthentication;
@Autowired
private FormatStringsRegistry formatStringsRegistry;
@Supply(to = "orderLinesDataGrid.value", subject = "renderer")
private Renderer<OrderLine> tasksDataGridTestRenderer() {
DecimalFormat numberFormat = (DecimalFormat) DecimalFormat.getNumberInstance(currentAuthentication.getLocale());
FormatStrings formatStrings = formatStringsRegistry.getFormatStrings(currentAuthentication.getLocale());
numberFormat.setDecimalFormatSymbols(formatStrings.getFormatSymbols());
numberFormat.applyPattern("#,##0.00");
return new NumberRenderer<>(OrderLine::getValue, numberFormat);
}
We retrieve information about separator chars from FormatStringsRegistry
and then from FormatStrings
.