vista.AforoPanel.java Source code

Java tutorial

Introduction

Here is the source code for vista.AforoPanel.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package vista;

import conexion.AforoJPA;
import conexion.CeldaJPA;
import conexion.VerticalJPA;
import entidad.Aforo;
import entidad.Celda;
import entidad.Vertical;
import java.io.File;
import java.io.FileOutputStream;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.WindowConstants;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

/**
 *
 * @author ALVIS
 */
public class AforoPanel extends javax.swing.JPanel {

    private MenuAforos padre;
    private Aforo aforo;
    private AforoJPA aforojpa;
    private VerticalJPA verjpa;
    private CeldaJPA celjpa;
    private String ubic;
    private FileOutputStream elFichero;

    public AforoPanel(String ID, MenuAforos p) {
        initComponents();
        aforo = new Aforo();
        aforojpa = new AforoJPA();
        aforo = aforojpa.ConsultarAforo((int) Integer.parseInt(ID));
        padre = p;
        DecimalFormat df = new DecimalFormat("0.0000");

        jLabelNombre.setText("Nombre: " + aforo.getNombre());
        jLabelTipo.setText("Configuracion: " + aforo.getTipoAforo());
        jLabelHelice.setText("Helice: " + aforo.getHelice());
        Calendar fecha = Calendar.getInstance();
        SimpleDateFormat date = new SimpleDateFormat("dd-MM-yy");
        SimpleDateFormat hour = new SimpleDateFormat("HH:mm:ss");
        fecha.set(aforo.getAnho(), aforo.getMes() - 1, aforo.getDia(), aforo.getHoraInicio(),
                aforo.getMinutoInicio(), aforo.getSegundoInicio());
        jLabelFecha.setText("Fecha: " + date.format(fecha.getTime()));
        jLabelHoraIni.setText("Hora inicio: " + hour.format(fecha.getTime()));
        fecha.set(aforo.getAnho(), aforo.getMes() - 1, aforo.getDia(), aforo.getHoraFin(), aforo.getMinutoFin(),
                aforo.getSegundoFin());
        jLabelHoraFin.setText("Hora final: " + hour.format(fecha.getTime()));
        jLabelArea.setText("Area[m2]: " + df.format(aforo.getAreaTotal()));
        jLabelCaudal.setText("Caudal[m3/s]: " + df.format(aforo.getCaudalTotal()));
        jLabelLong.setText("Longitud total[m]: " + df.format(aforo.getLongitudTotal()));
        jLabelProf.setText("Profundidad media[m]: " + df.format(aforo.getProfundidadMedia()));
        jLabelVelo.setText("Velocidad[m/s]: " + df.format(aforo.getVelocidadMedia()));
        jLabelTiempo.setText("Tiempo por medicion[s]: " + aforo.getTiempoAforo());
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabelNombre = new javax.swing.JLabel();
        jLabelTipo = new javax.swing.JLabel();
        jLabelHelice = new javax.swing.JLabel();
        jLabelHoraIni = new javax.swing.JLabel();
        jLabelFecha = new javax.swing.JLabel();
        jLabelHoraFin = new javax.swing.JLabel();
        jLabelProf = new javax.swing.JLabel();
        jLabelArea = new javax.swing.JLabel();
        jLabelVelo = new javax.swing.JLabel();
        jLabelLong = new javax.swing.JLabel();
        jLabelCaudal = new javax.swing.JLabel();
        jLabelTiempo = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButtonEliminar = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();

        setPreferredSize(new java.awt.Dimension(582, 417));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalles"));

        jLabelNombre.setText("Nombre");

        jLabelTipo.setText("Tipo de Aforo");

        jLabelHelice.setText("Helice");

        jLabelHoraIni.setText("Hora");

        jLabelFecha.setText("Fecha");

        jLabelHoraFin.setText("Hora fin");

        jLabelProf.setText("Profundidad");

        jLabelArea.setText("Area");

        jLabelVelo.setText("Velocidad");

        jLabelLong.setText("longitud");

        jLabelCaudal.setText("caudal");

        jLabelTiempo.setText("tiempo");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(jPanel1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabelNombre).addComponent(jLabelTipo).addComponent(jLabelHelice)
                                .addComponent(jLabelFecha).addComponent(jLabelHoraIni).addComponent(jLabelHoraFin)
                                .addComponent(jLabelProf).addComponent(jLabelArea).addComponent(jLabelVelo)
                                .addComponent(jLabelLong).addComponent(jLabelCaudal).addComponent(jLabelTiempo))
                        .addGap(0, 157, Short.MAX_VALUE)));
        jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addGap(21, 21, 21).addComponent(jLabelNombre)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelTipo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelHelice)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelFecha)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelHoraIni)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelHoraFin)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelProf)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelArea)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelVelo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelLong)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelCaudal)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabelTiempo).addContainerGap(84, Short.MAX_VALUE)));

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Opciones"));

        jButton1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jButton1.setText("Graficar Perfil");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Exportar a Excel");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButtonEliminar.setText("Eliminar Aforo");
        jButtonEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEliminarActionPerformed(evt);
            }
        });

        jButton4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jButton4.setText("REGRESAR");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(jPanel2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jButton2).addComponent(jButtonEliminar)
                                .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 143,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 126,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(177, Short.MAX_VALUE)));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addGap(127, 127, 127).addComponent(jButton1)
                        .addGap(18, 18, 18).addComponent(jButton2).addGap(18, 18, 18).addComponent(jButtonEliminar)
                        .addGap(30, 30, 30).addComponent(jButton4)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(6, 6, 6).addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE));
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:

        JFileChooser dialog = new JFileChooser();
        int opcion = dialog.showSaveDialog(this);

        if (opcion == JFileChooser.CANCEL_OPTION) {
            return;
        }

        //-----CREAR LAS CELDAS DE EXCEL
        //-----LLENAR CELDAS CON INFORMACION DE AFORO

        if (opcion == JFileChooser.APPROVE_OPTION) {
            File dir = dialog.getSelectedFile();
            String fl = dir.toString();
            ubic = fl;
        }

        try {
            //-------------------
            if (ubic.endsWith("xls")) {
                elFichero = new FileOutputStream(new File(ubic));
            } else {
                elFichero = new FileOutputStream(new File(ubic + ".xls"));
            }

            ObtenerDatosExcel().write(elFichero);
            elFichero.close();
            JOptionPane.showMessageDialog(null, "AFORO EXPORTADO A EXCEL CON EXITO!");

        } catch (Exception ex) {
            ex.printStackTrace();
            JOptionPane.showMessageDialog(null,
                    "Otro programa esta usando el archivo\n Cierrelo y vuelva a intentar");
        }
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        Grafica obj = new Grafica(aforo);
        obj.setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButtonEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminarActionPerformed
        // TODO add your handling code here:

        if (JOptionPane.showConfirmDialog(null, "Seguro que desea eliminar Aforo de la Base de Datos?",
                "Eliminar Aforo", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            List<Vertical> verticales = new ArrayList();
            List<Celda> celdas = new ArrayList();
            verjpa = new VerticalJPA();
            celjpa = new CeldaJPA();

            verticales = verjpa.ListarVerticales(aforo.getIdaforo());
            celdas = celjpa.ListarCeldas(aforo.getIdaforo());

            for (int i = 0; i < celdas.size(); i++) {
                celjpa.EliminarCelda(celdas.get(i));
            }

            for (int i = 0; i < verticales.size(); i++) {
                verjpa.EliminarVertical(verticales.get(i));
            }

            if (aforojpa.EliminarAforo(aforo)) {
                JOptionPane.showMessageDialog(null, "AFORO ELIMINADO!");
                MenuAforos obj = new MenuAforos(this.getSize());
                obj.setLocationRelativeTo(padre);
                obj.setVisible(true);
                obj.setSize(550, 500);
                padre.dispose();
            } else {
                JOptionPane.showMessageDialog(null, "NO SE PUDO ELIMINAR AFORO");
            }

        } else {
            return;
        }

    }//GEN-LAST:event_jButtonEliminarActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        ComunicacionGUI obj = new ComunicacionGUI();
        obj.setLocationRelativeTo(this);
        obj.setVisible(true);
        padre.dispose();
    }//GEN-LAST:event_jButton4ActionPerformed

    public HSSFWorkbook ObtenerDatosExcel() {

        List<Vertical> verticales = new ArrayList();
        List<Celda> celdas = new ArrayList();
        verjpa = new VerticalJPA();
        celjpa = new CeldaJPA();

        verticales = verjpa.ListarVerticales(aforo.getIdaforo());
        celdas = celjpa.ListarCeldas(aforo.getIdaforo());
        //verticales = (List<Vertical>) aforo.getVerticalCollection();
        //celdas = (List<Celda>) aforo.getCeldaCollection();

        HSSFWorkbook libro = new HSSFWorkbook();
        HSSFSheet hoja = libro.createSheet();
        HSSFCellStyle style = libro.createCellStyle();
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        style.setBorderTop(HSSFCellStyle.BORDER_THIN);
        style.setBorderRight(HSSFCellStyle.BORDER_THIN);
        style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        style.setWrapText(true);
        style.setHidden(true);
        style.setShrinkToFit(true);

        SimpleDateFormat date = new SimpleDateFormat("dd-MM-yyyy");
        SimpleDateFormat hour = new SimpleDateFormat("HH:mm:ss");
        Calendar fecha = Calendar.getInstance();
        fecha.set(aforo.getAnho(), aforo.getMes() - 1, aforo.getDia(), aforo.getHoraInicio(),
                aforo.getMinutoInicio(), aforo.getSegundoInicio());

        //*****************DATOS AFORRO***********************//
        HSSFRow fila = hoja.createRow(2);
        HSSFCell celda = fila.createCell((int) 3);
        celda.setCellValue("AFORO");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("VERTICAL 1");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 10);
        celda.setCellValue("CELDA 1");
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(3);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Nombre");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getNombre());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Profundidad[cm]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getProfundidad());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 10);
        celda.setCellValue("Ancho[m]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 11);
        celda.setCellValue(celdas.get(0).getProfundidad());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(4);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Tipo");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getTipoAforo());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Dist_a_orilla[m]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getDistOrilla());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 10);
        celda.setCellValue("Profundidad[cm]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 11);
        celda.setCellValue(celdas.get(0).getAncho());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(5);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Helice");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getHelice());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Velocidad[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVelocidad());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 10);
        celda.setCellValue("Area[m^2]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 11);
        celda.setCellValue(celdas.get(0).getArea());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(6);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Numero de Celdas");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getNumeroCeldas());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Velocidad_sup[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVelocidadSup());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 10);
        celda.setCellValue("Velocidad[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 11);
        celda.setCellValue(celdas.get(0).getVelocidad());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(7);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Numero de Verticales");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getNumeroVerticales());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Velocidad_fondo[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVelocidadFondo());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 10);
        celda.setCellValue("Caudal[m^3/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 11);
        celda.setCellValue(celdas.get(0).getCaudal());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(8);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Tiempo de Aforo[s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getTiempoAforo());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Velocidad_20[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVelocidad20());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(9);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Fecha");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(date.format(fecha.getTime()));
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Velocidad_40[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVelocidad40());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(10);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Hora inicio");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(hour.format(fecha.getTime()));
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Velocidad_60[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVelocidad60());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(11);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Hora fin");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        fecha.set(aforo.getAnho(), aforo.getMes() - 1, aforo.getDia(), aforo.getHoraFin(), aforo.getMinutoFin(),
                aforo.getSegundoFin());
        celda.setCellValue(hour.format(fecha.getTime()));
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Velocidad_80[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVelocidad80());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(12);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Longitud total[m]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getLongitudTotal());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Vueltas_sup[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVueltasSup());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(13);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Profundidad media[cm]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getProfundidadMedia());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Vueltas_fondo[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVueltasFondo());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(14);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Velocidad media[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getVelocidadMedia());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Vueltas_20[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVueltas20());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(15);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Area total[m^2]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getAreaTotal());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Vueltas_40[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVueltas40());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(16);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Caudal total[m^3/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getCaudalTotal());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Vueltas_60[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVueltas60());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(17);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Mira inicial[cm]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getMiraInicial());
        celda.setCellStyle(style);

        celda = fila.createCell((int) 7);
        celda.setCellValue("Vueltas_80[m/s]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 8);
        celda.setCellValue(verticales.get(0).getVueltas80());
        celda.setCellStyle(style);
        //******************************************//
        fila = hoja.createRow(18);
        celda = fila.createCell((int) 3);
        celda.setCellValue("Mira final[cm]");
        celda.setCellStyle(style);

        celda = fila.createCell((int) 4);
        celda.setCellValue(aforo.getMiraFinal());
        celda.setCellStyle(style);
        //******************************************//

        //*****************DATOS VERTICALES***********************//
        for (int i = 1; i < verticales.size(); i++) {
            fila = hoja.createRow(3 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("VERTICAL " + (i + 1));
            celda.setCellStyle(style);

            if (i < celdas.size()) {
                celda = fila.createCell((int) 10);
                celda.setCellValue("CELDA " + (i + 1));
                celda.setCellStyle(style);
            }
            //******************************************//
            fila = hoja.createRow(4 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Profundidad[cm]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getProfundidad());
            celda.setCellStyle(style);

            if (i < celdas.size()) {
                celda = fila.createCell((int) 10);
                celda.setCellValue("Ancho[m]");
                celda.setCellStyle(style);

                celda = fila.createCell((int) 11);
                celda.setCellValue(celdas.get(i).getAncho());
                celda.setCellStyle(style);
            }
            //******************************************//
            fila = hoja.createRow(5 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Dist_a_orilla[m]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getDistOrilla());
            celda.setCellStyle(style);

            if (i < celdas.size()) {
                celda = fila.createCell((int) 10);
                celda.setCellValue("Profundidad[cm]");
                celda.setCellStyle(style);

                celda = fila.createCell((int) 11);
                celda.setCellValue(celdas.get(i).getProfundidad());
                celda.setCellStyle(style);
            }
            //******************************************//
            fila = hoja.createRow(6 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Velocidad[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVelocidad());
            celda.setCellStyle(style);

            if (i < celdas.size()) {
                celda = fila.createCell((int) 10);
                celda.setCellValue("Area[m^2]");
                celda.setCellStyle(style);

                celda = fila.createCell((int) 11);
                celda.setCellValue(celdas.get(i).getArea());
                celda.setCellStyle(style);
            }
            //******************************************//
            fila = hoja.createRow(7 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Velocidad_sup[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVelocidadSup());
            celda.setCellStyle(style);

            if (i < celdas.size()) {
                celda = fila.createCell((int) 10);
                celda.setCellValue("Velocidad[m/s]");
                celda.setCellStyle(style);

                celda = fila.createCell((int) 11);
                celda.setCellValue(celdas.get(i).getVelocidad());
                celda.setCellStyle(style);
            }
            //******************************************//
            fila = hoja.createRow(8 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Velocidad_fondo[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVelocidadFondo());
            celda.setCellStyle(style);

            if (i < celdas.size()) {
                celda = fila.createCell((int) 10);
                celda.setCellValue("Caudal[m^3/s]");
                celda.setCellStyle(style);

                celda = fila.createCell((int) 11);
                celda.setCellValue(celdas.get(i).getCaudal());
                celda.setCellStyle(style);
            }
            //******************************************//
            fila = hoja.createRow(9 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Velocidad_20[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVelocidad20());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(10 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Velocidad_40[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVelocidad40());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(11 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Velocidad_60[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVelocidad60());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(12 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Velocidad_80[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVelocidad80());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(13 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Vueltas_sup[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVueltasSup());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(14 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Vueltas_fondo[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVueltasFondo());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(15 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Vueltas_20[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVueltas20());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(16 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Vueltas_40[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVueltas40());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(17 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Vueltas_60[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVueltas60());
            celda.setCellStyle(style);
            //******************************************//
            fila = hoja.createRow(18 + (17 * i));
            celda = fila.createCell((int) 7);
            celda.setCellValue("Vueltas_80[m/s]");
            celda.setCellStyle(style);

            celda = fila.createCell((int) 8);
            celda.setCellValue(verticales.get(i).getVueltas80());
            celda.setCellStyle(style);
        }

        for (int i = 0; i < 12; i++) {
            hoja.autoSizeColumn(i);
        }

        return libro;
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButtonEliminar;
    private javax.swing.JLabel jLabelArea;
    private javax.swing.JLabel jLabelCaudal;
    private javax.swing.JLabel jLabelFecha;
    private javax.swing.JLabel jLabelHelice;
    private javax.swing.JLabel jLabelHoraFin;
    private javax.swing.JLabel jLabelHoraIni;
    private javax.swing.JLabel jLabelLong;
    private javax.swing.JLabel jLabelNombre;
    private javax.swing.JLabel jLabelProf;
    private javax.swing.JLabel jLabelTiempo;
    private javax.swing.JLabel jLabelTipo;
    private javax.swing.JLabel jLabelVelo;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables
}