From 7b52f06a51f1efb5c3dba5bfc66c57f6e5189413 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Wed, 13 Nov 2019 22:51:49 +0100 Subject: [PATCH] Clasificacion por fecha y posibilidad de aniadir mas gestiones por mes --- bin/Logica/Gestion.class | Bin 1647 -> 1929 bytes bin/Logica/Transaccion.class | Bin 1593 -> 1663 bytes src/Logica/Gestion.java | 12 ++++++++ src/Logica/Meses.java | 27 ++++++++++++++++++ src/Logica/Transaccion.java | 4 +++ .../ControladorPanelLateral.java | 26 +++++++++++++++-- 6 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 src/Logica/Meses.java diff --git a/bin/Logica/Gestion.class b/bin/Logica/Gestion.class index 6d6d95b29a88e960726e509958124cc1d872c050..0c3a5daf98121832a2f05efaa9733885c94c0705 100644 GIT binary patch literal 1929 zcmZ{kTW=dx6ouEZo!D`vx#8HkH8gDlzChfT61OCzg|#o31(?2&m0uyELyz8n~vC321S>Xc})wHDB zbxeWmsRvfefz6I1t&XhMX|=M(Yq3tZEd|87z<_JJvLz60Ym;$b!&PmwxMf@JWBstS zl+Ex$N4uuf?t_-yu4(HaHZS&y>nN+KPgj+t+%-yPb5+XRu^VO*QKSt_;JrAedMSre zN+N^w5Cmoo3}8^t&Knp)QqSHuFpQ+YXjxh2cDG$KogG>GwuR$G|7J?niZ(xjXbD)OCGl*+2<51d^)r zjoneM+V>A12@JbOWfw@D6`#PliYx0sY{{nqwRqEXD_(abINR}?!{GE@%WRvLYZGao zNT_nen(u)MZNIYxCuGYt9qCk6N7YnIH6+o*vYS4!y9Vxo-5I5^Cbk(aLBLFBf8W5S z&OWTR-&0GNLCEa%O%kfuU8ioYE8Q_h&<#uarNRPBALZ*gh=^`GuHsxpkl>fi$9Yn> zo;Mme=Zzy6^+xs!#{}=NtNEMaszNovaXSA7lli}p*?oiQ*ObBP*VcVILIIo>yEAR!rq!imrT-A9{_)z1VJ;0s6 zapeFT&+xs6_1LZl_}C6n&obU)d&Qau{pqQFjsH2mJ41Jmg*&EkrmlZ~>Xfeb)BWj} zb=iBTmf3S9mh%P+b`#qy+Cvs?kGvHL{z!&D<2HUFh+m1~E&m~o%6-@`_aPqOD}vJH SP9XL#9%gQ(xGr-Y!Pfs7;CHS7 literal 1647 zcmZ`&U2hXd6g}hEIB}MI;UrGNHo-?yYZrI-0Qo2&5RHNWnrFo3j!F^nfM)orSWbPAJ54?$qYK?3_sH0NLlDH9!X zFpQMIXi0hQtxl`z2J5ogWOEZGzb2a%87Q-ll5u@sk@Q%%%}7l$bI4iNRj?}Cn%t+e z-7CFH9$-?`&1*H&FvWkDw6M${^op4$fkA!8B|nTRaH~fC8ddH*FwcEJ6OgQc1d8P*jfbG ztC{Kk7YDzZ?t80kb*l}!5oM0y8Wk%0ouKBfC}Xx0898qz9>+Ks1N`qK5Hl0QU6Q*P z2KnRMFix4Nv8#jqb{)YeS96zx$nOMqWmXYfXYy}wApaJV8*ecE8kzj?Ys?P+i-RwD z7{g(Hrw9a=io+BdMVe(YEOdlfCoF=aBnHOEaUueEOn?}37xJ%=DQx59ANh?}m}Qi$ z5`yde6O8|ZgEm9Jrx=NLn-Tngg+FXNOtZU5QklXbOe0GI1OMYcZ?P=Ne*N~ieQUZF zq;QdSLvt=!$$MclFTR33)dyDKXDqT5{SphN55Czka?WjI={<7WxcUV5tgO4TR^VM3 zNp875&kkypjJY?)0gDW} hW(3l#T3Z+tHUJq+3@Sj94J>Fr`2njayC+!G3jovC5a0j+ delta 36 scmey*vy+GG)W2Q(7#J8#7`!%eIWSKSW)5Uz-@KH01`{g-0~3QM0O$P*9smFU 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(); + } + } }