Refactorizando visibilidad transacciones
This commit is contained in:
		
							parent
							
								
									95805c3efa
								
							
						
					
					
						commit
						e9a85d3df0
					
				
							
								
								
									
										
											BIN
										
									
								
								bin/Main.class
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/Main.class
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -30,16 +30,13 @@ public class Gestion{ | ||||
| 		return this.gestiones; | ||||
| 	} | ||||
| 	 | ||||
| 	public void alterarVisibilidad(boolean visibilidad, int elemento) { | ||||
| 		if(this.gestiones.get(elemento).alterarVisivilidad(visibilidad)) { | ||||
| 			if(this.gestiones.get(elemento).getVisivilidad()) { | ||||
| 				this.suma+=this.gestiones.get(elemento).getDinero(); | ||||
| 				Gestion.total+=this.gestiones.get(elemento).getDinero(); | ||||
| 			}else { | ||||
| 				this.suma-=this.gestiones.get(elemento).getDinero(); | ||||
| 				Gestion.total-=this.gestiones.get(elemento).getDinero(); | ||||
| 			} | ||||
| 			 | ||||
| 	public void alterarVisibilidad(int elemento) { | ||||
| 		if(this.gestiones.get(elemento).alterarVisivilidad()) { | ||||
| 			this.suma+=this.gestiones.get(elemento).getDinero(); | ||||
| 			Gestion.total+=this.gestiones.get(elemento).getDinero(); | ||||
| 		}else { | ||||
| 			this.suma-=this.gestiones.get(elemento).getDinero(); | ||||
| 			Gestion.total-=this.gestiones.get(elemento).getDinero(); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -19,13 +19,9 @@ public class Transaccion { | ||||
| 		return this.visible; | ||||
| 	} | ||||
| 	 | ||||
| 	public boolean alterarVisivilidad(boolean visibilidad) { | ||||
| 		if(this.visible!=visibilidad) { | ||||
| 			this.visible=visibilidad; | ||||
| 			return true; | ||||
| 		}else { | ||||
| 			return false; | ||||
| 		} | ||||
| 	public boolean alterarVisivilidad() { | ||||
| 		this.visible=!this.visible; | ||||
| 		return this.visible; | ||||
| 	} | ||||
| 	 | ||||
| 	public int getDinero() { | ||||
|  | ||||
| @ -42,8 +42,7 @@ public class Controlador implements ActionListener,ChangeListener{ | ||||
| 			JCheckBox pulsado=(JCheckBox)e.getSource(); | ||||
| 			for(int i=0;i<vista.gestiones.getElementos().size();i++) { | ||||
| 				if(vista.gestiones.getElementos().get(i).toString().equals(pulsado.getText())) { | ||||
| 					//vista.gestiones.alterarVisibilidad(!vista.gestiones.getElementos().get(i).getVisivilidad(), i); | ||||
| 					vista.gestiones.alterarVisibilidad(pulsado.getFocusTraversalKeysEnabled(), i); | ||||
| 					vista.gestiones.alterarVisibilidad(i); | ||||
| 					this.vista.menu.total.setText(String.valueOf(Gestion.getTotal())); | ||||
| 					this.vista.menu.total.revalidate(); | ||||
| 					this.vista.menu.total.repaint(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user