Merge branch 'master' into AL-2307

master
fabio 2023-05-30 21:00:54 +00:00
commit f86ed488b0
3 changed files with 48 additions and 4 deletions

View File

@ -9,7 +9,7 @@
<properties>
<modelWeb.version>1.5.1</modelWeb.version>
<flyway.version>1.3.6</flyway.version>
<flyway.version>1.3.7</flyway.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

View File

@ -0,0 +1,44 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.web.utilerias;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Locale;
import org.zkoss.zk.ui.Component;
import org.zkoss.zkplus.databind.TypeConverter;
/**
*
* @author Administrador
*/
public class StringDecimalToDecimalConverterScale5 implements TypeConverter {
private static final String FORMAT = "#####0.00000";
public Object coerceToUi(Object val, Component comp) {
if (val != null) {
String format = (String) comp.getAttribute("format");
if (format == null) {
format = FORMAT;
}
DecimalFormat df = new DecimalFormat(format, new java.text.DecimalFormatSymbols(new Locale("pt", "BR")));
return df.format(val);
}
return null;
}
public Object coerceToBean(Object val, Component cmpnt) {
if (val == null) {
return null;
}
if (val instanceof String) {
return (val.toString().trim().isEmpty()) ? (BigDecimal) null : new BigDecimal(val.toString().replace(".", "").replace(",", "."));
}
return null;
}
}

View File

@ -54,10 +54,10 @@
value="${c:l('busquedaCotacaoController.valor.label')}" />
<textbox id="txtValor" width="100%" mold="rounded"
constraint="no empty, no zero, no negative, /([0-9]+(\,[0-9][0-9]?)?)?/"
constraint="no empty, no zero, no negative"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal"
value="@{winEditarCotacao$composer.cotacao.valor,converter=com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter}"
precision="10" scale="2" />
value="@{winEditarCotacao$composer.cotacao.valor,converter=com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverterScale5}"
precision="10" scale="5" />
</row>