Reorgnizando la diferenciacion entre lo que suma y resta al total del

mes
This commit is contained in:
2019-11-14 20:31:28 +01:00
parent 0d7df06ad6
commit 21203e9524
7 changed files with 25 additions and 39 deletions

View File

@@ -60,11 +60,11 @@ public class Menu extends JFrame{
}
private void iniciarMes(int anio, Month mes) {
meses.aniadirGestion("Ingresos", anio, mes);
meses.aniadirGestion("Gastos", anio, mes);
meses.aniadirGestion("Ingresos", anio, mes, true);
meses.aniadirGestion("Gastos", anio, mes, false);
this.pestanias=new ArrayList<VistaAniadirVisualizar>();
this.pestanias.add(new VistaAniadirVisualizar(this,meses.getGestionesActuales().get(0),true));
this.pestanias.add(new VistaAniadirVisualizar(this,meses.getGestionesActuales().get(1),false));
this.pestanias.add(new VistaAniadirVisualizar(this,meses.getGestionesActuales().get(0)));
this.pestanias.add(new VistaAniadirVisualizar(this,meses.getGestionesActuales().get(1)));
this.controladores=new ArrayList<ControladorAniadirVisualizar>();
this.controladores.add(new ControladorAniadirVisualizar(this.pestanias.get(0)));
this.controladores.add(new ControladorAniadirVisualizar(this.pestanias.get(1)));
@@ -86,7 +86,7 @@ public class Menu extends JFrame{
this.pestanias=new ArrayList<VistaAniadirVisualizar>();
this.controladores=new ArrayList<ControladorAniadirVisualizar>();
for(Gestion gestion:this.meses.getGestionesActuales()) {
VistaAniadirVisualizar vista = new VistaAniadirVisualizar(this, gestion, true);
VistaAniadirVisualizar vista = new VistaAniadirVisualizar(this, gestion);
this.pestania.add(vista);
this.controladores.add(new ControladorAniadirVisualizar(vista));
}
@@ -100,8 +100,8 @@ public class Menu extends JFrame{
}
void aniadirGestion(String nombre, boolean sumaOResta) {
Gestion gestion=this.meses.aniadirGestion(nombre, VistaPanelLateral.getDate().getYear(), VistaPanelLateral.getDate().getMonth());
VistaAniadirVisualizar vista = new VistaAniadirVisualizar(this, gestion, sumaOResta);
Gestion gestion=this.meses.aniadirGestion(nombre, VistaPanelLateral.getDate().getYear(), VistaPanelLateral.getDate().getMonth(), sumaOResta);
VistaAniadirVisualizar vista = new VistaAniadirVisualizar(this, gestion);
this.pestanias.add(vista);
this.controladores.add(new ControladorAniadirVisualizar(vista));
this.pestania.addTab(vista.getName(),vista);

View File

@@ -20,10 +20,8 @@ public class VistaAniadirVisualizar extends JPanel{
JPanel cuadro;
JScrollPane panel;
Menu menu;
boolean positivo;
static VistaPanelLateral panelLateral;
public VistaAniadirVisualizar(Menu menu, Gestion gestion,boolean positivo) {
this.positivo = positivo;
public VistaAniadirVisualizar(Menu menu, Gestion gestion) {
this.gestiones = gestion;
this.transacciones = new LinkedList<JCheckBox>();
this.menu = menu;
@@ -49,7 +47,7 @@ public class VistaAniadirVisualizar extends JPanel{
}
public void aniadirElemento(String nombre, float dinero, ControladorAniadirVisualizar controlador) {
Transaccion transaccion = new Transaccion(nombre, dinero,panelLateral.getDate(),this.positivo);
Transaccion transaccion = new Transaccion(nombre, dinero,panelLateral.getDate());
this.gestiones.aniadirGasto(transaccion);
JCheckBox check = new JCheckBox(transaccion.toString());
check.setSelected(true);