Aniadido exportar xml

This commit is contained in:
roche
2019-11-16 21:05:09 +01:00
parent 8bfab6a9dc
commit 1e46c48068
8 changed files with 243 additions and 83 deletions

View File

@@ -1,5 +1,6 @@
package VistaControlador;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -18,6 +19,7 @@ import javax.swing.JTextArea;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import Ficheros.Configuracion;
import Logica.Gestion;
import Logica.Meses;
import Logica.Transaccion;
@@ -28,7 +30,8 @@ public class Menu extends JFrame{
protected VistaAniadirVisualizar ingresos;
protected VistaAniadirVisualizar gastos;
protected VistaPanelLateral panel;
String nombreDatos;
String rutaGuardado;
int tema;
Meses meses;
ArrayList<VistaAniadirVisualizar> pestanias;
ArrayList<ControladorAniadirVisualizar> controladores;
@@ -36,9 +39,11 @@ public class Menu extends JFrame{
protected Gestion datosGastos;
protected Gestion datosIngresos;
public Menu() {
this.rutaGuardado = ".mes";
this.tema = 0;
this.barra = new BarraOpciones();
ControladorBarra controladorBarra = new ControladorBarra(barra, this);
this.nombreDatos = ".mes";
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
@@ -79,13 +84,19 @@ public class Menu extends JFrame{
constrain.weightx = 0.25;
this.panelCentral.add(this.panel,constrain);
this.add(this.panelCentral);
try {
Configuracion.cargarConfiguracion(this);
} catch (IOException e) {
e.printStackTrace();
}
}
private void close(){
if (JOptionPane.showConfirmDialog(rootPane, "¿Desea guardar el estado?",
"Salir del sistema", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
try {
this.meses.guardarMeses(this.nombreDatos);
this.meses.guardarMeses(this.rutaGuardado);
Configuracion.guardarConfiguracion(this);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -112,7 +123,7 @@ public class Menu extends JFrame{
if(this.meses==null) {
this.meses=new Meses();
try {
meses.cargarMeses(this.nombreDatos);
meses.cargarMeses(this.rutaGuardado);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -180,8 +191,70 @@ public class Menu extends JFrame{
}
}
});
}
}
public String getRuta() {
return this.rutaGuardado;
}
public void setRuta(String ruta) {
this.rutaGuardado=ruta;
}
public int getTema() {
return this.tema;
}
public void setTheme(int tema) {
switch(tema) {
case 0:{
this.tema = 0;
this.setBackground(Color.WHITE);
this.setOpacity(1);
this.repaint();
this.revalidate();
this.panelCentral.setOpaque(true);
this.panelCentral.setBackground(Color.WHITE);
this.panelCentral.repaint();
this.panelCentral.revalidate();
this.panel.setBackground(Color.WHITE);
this.panel.repaint();
this.panel.revalidate();
break;
}
case 1:{
this.tema = 1;
this.setBackground(Color.PINK);
this.setOpacity(1);
this.repaint();
this.revalidate();
this.panelCentral.setOpaque(true);
this.panelCentral.setBackground(Color.PINK);
this.panelCentral.repaint();
this.panelCentral.revalidate();
this.panel.setBackground(Color.PINK);
this.panel.repaint();
this.panel.revalidate();
break;
}
case 2:{
this.tema = 2;
this.setBackground(Color.BLACK);
this.setOpacity(1);
this.repaint();
this.revalidate();
this.panelCentral.setOpaque(true);
this.panelCentral.setBackground(Color.BLACK);
this.panelCentral.repaint();
this.panelCentral.revalidate();
this.panel.setBackground(Color.BLACK);
this.panel.repaint();
this.panel.revalidate();
break;
}
default: return;
}
}
}