/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * jfrmReqInformacion.java
 *
 * Created on 20-dic-2011, 16:55:43
 */
package vista;

import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import modelo.DocumentoReq;
import modelo.ReqInformacion;

/**
 *
 * @author UHU
 */
public class jfrmReqInformacion extends javax.swing.JFrame {
    DocumentoReq auxDocPpal;
    jfrmPrincipal jfaux;
    MutableTreeNode auxinsertNode;
    int auxinsertIndex;
    boolean edicion;
    ReqInformacion auxRIN;
    private DefaultListModel modelo_destino;
    private DefaultListModel modelo_origen;
    /** Creates new form jfrmCasodeUso */
    public jfrmReqInformacion(jfrmPrincipal jf, DocumentoReq docPpal, MutableTreeNode insertNode, int insertIndex) {
        initComponents();
        auxinsertNode=insertNode;
        auxinsertIndex=insertIndex;
        jfaux=jf;
        auxDocPpal=docPpal;
        modelo_destino = new DefaultListModel();
        modelo_origen = new DefaultListModel();
        jlstDestino.setModel(modelo_destino);
        jlstOrigen.setModel(modelo_origen);
        edicion=false;
    }

    jfrmReqInformacion(jfrmPrincipal jf, ReqInformacion RIN, MutableTreeNode nodo, DocumentoReq docPpal) {
        initComponents();
        edicion=true;
        jfaux=jf;
        auxRIN=RIN;
        auxDocPpal=docPpal;
        auxinsertNode=nodo;
        jtxtNombre.setText(auxRIN.getNombre());
        jtxaConcepto.setText(auxRIN.getConcepto());
        jcboxImportancia.setSelectedItem(auxRIN.getImportancia());
        jcboxUrgencia.setSelectedItem(auxRIN.getUrgencia());
        jcboxEstadoDesarrollo.setSelectedItem(auxRIN.getEstado_desarrollo());
        jcboxEstabilidad.setSelectedItem(auxRIN.getEstabilidad());
        jtxtValorMaximo.setText(String.valueOf(auxRIN.getValor_maximo()));
        jtxtValorMedio.setText(String.valueOf(auxRIN.getValor_medio()));
        jcboxUnidadMaximo.setSelectedItem(auxRIN.getUnidad_maximo());
        jcboxUnidadMedio.setSelectedItem(auxRIN.getUnidad_medio());

    }

