
package presentacion;

import encapsuladores.BaseDatos;
import javax.swing.JButton;
import negocio.IncidenciasNegocio;

public class VolcadoaBD extends PantallaOpcion {

      private JButton jButtonVolcar;
      
    public VolcadoaBD() {
        ubicarComponentes();
    }
  
    private void ubicarComponentes() {
        setLayout(null);
        jButtonVolcar = new JButton("Volcar a BD");
        jButtonVolcar.setBounds(340,280,120,40);
        jButtonVolcar.setActionCommand("volcarIncidencias");
        add(jButtonVolcar); 
    }   
    

    public void inicializarPostInstanciar(Controller controller) throws Exception {
        this.controller = controller;        
        jButtonVolcar.addActionListener(controller);        
    }    
    
    
    public void responderAController(String actionCommand) throws Exception {
          switch(actionCommand)
          {   
               case "volcarIncidencias" :
                      new IncidenciasNegocio().volcarFichero((BaseDatos)controller.getRepositorio()[0]);
                      break;       
          }
    }
}
