Soporte a fecha iniciado
This commit is contained in:
		
							parent
							
								
									ba84d7d15b
								
							
						
					
					
						commit
						7d6a253033
					
				| @ -4,5 +4,7 @@ | ||||
| 	<classpathentry kind="src" path="src"/> | ||||
| 	<classpathentry kind="lib" path="/home/roche/Descargas/jfreechart-1.5.0-javadoc.jar"/> | ||||
| 	<classpathentry kind="lib" path="/home/roche/Descargas/jfreechart-1.5.0.jar"/> | ||||
| 	<classpathentry kind="lib" path="/home/roche/Descargas/LGoodDatePicker-10.4.1-javadoc.jar"/> | ||||
| 	<classpathentry kind="lib" path="/home/roche/Descargas/LGoodDatePicker-10.4.1.jar"/> | ||||
| 	<classpathentry kind="output" path="bin"/> | ||||
| </classpath> | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -1,10 +1,14 @@ | ||||
| package Logica; | ||||
| import java.time.Month; | ||||
| import java.time.Year; | ||||
| import java.util.Vector; | ||||
| 
 | ||||
| public class Gestion{ | ||||
| 	private Vector<Transaccion> gestiones; | ||||
| 	private float suma; | ||||
| 	private static float total; | ||||
| 	private static Month mes; | ||||
| 	private static Year anio; | ||||
| 	 | ||||
| 	public Gestion() { | ||||
| 		this.gestiones=new Vector<Transaccion>(); | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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"); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -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()); | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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; | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user