    /** 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() {

        jTabReqInf = new javax.swing.JTabbedPane();
        jpanGeneral = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jtxtNombre = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtxaConcepto = new javax.swing.JTextArea();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jtxtValorMaximo = new javax.swing.JTextField();
        jcboxUnidadMaximo = new javax.swing.JComboBox();
        jtxtValorMedio = new javax.swing.JTextField();
        jcboxUnidadMedio = new javax.swing.JComboBox();
        jpanPrioridad = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jcboxImportancia = new javax.swing.JComboBox();
        jcboxUrgencia = new javax.swing.JComboBox();
        jcboxEstadoDesarrollo = new javax.swing.JComboBox();
        jcboxEstabilidad = new javax.swing.JComboBox();
        jpanRastreabilidad = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jlstDestino = new javax.swing.JList();
        jbtnAñadirDestino = new javax.swing.JButton();
        jbtnEliminarDestino = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        jlstOrigen = new javax.swing.JList();
        jbtnAñadirOrigen = new javax.swing.JButton();
        jbtnEliminarOrigen = new javax.swing.JButton();
        jbtnAceptar = new javax.swing.JButton();
        jbtnCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Requisito de Información");
        setResizable(false);

        jLabel1.setText("Nombre:");

        jLabel2.setText("Concepto:");

        jtxaConcepto.setColumns(20);
        jtxaConcepto.setRows(5);
        jScrollPane1.setViewportView(jtxaConcepto);

        jLabel3.setText("Tiempo máximo de vida");

        jLabel4.setText("Valor");

        jLabel5.setText("Unidad de tiempo:");

        jLabel6.setText("Tiempo medio de vida");

        jLabel7.setText("Valor");

        jLabel8.setText("Unidad de tiempo:");

        jtxtValorMaximo.setText("0");
        jtxtValorMaximo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtValorMaximoActionPerformed(evt);
            }
        });

        jcboxUnidadMaximo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PD", "años", "meses", "dias", "horas", "minutos", "segundos" }));

        jtxtValorMedio.setText("0");

        jcboxUnidadMedio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PD", "años", "meses", "dias", "horas", "minutos", "segundos" }));

        javax.swing.GroupLayout jpanGeneralLayout = new javax.swing.GroupLayout(jpanGeneral);
        jpanGeneral.setLayout(jpanGeneralLayout);
        jpanGeneralLayout.setHorizontalGroup(
            jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanGeneralLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addComponent(jSeparator1)
                    .addGroup(jpanGeneralLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtxtNombre))
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addGroup(jpanGeneralLayout.createSequentialGroup()
                        .addGroup(jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpanGeneralLayout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtxtValorMaximo))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpanGeneralLayout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtxtValorMedio))
                            .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING))
                        .addGap(26, 26, 26)
                        .addGroup(jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jcboxUnidadMedio, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jcboxUnidadMaximo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jpanGeneralLayout.setVerticalGroup(
            jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanGeneralLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jtxtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jtxtValorMaximo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jcboxUnidadMaximo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpanGeneralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jtxtValorMedio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(jcboxUnidadMedio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(14, Short.MAX_VALUE))
        );

        jTabReqInf.addTab("General", jpanGeneral);

        jLabel9.setText("Importancia");

        jLabel10.setText("Urgencia");

        jLabel11.setText("Estado desarrollo");

        jLabel12.setText("Estabilidad");

        jcboxImportancia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PD", "esencial", "importante", "quedaría bien" }));

        jcboxUrgencia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PD", "inmediatamente", "pronto", "se puede demorar" }));

        jcboxEstadoDesarrollo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PD", "en construcción", "pendiente de verificación", "pendiente de validación", "validado" }));

        jcboxEstabilidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PD", "alta", "media", "baja" }));
        jcboxEstabilidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcboxEstabilidadActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpanPrioridadLayout = new javax.swing.GroupLayout(jpanPrioridad);
        jpanPrioridad.setLayout(jpanPrioridadLayout);
        jpanPrioridadLayout.setHorizontalGroup(
            jpanPrioridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpanPrioridadLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpanPrioridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jcboxEstabilidad, javax.swing.GroupLayout.Alignment.LEADING, 0, 291, Short.MAX_VALUE)
                    .addComponent(jcboxImportancia, javax.swing.GroupLayout.Alignment.LEADING, 0, 291, Short.MAX_VALUE)
                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jcboxUrgencia, javax.swing.GroupLayout.Alignment.LEADING, 0, 291, Short.MAX_VALUE)
                    .addComponent(jcboxEstadoDesarrollo, javax.swing.GroupLayout.Alignment.LEADING, 0, 291, Short.MAX_VALUE))
                .addContainerGap())
        );
        jpanPrioridadLayout.setVerticalGroup(
            jpanPrioridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanPrioridadLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jcboxImportancia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(22, 22, 22)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jcboxUrgencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(25, 25, 25)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jcboxEstadoDesarrollo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(21, 21, 21)
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jcboxEstabilidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(39, Short.MAX_VALUE))
        );

        jTabReqInf.addTab("Prioridad", jpanPrioridad);

        jLabel13.setText("Destino:");

        jLabel14.setText("Origen:");

        jlstDestino.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane2.setViewportView(jlstDestino);

        jbtnAñadirDestino.setText("Añadir destino");
        jbtnAñadirDestino.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAñadirDestinoActionPerformed(evt);
            }
        });

        jbtnEliminarDestino.setText("Eliminar destino");
        jbtnEliminarDestino.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnEliminarDestinoActionPerformed(evt);
            }
        });

        jScrollPane3.setViewportView(jlstOrigen);

        jbtnAñadirOrigen.setText("Añadir origen");
        jbtnAñadirOrigen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAñadirOrigenActionPerformed(evt);
            }
        });

        jbtnEliminarOrigen.setText("Eliminar origen");
        jbtnEliminarOrigen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnEliminarOrigenActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpanRastreabilidadLayout = new javax.swing.GroupLayout(jpanRastreabilidad);
        jpanRastreabilidad.setLayout(jpanRastreabilidadLayout);
        jpanRastreabilidadLayout.setHorizontalGroup(
            jpanRastreabilidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanRastreabilidadLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpanRastreabilidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14)
                    .addGroup(jpanRastreabilidadLayout.createSequentialGroup()
                        .addGroup(jpanRastreabilidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpanRastreabilidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jbtnEliminarOrigen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jbtnAñadirOrigen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jbtnAñadirDestino, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jbtnEliminarDestino, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap(13, Short.MAX_VALUE))
        );
        jpanRastreabilidadLayout.setVerticalGroup(
            jpanRastreabilidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanRastreabilidadLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpanRastreabilidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpanRastreabilidadLayout.createSequentialGroup()
                        .addComponent(jbtnAñadirDestino)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtnEliminarDestino))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jLabel14)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpanRastreabilidadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jpanRastreabilidadLayout.createSequentialGroup()
                        .addComponent(jbtnAñadirOrigen)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtnEliminarOrigen)))
                .addContainerGap(37, Short.MAX_VALUE))
        );

        jTabReqInf.addTab("Rastreabilidad", jpanRastreabilidad);

        jbtnAceptar.setText("Aceptar");
        jbtnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAceptarActionPerformed(evt);
            }
        });

        jbtnCancelar.setText("Cancelar");
        jbtnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jTabReqInf))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(87, 87, 87)
                        .addComponent(jbtnAceptar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtnCancelar)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabReqInf, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtnAceptar)
                    .addComponent(jbtnCancelar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jtxtValorMaximoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtValorMaximoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtxtValorMaximoActionPerformed

    private void jbtnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAceptarActionPerformed
        if(edicion==false){
            ReqInformacion newRInf= auxDocPpal.newRInf(jtxtNombre.getText(), jtxaConcepto.getText(), Integer.parseInt(jtxtValorMaximo.getText()), Integer.parseInt(jtxtValorMedio.getText()), String.valueOf(jcboxImportancia.getSelectedItem()), String.valueOf(jcboxUrgencia.getSelectedItem()), String.valueOf(jcboxEstadoDesarrollo.getSelectedItem()), String.valueOf(jcboxEstabilidad.getSelectedItem()), String.valueOf(jcboxUnidadMaximo.getSelectedItem()), String.valueOf(jcboxUnidadMedio.getSelectedItem()));
            //Rastreabilidad
            for (int i=0; i<getJlstDestino().getModel().getSize(); i++) {
                newRInf.getmDestino().add((String) getJlstDestino().getModel().getElementAt(i).toString());
                auxDocPpal.enlace_rastrea_destino(newRInf,(String) getJlstDestino().getModel().getElementAt(i).toString());
            }
            for (int i=0; i<getJlstOrigen().getModel().getSize(); i++) {
                newRInf.getmOrigen().add((String) getJlstOrigen().getModel().getElementAt(i).toString());
                auxDocPpal.enlace_rastrea_origen((String) getJlstOrigen().getModel().getElementAt(i).toString(), newRInf);
            }
            //Fin Rastreabilidad
            MutableTreeNode node = new DefaultMutableTreeNode("[RIN]-"+ newRInf.getNumero_id()+" "+ newRInf.getNombre());
            DefaultTreeModel model = (DefaultTreeModel) jfaux.getJtreDocumento().getModel();
            jfaux.getJtreDocumento().setCellRenderer(new RendererArbol());
            model.insertNodeInto(node, auxinsertNode, auxinsertIndex);
            mostrarmensaje("Insertado el Requisito " + newRInf.getNombre() + " correctamente.");
        }else{

            auxRIN.setNombre(jtxtNombre.getText());
            auxRIN.setImportancia(String.valueOf(jcboxImportancia.getSelectedItem()));
            auxRIN.setUrgencia(String.valueOf(jcboxUrgencia.getSelectedItem()));
            auxRIN.setEstado_desarrollo(String.valueOf(jcboxEstadoDesarrollo.getSelectedItem()));
            auxRIN.setEstabilidad(String.valueOf(jcboxEstabilidad.getSelectedItem()));
            auxRIN.setValor_maximo(Integer.parseInt(jtxtValorMaximo.getText()));
            auxRIN.setValor_medio(Integer.parseInt(jtxtValorMedio.getText()));
            auxRIN.setUnidad_maximo(String.valueOf(jcboxUnidadMaximo.getSelectedItem()));
            auxRIN.setUnidad_medio(String.valueOf(jcboxUnidadMedio.getSelectedItem()));
            auxinsertNode.setUserObject("[RIN]-"+ auxRIN.getNumero_id()+" "+ auxRIN.getNombre());
            
        }
        auxDocPpal.actualizar();
        jfaux.setEnabled(true);
        this.dispose();
    }//GEN-LAST:event_jbtnAceptarActionPerformed

    private void mostrarmensaje(String mensaje) {
         JOptionPane.showMessageDialog(this, mensaje, "Información",
                                JOptionPane.INFORMATION_MESSAGE/*WARNING_MESSAGE*/);
    } 
    
    private void jbtnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCancelarActionPerformed
        jfaux.setEnabled(true);
        this.dispose();
    }//GEN-LAST:event_jbtnCancelarActionPerformed

    private void jcboxEstabilidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcboxEstabilidadActionPerformed

}//GEN-LAST:event_jcboxEstabilidadActionPerformed

    private void jbtnAñadirDestinoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAñadirDestinoActionPerformed
        jfrmRastreabilidad jfRastreabilidad = new jfrmRastreabilidad(auxDocPpal, this, "destino");
        jfRastreabilidad.setLocationRelativeTo(null);
        jfRastreabilidad.setVisible(true);
        this.setEnabled(false);
    }//GEN-LAST:event_jbtnAñadirDestinoActionPerformed

    private void jbtnEliminarDestinoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEliminarDestinoActionPerformed
        if (!jlstDestino.isSelectionEmpty()) {
            getModelo_destino().removeElement(getJlstDestino().getSelectedValue().toString());
        }
    }//GEN-LAST:event_jbtnEliminarDestinoActionPerformed

    private void jbtnAñadirOrigenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAñadirOrigenActionPerformed
        jfrmRastreabilidad jfRastreabilidad = new jfrmRastreabilidad(auxDocPpal, this, "origen");
        jfRastreabilidad.setLocationRelativeTo(null);
        jfRastreabilidad.setVisible(true);
        this.setEnabled(false);
    }//GEN-LAST:event_jbtnAñadirOrigenActionPerformed

    private void jbtnEliminarOrigenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEliminarOrigenActionPerformed
        if (!jlstOrigen.isSelectionEmpty()) {
            getModelo_origen().removeElement(getJlstOrigen().getSelectedValue().toString());
        }
    }//GEN-LAST:event_jbtnEliminarOrigenActionPerformed

    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(jfrmReqInformacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(jfrmReqInformacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(jfrmReqInformacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(jfrmReqInformacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new jfrmReqInformacion().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTabbedPane jTabReqInf;
    private javax.swing.JButton jbtnAceptar;
    private javax.swing.JButton jbtnAñadirDestino;
    private javax.swing.JButton jbtnAñadirOrigen;
    private javax.swing.JButton jbtnCancelar;
    private javax.swing.JButton jbtnEliminarDestino;
    private javax.swing.JButton jbtnEliminarOrigen;
    private javax.swing.JComboBox jcboxEstabilidad;
    private javax.swing.JComboBox jcboxEstadoDesarrollo;
    private javax.swing.JComboBox jcboxImportancia;
    private javax.swing.JComboBox jcboxUnidadMaximo;
    private javax.swing.JComboBox jcboxUnidadMedio;
    private javax.swing.JComboBox jcboxUrgencia;
    private javax.swing.JList jlstDestino;
    private javax.swing.JList jlstOrigen;
    private javax.swing.JPanel jpanGeneral;
    private javax.swing.JPanel jpanPrioridad;
    private javax.swing.JPanel jpanRastreabilidad;
    private javax.swing.JTextArea jtxaConcepto;
    private javax.swing.JTextField jtxtNombre;
    private javax.swing.JTextField jtxtValorMaximo;
    private javax.swing.JTextField jtxtValorMedio;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the modelo_destino
     */
    public DefaultListModel getModelo_destino() {
        return modelo_destino;
    }

    /**
     * @param modelo_destino the modelo_destino to set
     */
    public void setModelo_destino(DefaultListModel modelo_destino) {
        this.modelo_destino = modelo_destino;
    }

    /**
     * @return the modelo_origen
     */
    public DefaultListModel getModelo_origen() {
        return modelo_origen;
    }

    /**
     * @param modelo_origen the modelo_origen to set
     */
    public void setModelo_origen(DefaultListModel modelo_origen) {
        this.modelo_origen = modelo_origen;
    }

    /**
     * @return the jlstDestino
     */
    public javax.swing.JList getJlstDestino() {
        return jlstDestino;
    }

    /**
     * @param jlstDestino the jlstDestino to set
     */
    public void setJlstDestino(javax.swing.JList jlstDestino) {
        this.jlstDestino = jlstDestino;
    }

    /**
     * @return the jlstOrigen
     */
    public javax.swing.JList getJlstOrigen() {
        return jlstOrigen;
    }

    /**
     * @param jlstOrigen the jlstOrigen to set
     */
    public void setJlstOrigen(javax.swing.JList jlstOrigen) {
        this.jlstOrigen = jlstOrigen;
    }
}
