Aniadidas opciones varias y corregidos bugs
This commit is contained in:
		
							parent
							
								
									9b9d1bb7bb
								
							
						
					
					
						commit
						6afe1af5a1
					
				
							
								
								
									
										4
									
								
								.config
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								.config
									
									
									
									
									
								
							| @ -1,4 +1,4 @@ | |||||||
| #Configuracion general | #Configuracion general | ||||||
| #Fri Nov 22 12:55:58 CET 2019 | #Tue Nov 26 22:32:47 CET 2019 | ||||||
| tema=0 | tema=2 | ||||||
| ruta=.mes | ruta=.mes | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								bin/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								bin/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1 +1,2 @@ | |||||||
| /VistaControlador/ | /VistaControlador/ | ||||||
|  | /Logica/ | ||||||
|  | |||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -1,5 +1,6 @@ | |||||||
| package Logica; | package Logica; | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
|  | import java.time.LocalDate; | ||||||
| import java.util.Vector; | import java.util.Vector; | ||||||
| 
 | 
 | ||||||
| public class Gestion implements Serializable{ | public class Gestion implements Serializable{ | ||||||
| @ -101,6 +102,24 @@ public class Gestion implements Serializable{ | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	public void editarTransaccionFecha(String nombreViejo, LocalDate fecha) { | ||||||
|  | 		for(Transaccion elemento:this.gestiones) { | ||||||
|  | 			if(elemento.getNombre().equals(nombreViejo)) { | ||||||
|  | 				elemento.setFecha(fecha); | ||||||
|  | 				return; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public void editarTransaccionDiero(String nombreViejo, float dinero) { | ||||||
|  | 		for(Transaccion elemento:this.gestiones) { | ||||||
|  | 			if(elemento.getNombre().equals(nombreViejo)) { | ||||||
|  | 				elemento.setPrecio(dinero); | ||||||
|  | 				return; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	/** | 	/** | ||||||
| 	 * Devuelve verdadero si es un ingerso y falso si es un gasto | 	 * Devuelve verdadero si es un ingerso y falso si es un gasto | ||||||
| 	 *  | 	 *  | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| package Logica; | package Logica; | ||||||
| 
 | 
 | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
|  | import java.sql.Date; | ||||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||||
| 
 | 
 | ||||||
| public class Transaccion implements Serializable{ | public class Transaccion implements Serializable{ | ||||||
| @ -96,4 +97,12 @@ public class Transaccion implements Serializable{ | |||||||
| 	public void setName(String nombre) { | 	public void setName(String nombre) { | ||||||
| 		this.nombre = nombre; | 		this.nombre = nombre; | ||||||
| 	} | 	} | ||||||
|  | 	 | ||||||
|  | 	public void setFecha(LocalDate fecha) { | ||||||
|  | 		this.dia = fecha; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public void setPrecio(float nuevo) { | ||||||
|  | 		this.dinero = nuevo; | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -31,7 +31,15 @@ public class ControladorPanelModificar implements ActionListener{ | |||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 		case "Editar transaccion":{ | 		case "Editar transaccion":{ | ||||||
|  | 			if(!this.vista.nuevoEditar.getText().equals("")) { | ||||||
| 				this.menu.pestanias.get(this.menu.pestania.getSelectedIndex()).editarTransaccion(this.vista.viejoEditar.getText(), this.vista.nuevoEditar.getText()); | 				this.menu.pestanias.get(this.menu.pestania.getSelectedIndex()).editarTransaccion(this.vista.viejoEditar.getText(), this.vista.nuevoEditar.getText()); | ||||||
|  | 
 | ||||||
|  | 			} | ||||||
|  | 			if(!this.vista.dineroEditar.getText().equals("")) { | ||||||
|  | 				float dinero = Float.parseFloat(this.vista.dineroEditar.getText()); | ||||||
|  | 				this.menu.pestanias.get(this.menu.pestania.getSelectedIndex()).editarTransaccionDinero(this.vista.viejoEditar.getText(), dinero); | ||||||
|  | 			} | ||||||
|  | 			this.menu.pestanias.get(this.menu.pestania.getSelectedIndex()).editarTransaccionFecha(this.vista.viejoEditar.getText(), this.menu.elegirMes.getDate()); | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -252,6 +252,7 @@ public class Menu extends JFrame{ | |||||||
| 		this.pestanias.add(vista); | 		this.pestanias.add(vista); | ||||||
| 		this.controladores.add(new ControladorAniadirVisualizar(vista)); | 		this.controladores.add(new ControladorAniadirVisualizar(vista)); | ||||||
| 		this.pestania.addTab(vista.getName(),vista); | 		this.pestania.addTab(vista.getName(),vista); | ||||||
|  | 		this.meses.getGestionesActuales().add(gestion); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	/** | 	/** | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| package VistaControlador; | package VistaControlador; | ||||||
| 
 | 
 | ||||||
| import java.awt.Dimension; | import java.awt.Dimension; | ||||||
|  | import java.time.LocalDate; | ||||||
| import java.util.LinkedList; | import java.util.LinkedList; | ||||||
| 
 | 
 | ||||||
| import javax.swing.JButton; | import javax.swing.JButton; | ||||||
| @ -123,7 +124,44 @@ public class VistaAniadirVisualizar extends JPanel{ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 	 | 	 | ||||||
|  | 	void editarTransaccionDinero(String nombreViejo, float dinero){ | ||||||
|  | 		for(Transaccion transaccion:this.gestiones.getElementos()) { | ||||||
|  | 			if(transaccion.getNombre().equals(nombreViejo)) { | ||||||
|  | 				for(JCheckBox check:this.transacciones) { | ||||||
|  | 					if(check.getText().equals(transaccion.toString())) { | ||||||
|  | 						transaccion.setPrecio(dinero); | ||||||
|  | 						check.setText(transaccion.toString()); | ||||||
|  | 						check.revalidate(); | ||||||
|  | 						check.repaint(); | ||||||
|  | 						//this.gestiones.editarTransaccion(nombreViejo, nombreNuevo); | ||||||
|  | 						this.menu.panelGestion.actualizarDatos(this.gestiones); | ||||||
|  | 						this.cuadro.revalidate(); | ||||||
|  | 						this.cuadro.repaint(); | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	void editarTransaccionFecha(String nombreViejo, LocalDate fecha){ | ||||||
|  | 		for(Transaccion transaccion:this.gestiones.getElementos()) { | ||||||
|  | 			if(transaccion.getNombre().equals(nombreViejo)) { | ||||||
|  | 				for(JCheckBox check:this.transacciones) { | ||||||
|  | 					if(check.getText().equals(transaccion.toString())) { | ||||||
|  | 						transaccion.setFecha(fecha); | ||||||
|  | 						check.setText(transaccion.toString()); | ||||||
|  | 						check.revalidate(); | ||||||
|  | 						check.repaint(); | ||||||
|  | 						//this.gestiones.editarTransaccion(nombreViejo, nombreNuevo); | ||||||
|  | 						this.menu.panelGestion.actualizarDatos(this.gestiones); | ||||||
|  | 						this.cuadro.revalidate(); | ||||||
|  | 						this.cuadro.repaint(); | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	/** | 	/** | ||||||
|  | |||||||
| @ -8,10 +8,12 @@ import javax.swing.JButton; | |||||||
| import javax.swing.JTextField; | import javax.swing.JTextField; | ||||||
| 
 | 
 | ||||||
| public class VistaPanelModificar extends VistaPanel{ | public class VistaPanelModificar extends VistaPanel{ | ||||||
| 	JTextField viejoNombre; | 	private JTextField viejoNombre; | ||||||
| 	JTextField nuevoNombre; | 	private JTextField nuevoNombre; | ||||||
| 	JTextField viejoEditar; | 	JTextField viejoEditar; | ||||||
| 	JTextField nuevoEditar; | 	JTextField nuevoEditar; | ||||||
|  | 	private JTextField dineroPanel; | ||||||
|  | 	JTextField dineroEditar; | ||||||
| 	JButton editarTransaccion; | 	JButton editarTransaccion; | ||||||
| 	JButton editarGestion; | 	JButton editarGestion; | ||||||
| 	VistaPanelModificar() { | 	VistaPanelModificar() { | ||||||
| @ -53,5 +55,19 @@ public class VistaPanelModificar extends VistaPanel{ | |||||||
| 		constrain.gridx = 1; | 		constrain.gridx = 1; | ||||||
| 		constrain.gridy = 2; | 		constrain.gridy = 2; | ||||||
| 		this.add(this.editarTransaccion, constrain); | 		this.add(this.editarTransaccion, constrain); | ||||||
|  | 		 | ||||||
|  | 		this.dineroPanel = new JTextField("Dinero"); | ||||||
|  | 		this.dineroPanel.setEditable(false); | ||||||
|  | 		constrain.gridx = 0; | ||||||
|  | 		constrain.gridy = 3; | ||||||
|  | 		this.add(this.dineroPanel, constrain); | ||||||
|  | 		 | ||||||
|  | 		this.dineroEditar = new JTextField(); | ||||||
|  | 		constrain.gridx = 1; | ||||||
|  | 		constrain.gridy = 3; | ||||||
|  | 		this.dineroEditar.setPreferredSize(new Dimension(80, 17)); | ||||||
|  | 		this.add(this.dineroEditar, constrain); | ||||||
|  | 		 | ||||||
|  | 		 | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user