Agregado nro z inicial y nro z final a tabla ingresos
This commit is contained in:
@@ -31,7 +31,6 @@ import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
|
||||
import danielcortes.xyz.views.IngresosView;
|
||||
import danielcortes.xyz.views.components.IngresosTableModel;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
@@ -121,11 +120,15 @@ public class IngresosController {
|
||||
*/
|
||||
private void setupViewEvents() {
|
||||
this.view.getValorField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
|
||||
this.view.getNroZInicialField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
|
||||
this.view.getNroZFinalField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
|
||||
this.view.getNroInicialField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
|
||||
this.view.getNroFinalField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
|
||||
this.view.getTipoCombo().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "save");
|
||||
|
||||
this.view.getValorField().getActionMap().put("nextField", new NextAction(this.view.getNroInicialField()));
|
||||
this.view.getValorField().getActionMap().put("nextField", new NextAction(this.view.getNroZInicialField()));
|
||||
this.view.getNroZInicialField().getActionMap().put("nextField", new NextAction(this.view.getNroZFinalField()));
|
||||
this.view.getNroZFinalField().getActionMap().put("nextField", new NextAction(this.view.getNroInicialField()));
|
||||
this.view.getNroInicialField().getActionMap().put("nextField", new NextAction(this.view.getNroFinalField()));
|
||||
this.view.getNroFinalField().getActionMap().put("nextField", new NextAction(this.view.getTipoCombo()));
|
||||
this.view.getTipoCombo().getActionMap().put("save", new GuardarAction(this));
|
||||
@@ -156,14 +159,16 @@ public class IngresosController {
|
||||
this.hideErrorMessages();
|
||||
|
||||
String valor = this.view.getValorField().getText();
|
||||
String nroZInicial = this.view.getNroZInicialField().getText();
|
||||
String nroZFinal = this.view.getNroZFinalField().getText();
|
||||
String nroInicial = this.view.getNroInicialField().getText();
|
||||
String nroFinal = this.view.getNroFinalField().getText();
|
||||
TipoIngreso tipoIngreso = (TipoIngreso) this.view.getTipoCombo().getSelectedItem();
|
||||
|
||||
if(editing) {
|
||||
this.editarIngreso(valor, nroInicial, nroFinal, tipoIngreso, this.caja);
|
||||
this.editarIngreso(valor, nroZInicial, nroZFinal, nroInicial, nroFinal, tipoIngreso, this.caja);
|
||||
} else {
|
||||
this.guardarIngreso(valor, nroInicial, nroFinal, tipoIngreso, this.caja);
|
||||
this.guardarIngreso(valor, nroZInicial, nroZFinal, nroInicial, nroFinal, tipoIngreso, this.caja);
|
||||
}
|
||||
this.resetFocus();
|
||||
}
|
||||
@@ -204,6 +209,8 @@ public class IngresosController {
|
||||
|
||||
this.view.getTipoCombo().setSelectedItem(ingreso.getTipoIngreso());
|
||||
this.view.getValorField().setText(String.valueOf(ingreso.getValor()));
|
||||
this.view.getNroZInicialField().setText(String.valueOf(ingreso.getNroZInicial()));
|
||||
this.view.getNroZFinalField().setText(String.valueOf(ingreso.getNroZFinal()));
|
||||
this.view.getNroInicialField().setText(String.valueOf(ingreso.getNroInicial()));
|
||||
this.view.getNroFinalField().setText(String.valueOf(ingreso.getNroFinal()));
|
||||
}
|
||||
@@ -236,12 +243,14 @@ public class IngresosController {
|
||||
* Guarda un ingreso tras llamar a validar el input
|
||||
* Luego de guardar agrega a la tabla el ingreso, llama a limpiar los campos de input y a actualizar el total de ingresos
|
||||
*/
|
||||
private void guardarIngreso(String valor, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja){
|
||||
if(this.validateInput(valor, nroInicial, nroFinal, tipoIngreso, caja)){
|
||||
private void guardarIngreso(String valor, String nroZInicial, String nroZFinal, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja){
|
||||
if(this.validateInput(valor, nroZInicial, nroZFinal, nroInicial, nroFinal, tipoIngreso, caja)){
|
||||
Ingreso ingreso = new Ingreso();
|
||||
ingreso.setTipoIngreso(tipoIngreso);
|
||||
ingreso.setCaja(caja);
|
||||
ingreso.setValor(Integer.valueOf(valor));
|
||||
ingreso.setNroZInicial(nroZInicial);
|
||||
ingreso.setNroZFinal(nroZFinal);
|
||||
ingreso.setNroInicial(nroInicial);
|
||||
ingreso.setNroFinal(nroFinal);
|
||||
|
||||
@@ -258,10 +267,12 @@ public class IngresosController {
|
||||
* Tras esto actualiza el ingreso en la tabla, llama a actualizar el total de ingresos, a limpiar los campos de input y a desactivar la flag de editing.
|
||||
*
|
||||
*/
|
||||
private void editarIngreso(String valor, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja){
|
||||
if(this.validateInput(valor, nroInicial, nroFinal, tipoIngreso, caja)){
|
||||
private void editarIngreso(String valor, String nroZInicial, String nroZFinal, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja){
|
||||
if(this.validateInput(valor, nroZInicial, nroZFinal, nroInicial, nroFinal, tipoIngreso, caja)){
|
||||
this.editingIngreso.setTipoIngreso(tipoIngreso);
|
||||
this.editingIngreso.setValor(Integer.valueOf(valor));
|
||||
this.editingIngreso.setNroZInicial(nroZInicial);
|
||||
this.editingIngreso.setNroZFinal(nroZFinal);
|
||||
this.editingIngreso.setNroInicial(nroInicial);
|
||||
this.editingIngreso.setNroFinal(nroFinal);
|
||||
this.ingresoDAO.updateIngreso(this.editingIngreso);
|
||||
@@ -276,10 +287,12 @@ public class IngresosController {
|
||||
* Llama a los metodos necesarios para validar el input
|
||||
* @return true cuando todas las validaciones retoran true, si no, false
|
||||
*/
|
||||
private boolean validateInput(String valor, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja) {
|
||||
private boolean validateInput(String valor, String nroZInicial, String nroZFinal, String nroInicial, String nroFinal, TipoIngreso tipoIngreso, Caja caja) {
|
||||
this.hideErrorMessages();
|
||||
|
||||
boolean valorValidation = this.validateValor(valor);
|
||||
boolean nroZInicialValidation = this.validateNroZInicial(nroZInicial);
|
||||
boolean nroZFinalValidation = this.validateNroZFinal(nroZFinal);
|
||||
boolean nroInicialValidation = this.validateNroInicial(nroInicial);
|
||||
boolean nroFinalValidation = this.validateNroFinal(nroFinal);
|
||||
boolean tipoIngresoValidation = this.validateTipoIngreso(tipoIngreso);
|
||||
@@ -335,6 +348,50 @@ public class IngresosController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Valida la variable nroInicial contra los casos
|
||||
* - Es null
|
||||
* - Esta vacio
|
||||
* Cuando el primer caso sea true, colocara un mensaje de error correspondiente en el jlabel correspondiente
|
||||
* @return Si cualquiera de estos casos son true se retornara false, si no, se retorna true
|
||||
*/
|
||||
private boolean validateNroZInicial(String nroZInicial){
|
||||
if (nroZInicial == null) {
|
||||
this.view.getErrorNroInicial().setText("Hubo un problema con los datos");
|
||||
this.view.getErrorNroInicial().setVisible(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nroZInicial.isEmpty()) {
|
||||
this.view.getErrorNroInicial().setText("El campo esta vacio");
|
||||
this.view.getErrorNroInicial().setVisible(true);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valida la variable nroFinal contra los casos
|
||||
* - Es null
|
||||
* - Esta vacio
|
||||
* Cuando el primer caso sea true, colocara un mensaje de error correspondiente en el jlabel correspondiente
|
||||
* @return Si cualquiera de estos casos son true se retornara false, si no, se retorna true
|
||||
*/
|
||||
private boolean validateNroZFinal(String nroZFinal){
|
||||
if (nroZFinal == null) {
|
||||
this.view.getErrorNroFinal().setText("Hubo un problema con los datos");
|
||||
this.view.getErrorNroFinal().setVisible(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nroZFinal.isEmpty()) {
|
||||
this.view.getErrorNroFinal().setText("El campo esta vacio");
|
||||
this.view.getErrorNroFinal().setVisible(true);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valida la variable nroInicial contra los casos
|
||||
* - Es null
|
||||
@@ -400,6 +457,8 @@ public class IngresosController {
|
||||
private void hideErrorMessages() {
|
||||
this.view.getErrorTipoIngreso().setVisible(false);
|
||||
this.view.getErrorValor().setVisible(false);
|
||||
this.view.getErrorNroZInicial().setVisible(false);
|
||||
this.view.getErrorNroZFinal().setVisible(false);
|
||||
this.view.getErrorNroInicial().setVisible(false);
|
||||
this.view.getErrorNroFinal().setVisible(false);
|
||||
}
|
||||
@@ -410,6 +469,8 @@ public class IngresosController {
|
||||
private void clearInputs() {
|
||||
this.view.getTipoCombo().setSelectedIndex(0);
|
||||
this.view.getValorField().setText("");
|
||||
this.view.getNroZInicialField().setText("");
|
||||
this.view.getNroZFinalField().setText("");
|
||||
this.view.getNroInicialField().setText("");
|
||||
this.view.getNroFinalField().setText("");
|
||||
}
|
||||
@@ -419,6 +480,8 @@ public class IngresosController {
|
||||
*/
|
||||
private void normalizeInputs(){
|
||||
this.view.getValorField().setText(this.view.getValorField().getText().trim());
|
||||
this.view.getNroZInicialField().setText(this.view.getNroZInicialField().getText().trim());
|
||||
this.view.getNroZFinalField().setText(this.view.getNroZFinalField().getText().trim());
|
||||
this.view.getNroInicialField().setText(this.view.getNroInicialField().getText().trim());
|
||||
this.view.getNroFinalField().setText(this.view.getNroFinalField().getText().trim());
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
||||
public class Ingreso {
|
||||
private int id;
|
||||
private int valor;
|
||||
private String nroZInicial;
|
||||
private String nroZFinal;
|
||||
private String nroInicial;
|
||||
private String nroFinal;
|
||||
private TipoIngreso tipoIngreso;
|
||||
@@ -51,6 +53,22 @@ public class Ingreso {
|
||||
this.valor = valor;
|
||||
}
|
||||
|
||||
public String getNroZInicial() {
|
||||
return nroZInicial;
|
||||
}
|
||||
|
||||
public void setNroZInicial(String nroZInicial) {
|
||||
this.nroZInicial = nroZInicial;
|
||||
}
|
||||
|
||||
public String getNroZFinal() {
|
||||
return nroZFinal;
|
||||
}
|
||||
|
||||
public void setNroZFinal(String nroZFinal) {
|
||||
this.nroZFinal = nroZFinal;
|
||||
}
|
||||
|
||||
public String getNroInicial() {
|
||||
return nroInicial;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ public abstract class IngresoDAO {
|
||||
|
||||
ingreso.setId(rs.getInt("id"));
|
||||
ingreso.setValor(rs.getInt("valor"));
|
||||
ingreso.setNroZInicial(rs.getString("nro_z_inicial"));
|
||||
ingreso.setNroZFinal(rs.getString("nro_z_final"));
|
||||
ingreso.setNroInicial(rs.getString("nro_inicial"));
|
||||
ingreso.setNroFinal(rs.getString("nro_final"));
|
||||
ingreso.setTipoIngreso(tipoIngreso);
|
||||
|
||||
@@ -129,12 +129,14 @@ public class SQLiteIngresoDAO extends IngresoDAO {
|
||||
int updates;
|
||||
try {
|
||||
Connection conn = connectionHolder.getConnection();
|
||||
PreparedStatement ps = conn.prepareStatement("insert into ingresos (valor, nro_inicial, nro_final, tipo_ingreso_id, caja_id) values (?,?,?,?,?)");
|
||||
PreparedStatement ps = conn.prepareStatement("insert into ingresos (valor, nro_z_inicial, nro_z_final, nro_inicial, nro_final, tipo_ingreso_id, caja_id) values (?,?,?,?,?,?,?)");
|
||||
ps.setInt(1, ingreso.getValor());
|
||||
ps.setString(2, ingreso.getNroInicial());
|
||||
ps.setString(3, ingreso.getNroFinal());
|
||||
ps.setInt(4, ingreso.getTipoIngreso().getId());
|
||||
ps.setInt(5, ingreso.getCaja().getId());
|
||||
ps.setString(2, ingreso.getNroZInicial());
|
||||
ps.setString(3, ingreso.getNroZFinal());
|
||||
ps.setString(4, ingreso.getNroInicial());
|
||||
ps.setString(5, ingreso.getNroFinal());
|
||||
ps.setInt(6, ingreso.getTipoIngreso().getId());
|
||||
ps.setInt(7, ingreso.getCaja().getId());
|
||||
|
||||
updates = ps.executeUpdate();
|
||||
ps.close();
|
||||
@@ -158,13 +160,15 @@ public class SQLiteIngresoDAO extends IngresoDAO {
|
||||
int updates;
|
||||
try {
|
||||
Connection conn = connectionHolder.getConnection();
|
||||
PreparedStatement ps = conn.prepareStatement("update ingresos set valor = ? , nro_inicial = ?, nro_final = ?, tipo_ingreso_id = ?, caja_id = ? where id = ?");
|
||||
PreparedStatement ps = conn.prepareStatement("update ingresos set valor = ?, nro_z_inicial = ?, nro_z_final = ?, nro_inicial = ?, nro_final = ?, tipo_ingreso_id = ?, caja_id = ? where id = ?");
|
||||
ps.setInt(1,ingreso.getValor());
|
||||
ps.setString(2, ingreso.getNroInicial());
|
||||
ps.setString(3, ingreso.getNroFinal());
|
||||
ps.setInt(4, ingreso.getTipoIngreso().getId());
|
||||
ps.setInt(5, ingreso.getCaja().getId());
|
||||
ps.setInt(6, ingreso.getId());
|
||||
ps.setString(2, ingreso.getNroZInicial());
|
||||
ps.setString(3, ingreso.getNroZFinal());
|
||||
ps.setString(4, ingreso.getNroInicial());
|
||||
ps.setString(5, ingreso.getNroFinal());
|
||||
ps.setInt(6, ingreso.getTipoIngreso().getId());
|
||||
ps.setInt(7, ingreso.getCaja().getId());
|
||||
ps.setInt(8, ingreso.getId());
|
||||
|
||||
updates = ps.executeUpdate();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="1" 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>
|
||||
<xy x="20" y="20" width="766" height="411"/>
|
||||
<xy x="20" y="20" width="994" height="411"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -29,17 +29,19 @@
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<grid id="7fa26" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="7fa26" layout-manager="GridLayoutManager" row-count="3" column-count="6" 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="1" 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="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="50b32" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Tipo"/>
|
||||
@@ -47,7 +49,7 @@
|
||||
</component>
|
||||
<component id="b5d8c" class="javax.swing.JComboBox" binding="tipoCombo">
|
||||
<constraints>
|
||||
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="1" column="5" 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="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -73,7 +75,7 @@
|
||||
</component>
|
||||
<component id="9bb1" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="N° Inicial"/>
|
||||
@@ -81,7 +83,7 @@
|
||||
</component>
|
||||
<component id="3f626" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="N° Final"/>
|
||||
@@ -89,7 +91,7 @@
|
||||
</component>
|
||||
<component id="461c1" class="javax.swing.JTextField" binding="nroInicialField">
|
||||
<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">
|
||||
<grid row="1" column="3" 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="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -97,7 +99,7 @@
|
||||
</component>
|
||||
<component id="949e" class="javax.swing.JTextField" binding="nroFinalField">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="1" column="4" 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="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -105,7 +107,7 @@
|
||||
</component>
|
||||
<component id="d11b0" class="javax.swing.JLabel" binding="errorTipoIngreso">
|
||||
<constraints>
|
||||
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="5" 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"/>
|
||||
@@ -125,7 +127,7 @@
|
||||
</component>
|
||||
<component id="7d011" class="javax.swing.JLabel" binding="errorNroInicial">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="3" 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"/>
|
||||
@@ -134,6 +136,58 @@
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ef90" class="javax.swing.JLabel" binding="errorNroFinal">
|
||||
<constraints>
|
||||
<grid row="2" column="4" 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="Label"/>
|
||||
<visible value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="12ae4" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" 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>
|
||||
<text value="N° Z Inicial"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="b7649" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="N° Z Final"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="63176" class="javax.swing.JTextField" binding="nroZInicialField">
|
||||
<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="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="a57c4" class="javax.swing.JTextField" binding="nroZFinalField">
|
||||
<constraints>
|
||||
<grid row="1" column="2" 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="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="b4963" class="javax.swing.JLabel" binding="errorNroZInicial">
|
||||
<constraints>
|
||||
<grid row="2" 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="Label"/>
|
||||
<visible value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="441ff" class="javax.swing.JLabel" binding="errorNroZFinal">
|
||||
<constraints>
|
||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
import com.intellij.uiDesigner.core.Spacer;
|
||||
import danielcortes.xyz.models.tipo_ingreso.TipoIngreso;
|
||||
import danielcortes.xyz.views.components.EgresosTableModel;
|
||||
import danielcortes.xyz.views.components.IngresosTableModel;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -50,6 +49,10 @@ public class IngresosView {
|
||||
private JTextField nroFinalField;
|
||||
private JLabel errorNroInicial;
|
||||
private JLabel errorNroFinal;
|
||||
private JTextField nroZInicialField;
|
||||
private JTextField nroZFinalField;
|
||||
private JLabel errorNroZFinal;
|
||||
private JLabel errorNroZInicial;
|
||||
|
||||
private IngresosTableModel ingresosTableModel;
|
||||
|
||||
@@ -126,6 +129,21 @@ public class IngresosView {
|
||||
return ingresosTableModel;
|
||||
}
|
||||
|
||||
public JTextField getNroZInicialField() {
|
||||
return nroZInicialField;
|
||||
}
|
||||
|
||||
public JTextField getNroZFinalField() {
|
||||
return nroZFinalField;
|
||||
}
|
||||
|
||||
public JLabel getErrorNroZFinal() {
|
||||
return errorNroZFinal;
|
||||
}
|
||||
|
||||
public JLabel getErrorNroZInicial() {
|
||||
return errorNroZInicial;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
@@ -153,35 +171,35 @@ public class IngresosView {
|
||||
panel1.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
|
||||
scrollPane1.setViewportView(ingresosTable);
|
||||
final JPanel panel2 = new JPanel();
|
||||
panel2.setLayout(new GridLayoutManager(3, 4, new Insets(0, 0, 0, 0), -1, -1));
|
||||
panel1.add(panel2, 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));
|
||||
panel2.setLayout(new GridLayoutManager(3, 6, new Insets(0, 0, 0, 0), -1, -1));
|
||||
panel1.add(panel2, 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, new Dimension(150, -1), null, 0, false));
|
||||
final JLabel label1 = new JLabel();
|
||||
label1.setText("Tipo");
|
||||
panel2.add(label1, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
panel2.add(label1, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
tipoCombo = new JComboBox();
|
||||
final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
|
||||
tipoCombo.setModel(defaultComboBoxModel1);
|
||||
panel2.add(tipoCombo, 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));
|
||||
panel2.add(tipoCombo, new GridConstraints(1, 5, 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 label2 = new JLabel();
|
||||
label2.setText("Valor");
|
||||
panel2.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
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("N° Inicial");
|
||||
panel2.add(label3, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
label3.setText("N° Boleta 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("N° Final");
|
||||
panel2.add(label4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
label4.setText("N° Boleta 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, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||
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));
|
||||
nroFinalField = new JTextField();
|
||||
panel2.add(nroFinalField, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||
panel2.add(nroFinalField, new GridConstraints(1, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||
errorTipoIngreso = new JLabel();
|
||||
errorTipoIngreso.setForeground(new Color(-65536));
|
||||
errorTipoIngreso.setText("Label");
|
||||
errorTipoIngreso.setVisible(false);
|
||||
panel2.add(errorTipoIngreso, new GridConstraints(2, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
panel2.add(errorTipoIngreso, new GridConstraints(2, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
errorValor = new JLabel();
|
||||
errorValor.setForeground(new Color(-65536));
|
||||
errorValor.setText("Label");
|
||||
@@ -191,21 +209,41 @@ public class IngresosView {
|
||||
errorNroInicial.setForeground(new Color(-65536));
|
||||
errorNroInicial.setText("Label");
|
||||
errorNroInicial.setVisible(false);
|
||||
panel2.add(errorNroInicial, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
panel2.add(errorNroInicial, new GridConstraints(2, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
errorNroFinal = new JLabel();
|
||||
errorNroFinal.setForeground(new Color(-65536));
|
||||
errorNroFinal.setText("Label");
|
||||
errorNroFinal.setVisible(false);
|
||||
panel2.add(errorNroFinal, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
panel2.add(errorNroFinal, new GridConstraints(2, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JLabel label5 = new JLabel();
|
||||
label5.setText("N° Z Inicial");
|
||||
panel2.add(label5, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JLabel label6 = new JLabel();
|
||||
label6.setText("N° Z Final");
|
||||
panel2.add(label6, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
nroZInicialField = new JTextField();
|
||||
panel2.add(nroZInicialField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||
nroZFinalField = new JTextField();
|
||||
panel2.add(nroZFinalField, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||
errorNroZInicial = new JLabel();
|
||||
errorNroZInicial.setForeground(new Color(-65536));
|
||||
errorNroZInicial.setText("Label");
|
||||
errorNroZInicial.setVisible(false);
|
||||
panel2.add(errorNroZInicial, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
errorNroZFinal = new JLabel();
|
||||
errorNroZFinal.setForeground(new Color(-65536));
|
||||
errorNroZFinal.setText("Label");
|
||||
errorNroZFinal.setVisible(false);
|
||||
panel2.add(errorNroZFinal, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JPanel panel3 = new JPanel();
|
||||
panel3.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
|
||||
panel1.add(panel3, new GridConstraints(2, 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));
|
||||
final JPanel panel4 = new JPanel();
|
||||
panel4.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||
panel3.add(panel4, new GridConstraints(0, 2, 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));
|
||||
final JLabel label5 = new JLabel();
|
||||
label5.setText("Total Ingresos");
|
||||
panel4.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
||||
final JLabel label7 = new JLabel();
|
||||
label7.setText("Total Ingresos");
|
||||
panel4.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));
|
||||
totalIngresoField = new JTextField();
|
||||
totalIngresoField.setEditable(false);
|
||||
panel4.add(totalIngresoField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
|
||||
@@ -233,4 +271,5 @@ public class IngresosView {
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return contentPanel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class IngresosTableModel extends AbstractTableModel {
|
||||
|
||||
public IngresosTableModel() {
|
||||
super();
|
||||
this.columns = new String[]{"Valor", "N° Inicial", "N° Final", "Tipo"};
|
||||
this.columns = new String[]{"Valor","N° Z Inicial", "N° Z Final", "N° Inicial", "N° Final", "Tipo"};
|
||||
this.rows = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -78,10 +78,14 @@ public class IngresosTableModel extends AbstractTableModel {
|
||||
case 0:
|
||||
return this.rows.get(row).getValor();
|
||||
case 1:
|
||||
return this.rows.get(row).getNroInicial();
|
||||
return this.rows.get(row).getNroZInicial();
|
||||
case 2:
|
||||
return this.rows.get(row).getNroFinal();
|
||||
return this.rows.get(row).getNroZFinal();
|
||||
case 3:
|
||||
return this.rows.get(row).getNroInicial();
|
||||
case 4:
|
||||
return this.rows.get(row).getNroFinal();
|
||||
case 5:
|
||||
return this.rows.get(row).getTipoIngreso().getNombre();
|
||||
}
|
||||
return null;
|
||||
@@ -96,11 +100,4 @@ public class IngresosTableModel extends AbstractTableModel {
|
||||
this.fireTableRowsUpdated(getRowCount() - 2, getRowCount() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
if (rows.isEmpty()) {
|
||||
return Object.class;
|
||||
}
|
||||
return getValueAt(0, columnIndex).getClass();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user