Creacion de number formated text field y implementacion de prueba como campos de efectivo

This commit is contained in:
Daniel Cortes
2019-01-05 22:00:29 -03:00
parent 4c087680cd
commit d27c48c10a
8 changed files with 534 additions and 526 deletions

View File

@@ -90,15 +90,15 @@ public class ArqueoController {
*/
private void fillEfectivo() {
this.efectivo = this.efectivoDAO.findByCaja(this.caja);
this.view.getVeinteMilField().setText(String.valueOf(efectivo.getVeinteMil()));
this.view.getDiezMilField().setText(String.valueOf(efectivo.getDiezMil()));
this.view.getCincoMilField().setText(String.valueOf(efectivo.getCincoMil()));
this.view.getDosMilField().setText(String.valueOf(efectivo.getDosMil()));
this.view.getMilField().setText(String.valueOf(efectivo.getMil()));
this.view.getQuinientosField().setText(String.valueOf(efectivo.getQuinientos()));
this.view.getCienField().setText(String.valueOf(efectivo.getCien()));
this.view.getCincuentaField().setText(String.valueOf(efectivo.getCincuenta()));
this.view.getDiezField().setText(String.valueOf(efectivo.getDiez()));
this.view.getVeinteMilField().setValue(efectivo.getVeinteMil());
this.view.getDiezMilField().setValue(efectivo.getDiezMil());
this.view.getCincoMilField().setValue(efectivo.getCincoMil());
this.view.getDosMilField().setValue(efectivo.getDosMil());
this.view.getMilField().setValue(efectivo.getMil());
this.view.getQuinientosField().setValue(efectivo.getQuinientos());
this.view.getCienField().setValue(efectivo.getCien());
this.view.getCincuentaField().setValue(efectivo.getCincuenta());
this.view.getDiezField().setValue(efectivo.getDiez());
}
/**
@@ -223,8 +223,7 @@ public class ArqueoController {
* Primero llama a normalizar el input, luego a esconder los mensajes de error, para finalmente llamar a guardar el efectivo
*/
private void guardarEfectivoActionListener(){
this.normalizeEfectivoInput();
this.hiddeEfectivoErrorMessages();
this.view.getGuardarEfectivoButton().requestFocus();
this.guardarEfectivo();
}
@@ -243,31 +242,29 @@ public class ArqueoController {
* llama a updateResumenEfectivo y updateResumenArqueo para actualizar los datos en efectivoField y arqueoField
*/
private void guardarEfectivo() {
String diez = this.view.getDiezField().getText();
String cincuenta = this.view.getCincuentaField().getText();
String cien = this.view.getCienField().getText();
String quinientos = this.view.getQuinientosField().getText();
String mil = this.view.getMilField().getText();
String dosMil = this.view.getDosMilField().getText();
String cincoMil = this.view.getCincoMilField().getText();
String diezMil = this.view.getDiezMilField().getText();
String veinteMil = this.view.getVeinteMilField().getText();
int diez = this.view.getDiezField().getValue();
int cincuenta = this.view.getCincuentaField().getValue();
int cien = this.view.getCienField().getValue();
int quinientos = this.view.getQuinientosField().getValue();
int mil = this.view.getMilField().getValue();
int dosMil = this.view.getDosMilField().getValue();
int cincoMil = this.view.getCincoMilField().getValue();
int diezMil = this.view.getDiezMilField().getValue();
int veinteMil = this.view.getVeinteMilField().getValue();
if (this.validateEfectivoInput(diez, cincuenta, cien, quinientos, mil, dosMil, cincoMil, diezMil, veinteMil)) {
this.efectivo.setDiez(Integer.valueOf(diez));
this.efectivo.setCincuenta(Integer.valueOf(cincuenta));
this.efectivo.setCien(Integer.valueOf(cien));
this.efectivo.setQuinientos(Integer.valueOf(quinientos));
this.efectivo.setMil(Integer.valueOf(mil));
this.efectivo.setDosMil(Integer.valueOf(dosMil));
this.efectivo.setCincoMil(Integer.valueOf(cincoMil));
this.efectivo.setDiezMil(Integer.valueOf(diezMil));
this.efectivo.setVeinteMil(Integer.valueOf(veinteMil));
this.efectivo.setDiez(diez);
this.efectivo.setCincuenta(cincuenta);
this.efectivo.setCien(cien);
this.efectivo.setQuinientos(quinientos);
this.efectivo.setMil(mil);
this.efectivo.setDosMil(dosMil);
this.efectivo.setCincoMil(cincoMil);
this.efectivo.setDiezMil(diezMil);
this.efectivo.setVeinteMil(veinteMil);
this.efectivoDAO.updateEfectivo(efectivo);
this.updateResumenEfectivo();
this.updateResumenArqueo();
}
}
/**
@@ -288,25 +285,6 @@ public class ArqueoController {
}
}
/**
* Llama a las validaciones necesarias para el input de Efectivo
* @return si es que paso todas las validaciones.
*/
private boolean validateEfectivoInput(String diez, String cincuenta, String cien, String quinientos, String mil, String dosMil, String cincoMil, String diezMil, String veinteMil) {
boolean diezValidation = validateEfectivoMoneda(diez, this.view.getErrorDiez());
boolean cincuentaValidation = validateEfectivoMoneda(cincuenta, this.view.getErrorCincuenta());
boolean cienValidation = validateEfectivoMoneda(cien, this.view.getErrorCien());
boolean quinientosValidation = validateEfectivoMoneda(quinientos, this.view.getErrorQuinientos());
boolean milValidation = validateEfectivoMoneda(mil, this.view.getErrorMil());
boolean dosMilValidation = validateEfectivoMoneda(dosMil, this.view.getErrorDosMil());
boolean cincoMilValidation = validateEfectivoMoneda(cincoMil, this.view.getErrorCincoMil());
boolean diezMilValidation = validateEfectivoMoneda(diezMil, this.view.getErrorDiezMil());
boolean veinteMilValidation = validateEfectivoMoneda(veinteMil, this.view.getErrorVeinteMil());
return diezValidation && cincuentaValidation && cienValidation && quinientosValidation && milValidation && dosMilValidation && cincoMilValidation && diezMilValidation && veinteMilValidation;
}
/**
* Llama a las validaciones necesarias el input de Documentos
* @return si es que todas las validaciones fueron correctas
@@ -319,43 +297,6 @@ public class ArqueoController {
return tarjetasValidation && chequesValidation;
}
/**
* Valida el valor entregado contra las siguientes pruebas
* - Es null
* - Esta vacio
* - Los caracteres no son solamente digitos
* - El largo es mayor que diez
* Setea un mensaje de error correspondiente en el errorLabel entregado.
* @return cuando cualquiera de los casos anteriores sea true se retorna falso, si no retorna true.
*/
private boolean validateEfectivoMoneda(String valor, JLabel errorLabel) {
if (valor == null) {
errorLabel.setText("Hubo un problema con los datos");
errorLabel.setVisible(true);
return false;
}
if (valor.isEmpty()) {
errorLabel.setText("El campo esta vacio");
errorLabel.setVisible(true);
return false;
}
if (!valor.chars().allMatch(Character::isDigit)) {
errorLabel.setText("Deben ser numeros");
errorLabel.setVisible(true);
return false;
}
if (valor.length() > 10) {
errorLabel.setText("El numero ingresado es demasiado largo");
errorLabel.setVisible(true);
return false;
}
return true;
}
/**
* Valida el valor entregado contra las siguientes pruebas
* - Es null
@@ -394,21 +335,6 @@ public class ArqueoController {
return true;
}
/**
* Esconde los mensajes de error de los campos de efectivo
*/
private void hiddeEfectivoErrorMessages() {
this.view.getErrorDiez().setVisible(false);
this.view.getErrorCincuenta().setVisible(false);
this.view.getErrorCien().setVisible(false);
this.view.getErrorQuinientos().setVisible(false);
this.view.getErrorMil().setVisible(false);
this.view.getErrorDosMil().setVisible(false);
this.view.getErrorCincoMil().setVisible(false);
this.view.getErrorDiezMil().setVisible(false);
this.view.getErrorVeinteMil().setVisible(false);
}
/**
* Esconde los mensajes de error en los campos de documentos
*/
@@ -417,21 +343,6 @@ public class ArqueoController {
this.view.getErrorCheques().setVisible(false);
}
/**
* Ejecuta trim sobre todos los campos de efectivo
*/
private void normalizeEfectivoInput() {
this.view.getDiezField().setText(this.view.getDiezField().getText().trim());
this.view.getCincuentaField().setText(this.view.getCincuentaField().getText().trim());
this.view.getCienField().setText(this.view.getCienField().getText().trim());
this.view.getQuinientosField().setText(this.view.getQuinientosField().getText().trim());
this.view.getMilField().setText(this.view.getMilField().getText().trim());
this.view.getDosMilField().setText(this.view.getDosMilField().getText().trim());
this.view.getCincoMilField().setText(this.view.getCincoMilField().getText().trim());
this.view.getDiezMilField().setText(this.view.getDiezMilField().getText().trim());
this.view.getVeinteMilField().setText(this.view.getVeinteMilField().getText().trim());
}
/**
* Ejecuta trim sobre todos los campos de documentos
*/

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="danielcortes.xyz.views.ArqueoView">
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="642" height="837"/>
@@ -146,12 +146,12 @@
<grid id="b1b74" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="3" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="3f85f" layout-manager="GridLayoutManager" row-count="19" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="3f85f" layout-manager="GridLayoutManager" row-count="10" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -169,47 +169,47 @@
<text value="$20000"/>
</properties>
</component>
<component id="99f2e" class="javax.swing.JTextField" binding="veinteMilField">
<component id="89600" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="veinteMilField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
<text value=""/>
</properties>
</component>
<component id="584ed" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$10000"/>
</properties>
</component>
<component id="5431d" class="javax.swing.JTextField" binding="diezMilField">
<component id="ff144" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="diezMilField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="11196" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="cincoMilField">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
</properties>
</component>
<component id="af49b" class="javax.swing.JTextField" binding="cincoMilField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
<text value=""/>
</properties>
</component>
<component id="8d468" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$5000"/>
@@ -217,35 +217,35 @@
</component>
<component id="7a8c3" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$2000"/>
</properties>
</component>
<component id="bbb4" class="javax.swing.JTextField" binding="dosMilField">
<component id="582c4" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="dosMilField">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
<text value=""/>
</properties>
</component>
<component id="4807e" class="javax.swing.JTextField" binding="milField">
<component id="4136e" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="milField">
<constraints>
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
<text value=""/>
</properties>
</component>
<component id="e80c8" class="javax.swing.JLabel">
<constraints>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$1000"/>
@@ -253,79 +253,79 @@
</component>
<component id="62d5d" class="javax.swing.JLabel">
<constraints>
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$500"/>
</properties>
</component>
<component id="3d6c3" class="javax.swing.JTextField" binding="quinientosField">
<component id="31f7f" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="quinientosField">
<constraints>
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
<text value=""/>
</properties>
</component>
<component id="7910b" class="javax.swing.JLabel">
<constraints>
<grid row="12" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$100"/>
</properties>
</component>
<component id="8f6e8" class="javax.swing.JTextField" binding="cienField">
<component id="e113" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="cienField">
<constraints>
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
<text value=""/>
</properties>
</component>
<component id="e105f" class="javax.swing.JLabel">
<constraints>
<grid row="14" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$50"/>
</properties>
</component>
<component id="22b2c" class="javax.swing.JTextField" binding="cincuentaField">
<component id="e42bf" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="cincuentaField">
<constraints>
<grid row="14" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
<text value=""/>
</properties>
</component>
<component id="fcf59" class="javax.swing.JLabel">
<constraints>
<grid row="16" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="$10"/>
</properties>
</component>
<component id="6f156" class="javax.swing.JTextField" binding="diezField">
<component id="5cbd1" class="danielcortes.xyz.views.components.NumberFormatedTextField" binding="diezField">
<constraints>
<grid row="16" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
<properties>
<text value="0"/>
<text value=""/>
</properties>
</component>
<component id="a2c3f" class="javax.swing.JButton" binding="guardarEfectivoButton">
<constraints>
<grid row="18" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<grid row="9" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="200" height="-1"/>
</grid>
</constraints>
@@ -333,96 +333,6 @@
<text value="Guardar"/>
</properties>
</component>
<component id="92070" class="javax.swing.JLabel" binding="errorVeinteMil">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
<component id="52622" class="javax.swing.JLabel" binding="errorDiezMil">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
<component id="12e87" class="javax.swing.JLabel" binding="errorCincoMil">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
<component id="c4ae2" class="javax.swing.JLabel" binding="errorDosMil">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
<component id="78dc8" class="javax.swing.JLabel" binding="errorMil">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
<component id="f9374" class="javax.swing.JLabel" binding="errorQuinientos">
<constraints>
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
<component id="b7c59" class="javax.swing.JLabel" binding="errorCien">
<constraints>
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
<component id="c66e5" class="javax.swing.JLabel" binding="errorCincuenta">
<constraints>
<grid row="15" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
<component id="fa2bc" class="javax.swing.JLabel" binding="errorDiez">
<constraints>
<grid row="17" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<foreground color="-65536"/>
<text value="Error"/>
<visible value="false"/>
</properties>
</component>
</children>
</grid>
<grid id="1ca11" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -505,7 +415,7 @@
</grid>
<vspacer id="d3dd4">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>

View File

@@ -28,6 +28,7 @@ package danielcortes.xyz.views;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import danielcortes.xyz.views.components.NumberFormatedTextField;
import javax.swing.*;
import javax.swing.border.TitledBorder;
@@ -35,15 +36,15 @@ import java.awt.*;
public class ArqueoView {
private JPanel contentPanel;
private JTextField veinteMilField;
private JTextField diezMilField;
private JTextField cincoMilField;
private JTextField dosMilField;
private JTextField milField;
private JTextField quinientosField;
private JTextField cienField;
private JTextField cincuentaField;
private JTextField diezField;
private NumberFormatedTextField veinteMilField;
private NumberFormatedTextField diezMilField;
private NumberFormatedTextField cincoMilField;
private NumberFormatedTextField dosMilField;
private NumberFormatedTextField milField;
private NumberFormatedTextField quinientosField;
private NumberFormatedTextField cienField;
private NumberFormatedTextField cincuentaField;
private NumberFormatedTextField diezField;
private JTextField chequesField;
private JTextField tarjetasField;
private JTextField efectivoField;
@@ -52,15 +53,6 @@ public class ArqueoView {
private JTextField rendidoField;
private JButton guardarEfectivoButton;
private JButton guardarDocumentosButton;
private JLabel errorVeinteMil;
private JLabel errorDiezMil;
private JLabel errorCincoMil;
private JLabel errorDosMil;
private JLabel errorMil;
private JLabel errorQuinientos;
private JLabel errorCien;
private JLabel errorCincuenta;
private JLabel errorDiez;
private JLabel errorCheques;
private JLabel errorTarjetas;
private JTextField diferenciaField;
@@ -70,39 +62,39 @@ public class ArqueoView {
return contentPanel;
}
public JTextField getVeinteMilField() {
public NumberFormatedTextField getVeinteMilField() {
return veinteMilField;
}
public JTextField getDiezMilField() {
public NumberFormatedTextField getDiezMilField() {
return diezMilField;
}
public JTextField getCincoMilField() {
public NumberFormatedTextField getCincoMilField() {
return cincoMilField;
}
public JTextField getDosMilField() {
public NumberFormatedTextField getDosMilField() {
return dosMilField;
}
public JTextField getMilField() {
public NumberFormatedTextField getMilField() {
return milField;
}
public JTextField getQuinientosField() {
public NumberFormatedTextField getQuinientosField() {
return quinientosField;
}
public JTextField getCienField() {
public NumberFormatedTextField getCienField() {
return cienField;
}
public JTextField getCincuentaField() {
public NumberFormatedTextField getCincuentaField() {
return cincuentaField;
}
public JTextField getDiezField() {
public NumberFormatedTextField getDiezField() {
return diezField;
}
@@ -130,14 +122,6 @@ public class ArqueoView {
return rendidoField;
}
public JTextField getDebeRendirField() {
return debeRendirField;
}
public JTextField getDiferenciaField() {
return diferenciaField;
}
public JButton getGuardarEfectivoButton() {
return guardarEfectivoButton;
}
@@ -146,42 +130,6 @@ public class ArqueoView {
return guardarDocumentosButton;
}
public JLabel getErrorVeinteMil() {
return errorVeinteMil;
}
public JLabel getErrorDiezMil() {
return errorDiezMil;
}
public JLabel getErrorCincoMil() {
return errorCincoMil;
}
public JLabel getErrorDosMil() {
return errorDosMil;
}
public JLabel getErrorMil() {
return errorMil;
}
public JLabel getErrorQuinientos() {
return errorQuinientos;
}
public JLabel getErrorCien() {
return errorCien;
}
public JLabel getErrorCincuenta() {
return errorCincuenta;
}
public JLabel getErrorDiez() {
return errorDiez;
}
public JLabel getErrorCheques() {
return errorCheques;
}
@@ -190,6 +138,14 @@ public class ArqueoView {
return errorTarjetas;
}
public JTextField getDiferenciaField() {
return diferenciaField;
}
public JTextField getDebeRendirField() {
return debeRendirField;
}
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
@@ -206,7 +162,7 @@ public class ArqueoView {
*/
private void $$$setupUI$$$() {
contentPanel = new JPanel();
contentPanel.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(7, 2, new Insets(10, 10, 10, 10), -1, -1));
contentPanel.add(panel1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
@@ -263,113 +219,68 @@ public class ArqueoView {
panel1.add(efectivoField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
contentPanel.add(panel2, new GridConstraints(0, 0, 2, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
contentPanel.add(panel2, new GridConstraints(0, 0, 3, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(19, 2, new Insets(10, 10, 10, 10), -1, -1));
panel3.setLayout(new GridLayoutManager(10, 2, new Insets(10, 10, 10, 10), -1, -1));
panel2.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
panel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Detalle Efectivo", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, -1, -1, panel3.getFont())));
final JLabel label7 = new JLabel();
label7.setText("$20000");
panel3.add(label7, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
veinteMilField = new JTextField();
veinteMilField.setText("0");
veinteMilField = new NumberFormatedTextField();
veinteMilField.setText("");
panel3.add(veinteMilField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label8 = new JLabel();
label8.setText("$10000");
panel3.add(label8, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
diezMilField = new JTextField();
diezMilField.setText("0");
panel3.add(diezMilField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
cincoMilField = new JTextField();
cincoMilField.setText("0");
panel3.add(cincoMilField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
panel3.add(label8, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
diezMilField = new NumberFormatedTextField();
diezMilField.setText("");
panel3.add(diezMilField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
cincoMilField = new NumberFormatedTextField();
cincoMilField.setText("");
panel3.add(cincoMilField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label9 = new JLabel();
label9.setText("$5000");
panel3.add(label9, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel3.add(label9, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label10 = new JLabel();
label10.setText("$2000");
panel3.add(label10, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
dosMilField = new JTextField();
dosMilField.setText("0");
panel3.add(dosMilField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
milField = new JTextField();
milField.setText("0");
panel3.add(milField, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
panel3.add(label10, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
dosMilField = new NumberFormatedTextField();
dosMilField.setText("");
panel3.add(dosMilField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
milField = new NumberFormatedTextField();
milField.setText("");
panel3.add(milField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label11 = new JLabel();
label11.setText("$1000");
panel3.add(label11, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel3.add(label11, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label12 = new JLabel();
label12.setText("$500");
panel3.add(label12, new GridConstraints(10, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
quinientosField = new JTextField();
quinientosField.setText("0");
panel3.add(quinientosField, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
panel3.add(label12, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
quinientosField = new NumberFormatedTextField();
quinientosField.setText("");
panel3.add(quinientosField, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label13 = new JLabel();
label13.setText("$100");
panel3.add(label13, new GridConstraints(12, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cienField = new JTextField();
cienField.setText("0");
panel3.add(cienField, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
panel3.add(label13, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cienField = new NumberFormatedTextField();
cienField.setText("");
panel3.add(cienField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label14 = new JLabel();
label14.setText("$50");
panel3.add(label14, new GridConstraints(14, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cincuentaField = new JTextField();
cincuentaField.setText("0");
panel3.add(cincuentaField, new GridConstraints(14, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
panel3.add(label14, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cincuentaField = new NumberFormatedTextField();
cincuentaField.setText("");
panel3.add(cincuentaField, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JLabel label15 = new JLabel();
label15.setText("$10");
panel3.add(label15, new GridConstraints(16, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
diezField = new JTextField();
diezField.setText("0");
panel3.add(diezField, new GridConstraints(16, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
panel3.add(label15, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
diezField = new NumberFormatedTextField();
diezField.setText("");
panel3.add(diezField, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
guardarEfectivoButton = new JButton();
guardarEfectivoButton.setText("Guardar");
panel3.add(guardarEfectivoButton, new GridConstraints(18, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
errorVeinteMil = new JLabel();
errorVeinteMil.setForeground(new Color(-65536));
errorVeinteMil.setText("Error");
errorVeinteMil.setVisible(false);
panel3.add(errorVeinteMil, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorDiezMil = new JLabel();
errorDiezMil.setForeground(new Color(-65536));
errorDiezMil.setText("Error");
errorDiezMil.setVisible(false);
panel3.add(errorDiezMil, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorCincoMil = new JLabel();
errorCincoMil.setForeground(new Color(-65536));
errorCincoMil.setText("Error");
errorCincoMil.setVisible(false);
panel3.add(errorCincoMil, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorDosMil = new JLabel();
errorDosMil.setForeground(new Color(-65536));
errorDosMil.setText("Error");
errorDosMil.setVisible(false);
panel3.add(errorDosMil, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorMil = new JLabel();
errorMil.setForeground(new Color(-65536));
errorMil.setText("Error");
errorMil.setVisible(false);
panel3.add(errorMil, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorQuinientos = new JLabel();
errorQuinientos.setForeground(new Color(-65536));
errorQuinientos.setText("Error");
errorQuinientos.setVisible(false);
panel3.add(errorQuinientos, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorCien = new JLabel();
errorCien.setForeground(new Color(-65536));
errorCien.setText("Error");
errorCien.setVisible(false);
panel3.add(errorCien, new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorCincuenta = new JLabel();
errorCincuenta.setForeground(new Color(-65536));
errorCincuenta.setText("Error");
errorCincuenta.setVisible(false);
panel3.add(errorCincuenta, new GridConstraints(15, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
errorDiez = new JLabel();
errorDiez.setForeground(new Color(-65536));
errorDiez.setText("Error");
errorDiez.setVisible(false);
panel3.add(errorDiez, new GridConstraints(17, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
panel3.add(guardarEfectivoButton, new GridConstraints(9, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
final JPanel panel4 = new JPanel();
panel4.setLayout(new GridLayoutManager(5, 2, new Insets(10, 10, 10, 10), -1, -1));
panel2.add(panel4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
@@ -400,7 +311,7 @@ public class ArqueoView {
errorTarjetas.setVisible(false);
panel4.add(errorTarjetas, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
contentPanel.add(spacer1, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
contentPanel.add(spacer1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
}
/**

View File

@@ -186,10 +186,10 @@ public class IngresosView {
valorField = new JTextField();
panel2.add(valorField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
final JLabel label3 = new JLabel();
label3.setText(" Boleta Inicial");
label3.setText("N° Inicial");
panel2.add(label3, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label4 = new JLabel();
label4.setText(" Boleta Final");
label4.setText("N° Final");
panel2.add(label4, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
nroInicialField = new JTextField();
panel2.add(nroInicialField, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));

View File

@@ -0,0 +1,116 @@
/*
* MIT License
*
* Copyright (c) 2018-2019 Daniel Cortes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package danielcortes.xyz.views.components;
import javax.swing.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.text.NumberFormat;
import java.text.ParseException;
public class NumberFormatedTextField extends JTextField {
private int value;
private NumberFormat nf;
public NumberFormatedTextField() {
super();
this.nf = NumberFormat.getIntegerInstance();
this.addFocusListener(new FieldFocusListener());
this.addKeyListener(new FieldKeyAdapter());
}
public void setValue(int value){
this.value = value;
this.setText(nf.format(value));
}
public int getValue(){
return this.value;
}
private void readValue(){
try {
String currentText = this.getText();
if(currentText.length() > 0){
this.value = nf.parse(currentText).intValue();
}
} catch (ParseException e) {
e.printStackTrace();
}
}
private void formatText(){
this.setText(nf.format(this.value));
}
private class FieldFocusListener implements FocusListener{
/**
* Selecciona todo al momento de ganar foco
*/
@Override
public void focusGained(FocusEvent e) {
NumberFormatedTextField.this.select(0, getText().length());
}
/**
* Actualiza el texto y el valor interno al perder el foco
*/
@Override
public void focusLost(FocusEvent e) {
NumberFormatedTextField.this.readValue();
NumberFormatedTextField.this.formatText();
}
}
private class FieldKeyAdapter extends KeyAdapter{
/**
* Solo permitir introducir un maximo de 9 digitos
*/
@Override
public void keyTyped(KeyEvent e) {
String currentText = NumberFormatedTextField.this.getText();
int parsedText = 0;
if(currentText.length() > 0) {
try {
parsedText = nf.parse(currentText).intValue();
} catch (ParseException e1) {
e1.printStackTrace();
}
}
int length = String.valueOf(parsedText).length();
if (length >= 9) {
e.consume();
}
}
}
}