Corregido grafico y fallos menores
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package IniciarSesion;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Usuario implements Serializable{
|
||||
String nombre;
|
||||
String contrasenia;
|
||||
boolean admin;
|
||||
|
||||
public Usuario(String nombre, String contrasenia, boolean admin) {
|
||||
this.admin = admin;
|
||||
this.nombre = nombre;
|
||||
this.contrasenia = contrasenia;
|
||||
}
|
||||
|
||||
public boolean comprobar(String contrasenia) {
|
||||
if(this.contrasenia.equals(contrasenia)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getUsuario() {
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package IniciarSesion;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Validacion {
|
||||
File fichero;
|
||||
|
||||
}
|
||||
@@ -51,6 +51,8 @@ public class Meses {
|
||||
* @param anio anio de la gestion
|
||||
* @param mes mes de la transaccion
|
||||
* @param isPositivo tipo de la gestion
|
||||
*
|
||||
* @return Devuelve la gestion que se a aniadido
|
||||
*/
|
||||
public Gestion aniadirGestion(String nombre, int anio, Month mes, boolean isPositivo) {
|
||||
Gestion ret;
|
||||
@@ -140,6 +142,7 @@ public class Meses {
|
||||
* guarda las gestiones que hemos introducido en un fichero para garantizar la persistencia de los datos
|
||||
*
|
||||
* @param nombre nombre del fichero donde se guardaran los datos
|
||||
* @throws IOException
|
||||
*/
|
||||
public void guardarMeses(String nombre) throws IOException {
|
||||
FileOutputStream fichero = new FileOutputStream(nombre);
|
||||
@@ -311,6 +314,8 @@ public class Meses {
|
||||
|
||||
/**
|
||||
* Importa un xml de la ruta donde le indiquemos
|
||||
*
|
||||
* @param nombreFichero Nombre del fichero donde esta el xml a cargar
|
||||
*/
|
||||
public void importarXML(String nombreFichero) {
|
||||
File fichero = new File(nombreFichero);
|
||||
@@ -359,6 +364,15 @@ public class Meses {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve el nombre del mes e el que nos encontramos
|
||||
*
|
||||
* @return Nombre del mes en el que nos encontramos
|
||||
*/
|
||||
public String getNombre() {
|
||||
return this.meses.get(this.mesActual).getMes().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Mes implements Serializable{
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.github.lgooddatepicker.zinternaltools.DateChangeEvent;
|
||||
import com.github.lgooddatepicker.zinternaltools.DemoPanel;
|
||||
|
||||
import Logica.Gestion;
|
||||
import Logica.Transaccion;
|
||||
public class ControladorPanelLateral implements ActionListener, DateChangeListener{
|
||||
private VistaPanelLateral vista;
|
||||
private java.time.Month mes;
|
||||
@@ -31,8 +32,8 @@ public class ControladorPanelLateral implements ActionListener, DateChangeListen
|
||||
/**
|
||||
* Controlador del panel lateral que gestionara los datos
|
||||
*
|
||||
* @param vista
|
||||
* @param menu
|
||||
* @param vista Vista que usa el controlador
|
||||
* @param menu Menu que contiene la vista que usa este controlador
|
||||
*/
|
||||
public ControladorPanelLateral(VistaPanelLateral vista, Menu menu) {
|
||||
this.vista = vista;
|
||||
@@ -43,12 +44,17 @@ public class ControladorPanelLateral implements ActionListener, DateChangeListen
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch(e.getActionCommand()) {
|
||||
case "Mostrar estadisticas":{
|
||||
XYSeries serie = new XYSeries("Mes");
|
||||
serie.add(10,1);
|
||||
serie.add(4,2);
|
||||
serie.add(90,10);
|
||||
XYSeriesCollection dataset = new XYSeriesCollection(serie);
|
||||
JFreeChart chart = ChartFactory.createXYLineChart("Mes", "Dias", "Gastos", dataset);
|
||||
|
||||
XYSeriesCollection dataset = new XYSeriesCollection();
|
||||
for(Gestion gestion:this.menu.meses.getGestionesActuales()) {
|
||||
XYSeries serie = new XYSeries(gestion.getNombre());
|
||||
for(Transaccion transaccion:gestion.getElementos()) {
|
||||
serie.add(transaccion.getDia().getDayOfMonth(),transaccion.getDinero());
|
||||
}
|
||||
dataset.addSeries(serie);
|
||||
}
|
||||
|
||||
JFreeChart chart = ChartFactory.createXYLineChart(this.menu.meses.getNombre(), "Dias", "Gastos", dataset);
|
||||
ChartFrame frame = new ChartFrame("Estadisricas", chart);
|
||||
frame.setVisible(true);
|
||||
frame.setSize(700,500);
|
||||
|
||||
Reference in New Issue
Block a user