From 7d6a25303399741d448a905b62a41d1bccddf257 Mon Sep 17 00:00:00 2001 From: roche Date: Wed, 13 Nov 2019 13:59:45 +0100 Subject: [PATCH] Soporte a fecha iniciado --- .classpath | 2 ++ bin/Logica/Gestion.class | Bin 1579 -> 1647 bytes bin/Logica/Transaccion.class | Bin 1484 -> 1593 bytes src/Logica/Gestion.java | 4 ++++ src/Logica/Transaccion.java | 8 ++++--- .../ControladorPanelLateral.java | 17 +++++++++++---- src/VistaControlador/Menu.java | 1 + .../VistaAniadirVisualizar.java | 8 +++++-- src/VistaControlador/VistaPanelLateral.java | 20 +++++++++++++++--- 9 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.classpath b/.classpath index 79207fa..08f7d5d 100644 --- a/.classpath +++ b/.classpath @@ -4,5 +4,7 @@ + + diff --git a/bin/Logica/Gestion.class b/bin/Logica/Gestion.class index 84ca809d39d821111a6af1683ce83e6808677f2b..6d6d95b29a88e960726e509958124cc1d872c050 100644 GIT binary patch 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?)0g8vLo4ZhGGp_QL?D)1zB}0G9-3hY3wSQ(_%&qjNv$Yki{ZZd5$z#I+J`F#tBRY zG2!ZPLukM;kU-M)-MK^AHu>nsyuLGK;3TF6!m9evswzjV)eoNvbUJ(f3dCCJ6X?o1 zvhebreC0J9ESXN$jUmKpxt@Z-@^0B&H7kxqH)4t8fl%p4s>SwyvyRHLW7^WrsjAAW zvMNei6G$x99lK)SDhTN(v36|HBW(0ccYn>mobJ96ZEXiFWO|Z0Qj2sbYt`(6Ij?ls zh8N^1J-ry^VEFkv@WZDkhN~b~K7{z;+^`Poso_(faq#%v%~h5+1fN5xE%c;*p!dlZ z`Zf?tb#5Tu`3-|#c<93+e#Z$6f&~cEL$DZO1_?CGU84?y!#Ki~zzB|d1aDkPz@^kW zVpE$q_9*pa9dTCUc~bD1dWYVx7<6|?_yOJCYQ>}XyYwS&M-d9>rIaX%`Z!ZDOraka zG2qIGQ!1%E8M-=!G=-ezZUDZiFzYi&deZcX?!ArD;-6U5`_u-3lzV-(d4L@_yL)-u zeT%RZyZ`Qpdsj;lILE&xpBKgj*YZZ%*ynw;V=ZU}`@2La<|WSPK6qza+c~_6%fE19 z6SME|%(b;?*EP6lhgJ_$Z`0m*-ZlNzfqiZN2Rv?pyTag_Fk0f)?++fp)qHxY>akwr z1OXEab&_!=aD@)vM+!>}b_LT=jPNx>e9I8uGrW(?;3qCL#J#;6_cpHM2945jhYxaW;W*d; diff --git a/bin/Logica/Transaccion.class b/bin/Logica/Transaccion.class index 908129278669a8ba523ade7090adc9db02b4ab7a..64091466153377f6048ab5e0debe5fa9afe6d2df 100644 GIT binary patch delta 787 zcmZvY-%b-j7{$+QcP%U<6lk}#NNEc~nNk;}_^&F8h(H=H^ol#H5`w`tF%4dLLE;-U z^BP`YVhf7#0gP|qt-gZs4BH54Hk-`Ow|ma{otd8lU!?ov@7M1D%GhYR4KGoBUE8nu z&D}TKezozkwzpDiZdY3GUp#d&hVdva3yg+HBr=!~h}0YJ1d@f>(3pM*7|qSt$L%`gX7n3lUyRRvlqj72Alb zsWv=iw~Qb-~9;7`j@RH&8@klfs7dco@onz*hSHHoX)#8Xz|*cj7#sKz#)5CdKag5YID5KB=I@m73*(#l*5 zK7bb%ns~$q5MROv=qr?dlNFWV%|HJ?^PT>=wjUd+E~qE!x;5s|4fVlq&Mqf3`A?r$OtBsC5}Rto_x)Bv5Q3GJ*7T97~(-F)rw z6?yh@(i{`@+}&q~s3gefV+|`ANEKX}pi!+y8$H_T5g|6pE{0BYP|K-$j8PNp=%IcD zGDqA;>+x=x?p3c_cpLH$B3Br^M5b-Df{z?y6--nxbwQ-Rk)JGHRkeMlR^_`u9y8CX zS)N+eq=a)`L+(b0-rHxJFYGUvQLCox*Z*eG4gB>mbG~Au&)Bc()Qr~^Fsp9Ot}TuC YQ)S*@Uv=l+P36|6%DqdTr?`QI|EG#jZvX%Q diff --git a/src/Logica/Gestion.java b/src/Logica/Gestion.java index 2183cfb..b8ec119 100644 --- a/src/Logica/Gestion.java +++ b/src/Logica/Gestion.java @@ -1,10 +1,14 @@ package Logica; +import java.time.Month; +import java.time.Year; import java.util.Vector; public class Gestion{ private Vector gestiones; private float suma; private static float total; + private static Month mes; + private static Year anio; public Gestion() { this.gestiones=new Vector(); diff --git a/src/Logica/Transaccion.java b/src/Logica/Transaccion.java index a40c8f8..2e05623 100644 --- a/src/Logica/Transaccion.java +++ b/src/Logica/Transaccion.java @@ -1,21 +1,23 @@ package Logica; +import java.time.LocalDate; + public class Transaccion { private String nombre; private float dinero; private boolean visible; - private int dia; + private LocalDate dia; private boolean positivo; public Transaccion(String nombre, float dinero){ this.nombre=nombre; this.dinero=dinero; this.visible=true; - this.dia=1; + this.dia=LocalDate.now(); this.positivo=true; } - public Transaccion(String nombre, float dinero, int dia, boolean positivo){ + public Transaccion(String nombre, float dinero, LocalDate dia, boolean positivo){ this.nombre=nombre; this.dinero=dinero; this.visible=true; diff --git a/src/VistaControlador/ControladorPanelLateral.java b/src/VistaControlador/ControladorPanelLateral.java index e55d6f6..3703441 100644 --- a/src/VistaControlador/ControladorPanelLateral.java +++ b/src/VistaControlador/ControladorPanelLateral.java @@ -1,12 +1,20 @@ package VistaControlador; +import java.awt.Frame; +import java.awt.GridBagConstraints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + +import javax.swing.JFrame; + import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFrame; import org.jfree.chart.JFreeChart; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; + +import com.github.lgooddatepicker.components.DatePicker; +import com.github.lgooddatepicker.zinternaltools.DemoPanel; public class ControladorPanelLateral implements ActionListener{ private VistaPanelLateral vista; @@ -27,17 +35,18 @@ public class ControladorPanelLateral implements ActionListener{ ChartFrame frame=new ChartFrame("Estadisricas", chart); frame.setVisible(true); frame.setSize(700,500); - }else if(e.getActionCommand().equals(this.vista.elegirMes.getActionCommand())){ - } + //}else if(e.getActionCommand().equals(this.vista.elegirMes.getActionCommand())){ + + //} } 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"); + //this.vista.elegirMes.addActionListener(this); + //this.vista.elegirMes.setActionCommand("Elegir mes"); } } diff --git a/src/VistaControlador/Menu.java b/src/VistaControlador/Menu.java index a20baeb..e80c6b5 100644 --- a/src/VistaControlador/Menu.java +++ b/src/VistaControlador/Menu.java @@ -23,6 +23,7 @@ public class Menu extends JFrame{ protected Gestion datosGastos; protected Gestion datosIngresos; public Menu() { + VistaAniadirVisualizar.setPanelLateral(panel); this.datosGastos=new Gestion(); this.datosIngresos=new Gestion(); this.setLayout(new GridBagLayout()); diff --git a/src/VistaControlador/VistaAniadirVisualizar.java b/src/VistaControlador/VistaAniadirVisualizar.java index 5ab4343..e001dec 100644 --- a/src/VistaControlador/VistaAniadirVisualizar.java +++ b/src/VistaControlador/VistaAniadirVisualizar.java @@ -21,7 +21,7 @@ public class VistaAniadirVisualizar extends JPanel{ JScrollPane panel; Menu menu; boolean positivo; - + static VistaPanelLateral panelLateral; public VistaAniadirVisualizar(Menu menu, Gestion gestion,boolean positivo) { this.positivo=positivo; this.gestiones=gestion; @@ -41,8 +41,12 @@ public class VistaAniadirVisualizar extends JPanel{ this.add(panel); } + public static void setPanelLateral(VistaPanelLateral panel) { + VistaAniadirVisualizar.panelLateral=panel; + } + public void aniadirElemento(String nombre, float dinero, ControladorAniadirVisualizar controlador) { - Transaccion transaccion=new Transaccion(nombre, dinero,1,this.positivo); + Transaccion transaccion=new Transaccion(nombre, dinero,panelLateral.getDate(),this.positivo); this.gestiones.aniadirGasto(transaccion); JCheckBox check=new JCheckBox(transaccion.toString()); check.setSelected(true); diff --git a/src/VistaControlador/VistaPanelLateral.java b/src/VistaControlador/VistaPanelLateral.java index 4fcf7b4..8999f45 100644 --- a/src/VistaControlador/VistaPanelLateral.java +++ b/src/VistaControlador/VistaPanelLateral.java @@ -2,30 +2,34 @@ package VistaControlador; import java.awt.Dimension; import java.awt.GridBagConstraints; +import java.time.LocalDate; +import java.util.Date; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JTextArea; +import com.github.lgooddatepicker.components.DatePicker; + import Logica.Gestion; public class VistaPanelLateral extends JPanel{ protected JTextArea total; protected JTextArea gastoEnvio; - protected JButton elegirMes; + //protected JButton elegirMes; + protected static DatePicker elegirMes=inicializarCalendario(); protected JButton mostrarEstadisticas; VistaPanelLateral(GridBagConstraints constrain){ this.setPreferredSize(new Dimension(200,200)); this.total=new JTextArea(); this.gastoEnvio=new JTextArea(); - this.elegirMes=new JButton("Elegir mes"); this.mostrarEstadisticas=new JButton("Mostrar grafico del mes"); this.add(this.mostrarEstadisticas); constrain.gridx=1; constrain.gridy=0; constrain.weightx=2; - this.add(this.elegirMes); + this.add(VistaPanelLateral.elegirMes); constrain.gridx=1; constrain.gridy=1; constrain.weightx=2; @@ -41,4 +45,14 @@ public class VistaPanelLateral extends JPanel{ this.gastoEnvio.setText("Suma: "+String.valueOf(gestion.getSuma())+"€"); } + static LocalDate getDate() { + return elegirMes.getDate(); + } + + static DatePicker inicializarCalendario() { + DatePicker ret=new DatePicker(); + ret.setDate(LocalDate.now()); + return ret; + } + }