git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@20680 d1611594-4594-4d17-8e1d-87c2c4800839
parent
ab5cb1f4f9
commit
0c2bb1ac83
|
@ -252,27 +252,22 @@ public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
|||
columns.appendChild(columnSecuencia);
|
||||
|
||||
Column columnOrigen = new Column(Labels.getLabel("gridRutaSecuencia.columnOrigen.label"));
|
||||
columnOrigen.setWidth("25%");
|
||||
columns.appendChild(columnOrigen);
|
||||
|
||||
Column columnDestino = new Column(Labels.getLabel("gridRutaSecuencia.columnDestino.label"));
|
||||
columnDestino.setWidth("25%");
|
||||
columns.appendChild(columnDestino);
|
||||
|
||||
Column columnVia = new Column(Labels.getLabel("gridRutaSecuencia.columnVia.label"));
|
||||
columnVia.setWidth("25%");
|
||||
columns.appendChild(columnVia);
|
||||
|
||||
Column kmsReal = new Column(Labels.getLabel("gridRutaSecuencia.columnKmsReal.label"));
|
||||
kmsReal.setWidth("20%");
|
||||
columns.appendChild(kmsReal);
|
||||
|
||||
Column tiempoRecorrido = new Column(Labels.getLabel("gridRutaSecuencia.columnTiempoRecorrido.label"));
|
||||
tiempoRecorrido.setWidth("15%");
|
||||
columns.appendChild(tiempoRecorrido);
|
||||
|
||||
Column columnIDTramo = new Column(Labels.getLabel("gridRutaSecuencia.columnIDTramo.label"));
|
||||
columnIDTramo.setWidth("5%");
|
||||
columnIDTramo.setWidth("7%");
|
||||
columns.appendChild(columnIDTramo);
|
||||
|
||||
return columns;
|
||||
|
|
|
@ -80,8 +80,9 @@ public class BusquedaRestriccionFormaPagoController extends MyGenericForwardComp
|
|||
ConfigRestriccionPago.class,
|
||||
pagingrestriccionFormaPago.getPageSize());
|
||||
|
||||
configRestriccionPagoBusqueda.addFilterLike("formaPago.descpago",
|
||||
"%" + txtNome.getText().trim().concat("%"));
|
||||
if (!txtNome.getText().isEmpty()) {
|
||||
configRestriccionPagoBusqueda.addFilterLike("formaPago.descpago", "%" + txtNome.getText().trim().concat("%"));
|
||||
}
|
||||
|
||||
configRestriccionPagoBusqueda.addSortAsc("formaPago.descpago");
|
||||
configRestriccionPagoBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||
|
|
|
@ -703,11 +703,11 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer
|
|||
comboVenda.setMold("rounded");
|
||||
comboVenda.setWidth("90%");
|
||||
List<String> op = new ArrayList<String>();
|
||||
op.add("Si");
|
||||
op.add("No");
|
||||
op.add("Sim");
|
||||
op.add("Não");
|
||||
comboVenda.setModel(new ListModelList(op));
|
||||
comboVenda.setValue(rutaCombinacion.getIndventa() == Boolean.TRUE ? "Si"
|
||||
: "No");
|
||||
comboVenda.setValue(rutaCombinacion.getIndventa() == Boolean.TRUE ? "Sim"
|
||||
: "Não");
|
||||
comboVenda.setTooltip(rutaCombinacion.getRutacombinacionId().toString());
|
||||
comboVenda.addEventListener("onChange", new EventListener() {
|
||||
|
||||
|
|
|
@ -16,60 +16,62 @@ import org.zkoss.zul.Constraint;
|
|||
*/
|
||||
public class ConstraintNumberBD implements Constraint {
|
||||
|
||||
private Integer precision;
|
||||
private Integer scale;
|
||||
private Boolean obligatorio = false;
|
||||
private Integer precision;
|
||||
private Integer scale;
|
||||
private Boolean obligatorio = false;
|
||||
|
||||
/**
|
||||
* Ex.: (precision,scale) == (3,2) Va a aceptar numero menores que 9.99
|
||||
* @param preicion - La precision del numero
|
||||
* @param scale - La escala
|
||||
*/
|
||||
public ConstraintNumberBD(Integer preicion, Integer scale) {
|
||||
this(preicion, scale, false);
|
||||
}
|
||||
/**
|
||||
* Ex.: (precision,scale) == (3,2) Va a aceptar numero menores que 9.99
|
||||
*
|
||||
* @param preicion
|
||||
* - La precision del numero
|
||||
* @param scale
|
||||
* - La escala
|
||||
*/
|
||||
public ConstraintNumberBD(Integer preicion, Integer scale) {
|
||||
this(preicion, scale, false);
|
||||
}
|
||||
|
||||
public ConstraintNumberBD(Integer preicion, Integer scale, Boolean obligatorio) {
|
||||
if ((preicion == null) || (scale == null)) {
|
||||
throw new IllegalArgumentException("Deve de ser informado el valor de la precicion y scale");
|
||||
}
|
||||
this.precision = preicion;
|
||||
this.scale = scale;
|
||||
this.obligatorio = obligatorio;
|
||||
}
|
||||
public ConstraintNumberBD(Integer preicion, Integer scale, Boolean obligatorio) {
|
||||
if ((preicion == null) || (scale == null)) {
|
||||
throw new IllegalArgumentException("Deve ser informado o valor de precisao e escala.");
|
||||
}
|
||||
this.precision = preicion;
|
||||
this.scale = scale;
|
||||
this.obligatorio = obligatorio;
|
||||
}
|
||||
|
||||
public void validate(Component comp, Object value) throws WrongValueException {
|
||||
public void validate(Component comp, Object value) throws WrongValueException {
|
||||
|
||||
if ((precision != null) && (scale != null)) {
|
||||
if ((precision != null) && (scale != null)) {
|
||||
|
||||
if ((value != null) && (value instanceof String)) {
|
||||
value = (((String) value).trim().equals("")) ? null : value;
|
||||
}
|
||||
if (obligatorio && (value == null)) {
|
||||
throw new WrongValueException(comp,
|
||||
Labels.getLabel("MSG.CONSTRAINT.CONSTRAINTNUMBERBDOBLIGATORIO"));
|
||||
}
|
||||
|
||||
if ((value != null) && (value instanceof String)) {
|
||||
value = (((String) value).trim().equals("")) ? null : value;
|
||||
}
|
||||
if (obligatorio && (value == null)) {
|
||||
throw new WrongValueException(comp,
|
||||
Labels.getLabel("MSG.CONSTRAINT.CONSTRAINTNUMBERBDOBLIGATORIO"));
|
||||
}
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
BigDecimal valor = getBigDecimal(value);
|
||||
|
||||
BigDecimal valor = getBigDecimal(value);
|
||||
if ((valor.precision() > precision) || (valor.scale() > scale)) {
|
||||
throw new WrongValueException(comp,
|
||||
Labels.getLabel("MSG.CONSTRAINT.CONSTRAINTNUMBERBD", new Object[] { precision - 2, scale }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((valor.precision() > precision) || (valor.scale() > scale)) {
|
||||
throw new WrongValueException(comp,
|
||||
Labels.getLabel("MSG.CONSTRAINT.CONSTRAINTNUMBERBD", new Object[]{precision - 2, scale}));
|
||||
}
|
||||
}
|
||||
}
|
||||
private BigDecimal getBigDecimal(Object value) {
|
||||
|
||||
private BigDecimal getBigDecimal(Object value) {
|
||||
if (value instanceof BigDecimal) {
|
||||
return (BigDecimal) value;
|
||||
}
|
||||
|
||||
if (value instanceof BigDecimal) {
|
||||
return (BigDecimal) value;
|
||||
}
|
||||
|
||||
return new BigDecimal((String) value);
|
||||
}
|
||||
return new BigDecimal(((String) value).replace(",", ""));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,29 +15,29 @@ import org.zkoss.zkplus.databind.TypeConverter;
|
|||
*/
|
||||
public class StringDecimalToDecimalConverter implements TypeConverter {
|
||||
|
||||
private static final String FORMAT = "###,##0.00";
|
||||
private static final String FORMAT = "#####0.00";
|
||||
|
||||
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(java.util.Locale.US));
|
||||
return df.format(val);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
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(java.util.Locale.US));
|
||||
return df.format(val);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object coerceToBean(Object val, Component cmpnt) {
|
||||
if (val == null){
|
||||
return null;
|
||||
}
|
||||
public Object coerceToBean(Object val, Component cmpnt) {
|
||||
if (val == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (val instanceof String) {
|
||||
if (val instanceof String) {
|
||||
|
||||
return (val.toString().trim().isEmpty())?(BigDecimal)null: new BigDecimal(val.toString().replace(",", ""));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return (val.toString().trim().isEmpty()) ? (BigDecimal) null : new BigDecimal(val.toString().replace(",", ""));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue