diff --git a/bin/Logica/Gestion.class b/bin/Logica/Gestion.class index 6d6d95b..0c3a5da 100644 Binary files a/bin/Logica/Gestion.class and b/bin/Logica/Gestion.class differ diff --git a/bin/Logica/Transaccion.class b/bin/Logica/Transaccion.class index 6409146..e330ed9 100644 Binary files a/bin/Logica/Transaccion.class and b/bin/Logica/Transaccion.class differ diff --git a/src/Logica/Gestion.java b/src/Logica/Gestion.java index b8ec119..38414fa 100644 --- a/src/Logica/Gestion.java +++ b/src/Logica/Gestion.java @@ -9,6 +9,7 @@ public class Gestion{ private static float total; private static Month mes; private static Year anio; + private static String nombre; public Gestion() { this.gestiones=new Vector(); @@ -16,6 +17,17 @@ public class Gestion{ Gestion.total=0; } + public Gestion(String nombre) { + this.gestiones=new Vector(); + this.suma=0; + Gestion.total=0; + this.nombre=nombre; + } + + public String getNombre() { + return this.nombre; + } + public void aniadirGasto(Transaccion transaccion) { this.gestiones.add(transaccion); this.suma+=transaccion.getDinero(); diff --git a/src/Logica/Meses.java b/src/Logica/Meses.java new file mode 100644 index 0000000..ebdf0c9 --- /dev/null +++ b/src/Logica/Meses.java @@ -0,0 +1,27 @@ +package Logica; + +import java.time.Month; +import java.util.ArrayList; + +public class Meses { +private ArrayList meses; + public Meses() { + this.meses=new ArrayList(); + } + + public void aniadirTransaccion() { + + } + + +} + +class Mes{ + private int anio; + private Month mes; + int total; + ArrayList gestiones; + Mes(ArrayList gestiones){ + this.gestiones=gestiones; + } +} diff --git a/src/Logica/Transaccion.java b/src/Logica/Transaccion.java index 2e05623..e5700fd 100644 --- a/src/Logica/Transaccion.java +++ b/src/Logica/Transaccion.java @@ -50,4 +50,8 @@ public class Transaccion { public boolean isPositivo() { return this.positivo; } + + public LocalDate getDia() { + return this.dia; + } } diff --git a/src/VistaControlador/ControladorPanelLateral.java b/src/VistaControlador/ControladorPanelLateral.java index 3703441..d569405 100644 --- a/src/VistaControlador/ControladorPanelLateral.java +++ b/src/VistaControlador/ControladorPanelLateral.java @@ -4,19 +4,26 @@ import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.time.Year; import javax.swing.JFrame; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFrame; import org.jfree.chart.JFreeChart; +import org.jfree.data.time.Month; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; import com.github.lgooddatepicker.components.DatePicker; +import com.github.lgooddatepicker.optionalusertools.DateChangeListener; +import com.github.lgooddatepicker.zinternaltools.DateChangeEvent; import com.github.lgooddatepicker.zinternaltools.DemoPanel; -public class ControladorPanelLateral implements ActionListener{ +public class ControladorPanelLateral implements ActionListener, DateChangeListener{ private VistaPanelLateral vista; + private java.time.Month mes; + private int anio; + public ControladorPanelLateral(VistaPanelLateral vista) { this.vista=vista; @@ -45,8 +52,21 @@ public class ControladorPanelLateral implements ActionListener{ private void aniadirElementos() { this.vista.mostrarEstadisticas.addActionListener(this); this.vista.mostrarEstadisticas.setActionCommand("Mostrar estadisticas"); - //this.vista.elegirMes.addActionListener(this); - //this.vista.elegirMes.setActionCommand("Elegir mes"); + if(VistaPanelLateral.elegirMes.getDateChangeListeners().size()==0) { + VistaPanelLateral.elegirMes.addDateChangeListener(this); + this.mes=VistaPanelLateral.elegirMes.getDate().getMonth(); + this.anio=VistaPanelLateral.elegirMes.getDate().getYear(); + } + } + + public void dateChanged(DateChangeEvent arg0) { + if(this.mes!=VistaPanelLateral.elegirMes.getDate().getMonth() || + this.anio!=VistaPanelLateral.elegirMes.getDate().getYear()) { + System.out.println("Cambia mes"); + this.mes=VistaPanelLateral.elegirMes.getDate().getMonth(); + this.anio=VistaPanelLateral.elegirMes.getDate().getYear(); + } + } }