/** Binds list, navigation and simple direct properties. */
  @SuppressWarnings("unchecked")
  private void bindBasics() {
    // bind the list
    JListBinding listBinding =
        SwingBindings.createJListBinding(UpdateStrategy.READ_WRITE, beanList, list);
    listBinding.setDetailBinding(BeanProperty.create("value"));
    listBinding.bind();

    // bind the properties
    Validator notEmpty = new NotEmptyValidator();
    BindingGroupBean context = new BindingGroupBean();
    // bind the navigation to list selection
    context.addBinding(
        Bindings.createAutoBinding(
            UpdateStrategy.READ,
            list,
            BeanProperty.create("selectedElement"),
            navigation,
            BeanProperty.create("selectedElement")));
    Binding valueBinding =
        Bindings.createAutoBinding(
            UpdateStrategy.READ_WRITE,
            navigation,
            BeanProperty.create("selectedElement.value"),
            valueField,
            BeanProperty.create("text"));
    valueBinding.setSourceUnreadableValue(null);
    context.addBinding(valueBinding);
    valueBinding.setValidator(notEmpty);
    Binding activityBinding =
        Bindings.createAutoBinding(
            UpdateStrategy.READ_WRITE,
            navigation,
            BeanProperty.create("selectedElement.active"),
            activityBox,
            BeanProperty.create("selected"));
    activityBinding.setSourceUnreadableValue(Boolean.FALSE);
    context.addBinding(activityBinding);
    context.bind();

    BindingGroup bufferingContext = new BindingGroup();
    bufferingContext.addBinding(
        Bindings.createAutoBinding(
            UpdateStrategy.READ,
            context,
            BeanProperty.create("dirty"),
            uncommittedBox,
            BeanProperty.create("selected")));
    bufferingContext.bind();
  }
  /**
   * 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() {
    bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

    LibreriaUniformePUEntityManager =
        java.beans.Beans.isDesignTime()
            ? null
            : javax.persistence.Persistence.createEntityManagerFactory("LibreriaUniformePU")
                .createEntityManager();
    empleadosQuery =
        java.beans.Beans.isDesignTime()
            ? null
            : LibreriaUniformePUEntityManager.createQuery("SELECT e FROM Empleados e");
    empleadosList =
        java.beans.Beans.isDesignTime()
            ? java.util.Collections.emptyList()
            : empleadosQuery.getResultList();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    eliminar = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    editar = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    lCargo = new javax.swing.JTextField();
    identificacion = new javax.swing.JTextField();
    nombres = new javax.swing.JTextField();
    apellidos = new javax.swing.JTextField();
    estado = new javax.swing.JCheckBox();
    jScrollPane2 = new javax.swing.JScrollPane();
    listArea = new javax.swing.JList();
    jScrollPane3 = new javax.swing.JScrollPane();
    listCargo = new javax.swing.JList();
    lArea = new javax.swing.JTextField();

    setTitle("Editar o Eliminar Cargo");

    jTable1.setBorder(
        new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

    org.jdesktop.swingbinding.JTableBinding jTableBinding =
        org.jdesktop.swingbinding.SwingBindings.createJTableBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            empleadosList,
            jTable1);
    org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding =
        jTableBinding.addColumnBinding(
            org.jdesktop.beansbinding.ELProperty.create("${idempleados}"));
    columnBinding.setColumnName("Identificacion");
    columnBinding.setColumnClass(Integer.class);
    columnBinding =
        jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${nombres}"));
    columnBinding.setColumnName("Nombres");
    columnBinding.setColumnClass(String.class);
    columnBinding =
        jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${apellidos}"));
    columnBinding.setColumnName("Apellidos");
    columnBinding.setColumnClass(String.class);
    columnBinding =
        jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${actDes}"));
    columnBinding.setColumnName("Estado");
    columnBinding.setColumnClass(Boolean.class);
    columnBinding =
        jTableBinding.addColumnBinding(
            org.jdesktop.beansbinding.ELProperty.create("${areasIdareas.area}"));
    columnBinding.setColumnName("Area");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    columnBinding =
        jTableBinding.addColumnBinding(
            org.jdesktop.beansbinding.ELProperty.create("${cargosIdcargos.cargo}"));
    columnBinding.setColumnName("Cargo");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    bindingGroup.addBinding(jTableBinding);
    jTableBinding.bind();
    jScrollPane1.setViewportView(jTable1);
    if (jTable1.getColumnModel().getColumnCount() > 0) {
      jTable1.getColumnModel().getColumn(1).setPreferredWidth(200);
    }

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

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

    editar.setText("Editar");
    editar.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            editarActionPerformed(evt);
          }
        });

    jLabel1.setText("Identificacion:");

    jLabel2.setText("Nombres:");

    jLabel3.setText("Apellidos:");

    jLabel4.setText("Act/Des");

    jLabel5.setText("Area:");

    jLabel6.setText("Cargo:");

    lCargo.setEditable(false);
    lCargo.setEnabled(false);
    lCargo.setOpaque(false);

    org.jdesktop.beansbinding.Binding binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            listCargo,
            org.jdesktop.beansbinding.ELProperty.create(
                "${selectedElement.cargosIdcargos.idcargos}"),
            lCargo,
            org.jdesktop.beansbinding.BeanProperty.create("text"));
    bindingGroup.addBinding(binding);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            jTable1,
            org.jdesktop.beansbinding.ELProperty.create("${selectedElement.idempleados}"),
            identificacion,
            org.jdesktop.beansbinding.BeanProperty.create("text"));
    bindingGroup.addBinding(binding);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            jTable1,
            org.jdesktop.beansbinding.ELProperty.create("${selectedElement.nombres}"),
            nombres,
            org.jdesktop.beansbinding.BeanProperty.create("text"));
    bindingGroup.addBinding(binding);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            jTable1,
            org.jdesktop.beansbinding.ELProperty.create("${selectedElement.apellidos}"),
            apellidos,
            org.jdesktop.beansbinding.BeanProperty.create("text"));
    bindingGroup.addBinding(binding);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            jTable1,
            org.jdesktop.beansbinding.ELProperty.create("${selectedElement.actDes}"),
            estado,
            org.jdesktop.beansbinding.BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);

    org.jdesktop.swingbinding.JListBinding jListBinding =
        org.jdesktop.swingbinding.SwingBindings.createJListBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            empleadosList,
            listArea);
    jListBinding.setDetailBinding(
        org.jdesktop.beansbinding.ELProperty.create("${areasIdareas.area}"));
    bindingGroup.addBinding(jListBinding);

    jScrollPane2.setViewportView(listArea);

    jListBinding =
        org.jdesktop.swingbinding.SwingBindings.createJListBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            empleadosList,
            listCargo);
    jListBinding.setDetailBinding(
        org.jdesktop.beansbinding.ELProperty.create("${cargosIdcargos.cargo}"));
    bindingGroup.addBinding(jListBinding);

    jScrollPane3.setViewportView(listCargo);

    lArea.setEditable(false);
    lArea.setEnabled(false);
    lArea.setOpaque(false);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            listArea,
            org.jdesktop.beansbinding.ELProperty.create("${selectedElement.areasIdareas.idareas}"),
            lArea,
            org.jdesktop.beansbinding.BeanProperty.create("text"));
    bindingGroup.addBinding(binding);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(editar)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(eliminar)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButton2))
                            .addGroup(
                                layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(
                                        jScrollPane1,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        792,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(
                                        layout
                                            .createSequentialGroup()
                                            .addGroup(
                                                layout
                                                    .createParallelGroup(
                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment
                                                                    .LEADING)
                                                            .addComponent(jLabel1)
                                                            .addComponent(jLabel2)
                                                            .addComponent(jLabel3)
                                                            .addComponent(jLabel4)
                                                            .addComponent(jLabel5)
                                                            .addComponent(
                                                                lArea,
                                                                javax.swing.GroupLayout.Alignment
                                                                    .TRAILING,
                                                                javax.swing.GroupLayout
                                                                    .PREFERRED_SIZE,
                                                                68,
                                                                javax.swing.GroupLayout
                                                                    .PREFERRED_SIZE))
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment
                                                                    .LEADING,
                                                                false)
                                                            .addComponent(
                                                                jLabel6,
                                                                javax.swing.GroupLayout
                                                                    .DEFAULT_SIZE,
                                                                javax.swing.GroupLayout
                                                                    .DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                            .addComponent(
                                                                lCargo,
                                                                javax.swing.GroupLayout
                                                                    .PREFERRED_SIZE,
                                                                33,
                                                                javax.swing.GroupLayout
                                                                    .PREFERRED_SIZE)))
                                            .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addGroup(
                                                layout
                                                    .createParallelGroup(
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        false)
                                                    .addComponent(
                                                        jScrollPane2,
                                                        javax.swing.GroupLayout.Alignment.LEADING,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        0,
                                                        Short.MAX_VALUE)
                                                    .addGroup(
                                                        layout
                                                            .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment
                                                                    .LEADING)
                                                            .addGroup(
                                                                layout
                                                                    .createParallelGroup(
                                                                        javax.swing.GroupLayout
                                                                            .Alignment.LEADING,
                                                                        false)
                                                                    .addComponent(
                                                                        identificacion,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE,
                                                                        121,
                                                                        javax.swing.GroupLayout
                                                                            .PREFERRED_SIZE)
                                                                    .addComponent(nombres)
                                                                    .addComponent(
                                                                        apellidos,
                                                                        javax.swing.GroupLayout
                                                                            .DEFAULT_SIZE,
                                                                        178,
                                                                        Short.MAX_VALUE))
                                                            .addComponent(estado))
                                                    .addComponent(
                                                        jScrollPane3,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        0,
                                                        Short.MAX_VALUE)))))
                    .addContainerGap(23, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(
                                identificacion,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(
                                nombres,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(
                                apellidos,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(estado))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel5)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        lArea,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                jScrollPane2,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                52,
                                Short.MAX_VALUE))
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel6)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        lCargo,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 21, Short.MAX_VALUE))
                            .addComponent(
                                jScrollPane3,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                0,
                                Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        jScrollPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        199,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(eliminar)
                                    .addComponent(jButton2))
                            .addComponent(editar))
                    .addGap(6, 6, 6)));

    bindingGroup.bind();

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