public void removeRow() {
   try {
     if (tblUnitList.getSelectedRow() < 0) {
       Message.showWarning("Please select in the table");
       return;
     }
     //            if (((Number) model.getValueAt(0, 2)).intValue() > 0) {
     //                deleteUnitList.add((Integer) model.getValueAt(tblUnitList.getSelectedRow(),
     // 4));
     //            }
     if (userTask >= GlobalMode.EDIT
         && (int) model.getValueAt(tblUnitList.getSelectedRow(), 4) > 0) {
       if (JOptionPane.showConfirmDialog(
               this,
               "This unit is already in use. This will be permanently delete to the database. Do you still want to continue?",
               "WARNING",
               JOptionPane.YES_NO_OPTION)
           == JOptionPane.YES_OPTION) {
         totalLeaseArea -=
             ((Number) model.getValueAt(tblUnitList.getSelectedRow(), 1)).doubleValue();
         rDB.deleteRentalDetailID(
             ((Number) model.getValueAt(tblUnitList.getSelectedRow(), 4)).intValue(),
             totalLeaseArea);
         model.removeRow(tblUnitList.getSelectedRow());
       }
     } else {
       totalLeaseArea -=
           ((Number) model.getValueAt(tblUnitList.getSelectedRow(), 1)).doubleValue();
       model.removeRow(tblUnitList.getSelectedRow());
     }
   } catch (Exception e) {
     Message.showError(e.getMessage());
   }
 }
Esempio n. 2
0
  private void usersTableMouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_usersTableMouseClicked
    // TODO add your handling code here:`
    System.out.println(
        "ID - " + (String) usersTableModel.getValueAt(usersTable.getSelectedRow(), 0));
    username = (String) usersTableModel.getValueAt(usersTable.getSelectedRow(), 1);
    String priority = (String) usersTableModel.getValueAt(usersTable.getSelectedRow(), 2);
    System.out.println("SELECTED priority: " + priority);

    if (priority.equals("Admin")) {
      grantPanel.setVisible(true);
      permissionLabel1.setVisible(true);
      permissionButton1.setVisible(true);
      permissionLabel.setVisible(false);
      permissionButton.setVisible(false);
      infoLabel.setText("User Is Already an Admin");
    }
    if (priority.equals("User")) {
      grantPanel.setVisible(true);
      permissionLabel1.setVisible(false);
      permissionButton1.setVisible(false);
      permissionLabel.setVisible(true);
      permissionButton.setVisible(true);
      infoLabel.setText("User Is Already an User");
    }

    MainMenuJFrame.getMainMenuJFrame(User.getUser()).repaintDynamicPanel(this);
  } // GEN-LAST:event_usersTableMouseClicked
Esempio n. 3
0
  private void insertarSolicitud() {
    int cliente = buscaCodClient(cboCliente.getSelectedItem().toString(), "cliente");

    try {
      // Insertar Solicitud
      String sql =
          "INSERT INTO pedido (id, fecha, cliente, fechapedido) VALUES (NULL, '"
              + z.dateFormat(calFecha.getDate())
              + cliente
              + "', NOW())";
      z.snt = z.con.createStatement();
      z.snt.executeUpdate(sql);

      // insertar ítem
      for (int fila = 0; fila < tabla.getRowCount(); fila++) {
        try {
          String sqlitem =
              "INSERT INTO detallepedido (pedido, articulo, cantidad) VALUES ("
                  + modelo.getValueAt(fila, 0)
                  + ", LAST_INSERT_ID(), "
                  + modelo.getValueAt(fila, 2)
                  + ")";
          z.snt = z.con.createStatement();
          z.snt.executeUpdate(sqlitem);
        } catch (SQLException ex) {
          Logger.getLogger(FrmPedido.class.getName()).log(Level.SEVERE, null, ex);
        }
      }
    } catch (SQLException ex) {
      Logger.getLogger(FrmPedido.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Esempio n. 4
0
  private void tablaMouseClicked(java.awt.event.MouseEvent evt) {
    String cedula = "";
    String nombrec = "";
    String direccion = "";

    try {

      DefaultTableModel tm = (DefaultTableModel) tabla.getModel();
      cedula = String.valueOf(tm.getValueAt(tabla.getSelectedRow(), 2));
      nombrec = String.valueOf(tm.getValueAt(tabla.getSelectedRow(), 1));
      direccion = String.valueOf(tm.getValueAt(tabla.getSelectedRow(), 4));
      correo = String.valueOf(tm.getValueAt(tabla.getSelectedRow(), 3));

      if (correo == null) {

        correo = "";
      }
      idc = String.valueOf(tm.getValueAt(tabla.getSelectedRow(), 0));

      nombre.setText(nombrec);
      rcliente.setText(cedula);
      email.setText(correo);

    } catch (java.lang.NumberFormatException ex) {
    }
  }
Esempio n. 5
0
 @SuppressWarnings("unchecked")
 @Override
 public int loop() {
   synchronized (lock) {
     try {
       if (!ui.isVisible()) handler.stopMod(getName());
       World world = minecraft.getWorld();
       JTable list = ui.getList();
       DefaultTableModel model = (DefaultTableModel) list.getModel();
       TableRowSorter<TableModel> sorter = (TableRowSorter<TableModel>) list.getRowSorter();
       if (world != null) {
         Player currentPlayer = minecraft.getPlayer();
         int playerX = (int) java.lang.Math.round(currentPlayer.getX());
         int playerY = (int) java.lang.Math.round(currentPlayer.getY());
         int playerZ = (int) java.lang.Math.round(currentPlayer.getZ());
         ArrayList<Block> blocks = new ArrayList<Block>();
         for (int x = playerX - radius; x < playerX + radius; x++)
           for (int y = playerY - radius; y < playerY + radius; y++)
             for (int z = playerZ - radius; z < playerZ + radius; z++)
               if (world.getBlockIDAt(x, y, z) == blockID) blocks.add(new Block(x, y, z));
         label:
         for (int row = 0; row < model.getRowCount(); row++) {
           int x = (Integer) model.getValueAt(row, 1);
           int y = (Integer) model.getValueAt(row, 2);
           int z = (Integer) model.getValueAt(row, 3);
           for (Block block : blocks) {
             if (x == block.getX() && y == block.getY() && z == block.getZ()) {
               model.setValueAt(getDistanceTo(x, y, z, currentPlayer), row, 0);
               continue label;
             }
           }
           model.removeRow(row);
         }
         label:
         for (Block block : blocks) {
           for (int row = 0; row < model.getRowCount(); row++) {
             int x = (Integer) model.getValueAt(row, 1);
             int y = (Integer) model.getValueAt(row, 2);
             int z = (Integer) model.getValueAt(row, 3);
             if (x == block.getX() && y == block.getY() && z == block.getZ()) continue label;
           }
           model.addRow(
               new Object[] {
                 getDistanceTo(block.getX(), block.getY(), block.getZ(), minecraft.getPlayer()),
                 block.getX(),
                 block.getY(),
                 block.getZ()
               });
         }
         sorter.sort();
         list.repaint();
       } else {
         for (int i = model.getRowCount() - 1; i >= 0; i--) model.removeRow(i);
       }
     } catch (Exception exception) {
     }
   }
   return 500;
 }
Esempio n. 6
0
  protected int compare(int i, int j) {

    String s1 = base.getValueAt(row[i], sortColumn).toString();

    String s2 = base.getValueAt(row[j], sortColumn).toString();

    return s1.compareTo(s2);
  }
Esempio n. 7
0
 private void tblPesquisaMouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_tblPesquisaMouseClicked
   if (evt.getClickCount() > 1) {
     JTable target = (JTable) evt.getSource();
     if (itmNovo.isVisible())
       controller.abrirJanelaCadastro((Long) modelo.getValueAt(target.getSelectedRow(), 5));
     else controller.criarReceita((Long) modelo.getValueAt(tblPesquisa.getSelectedRow(), 5));
   }
 } // GEN-LAST:event_tblPesquisaMouseClicked
Esempio n. 8
0
 private void tablareligMouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_tablareligMouseClicked
   DefaultTableModel modelo = (DefaultTableModel) tablarelig.getModel();
   religion.setText(modelo.getValueAt(tablarelig.getSelectedRow(), 0) + "");
   fecha.setText(modelo.getValueAt(tablarelig.getSelectedRow(), 2) + "");
   usuario.setText(modelo.getValueAt(tablarelig.getSelectedRow(), 3) + "");
   crear.setEnabled(false);
   religion.setEnabled(false);
 } // GEN-LAST:event_tablareligMouseClicked
Esempio n. 9
0
  private ArrayList<String> getRuletypesFilter() {
    ArrayList<String> Ruletypes = new ArrayList<String>();
    for (int i = 0; i < ruletypeModelFilter.getRowCount(); i++) {
      if ((Boolean) ruletypeModelFilter.getValueAt(i, 0)) {
        Ruletypes.add((String) ruletypeModelFilter.getValueAt(i, 1));
      }
    }

    return Ruletypes;
  }
Esempio n. 10
0
  private ArrayList<String> getPathFilter() {
    ArrayList<String> paths = new ArrayList<String>();

    for (int i = 0; i < pathFilterModel.getRowCount(); i++) {
      if ((Boolean) pathFilterModel.getValueAt(i, 0)) {
        paths.add((String) pathFilterModel.getValueAt(i, 1));
      }
    }

    return paths;
  }
Esempio n. 11
0
  private ArrayList<String> getViolationtypesFilter() {
    ArrayList<String> violationtypes = new ArrayList<String>();

    for (int i = 0; i < violationtypeModelFilter.getRowCount(); i++) {
      if ((Boolean) violationtypeModelFilter.getValueAt(i, 0)) {
        violationtypes.add((String) violationtypeModelFilter.getValueAt(i, 1));
      }
    }

    return violationtypes;
  }
Esempio n. 12
0
 public void Tampil() {
   row = tblmaster.getSelectedRow();
   txtid.setText(tblModel.getValueAt(row, 0).toString());
   txtnama.setText(tblModel.getValueAt(row, 1).toString());
   txtalamat.setText(tblModel.getValueAt(row, 2).toString());
   if (tblModel.getValueAt(row, 3).toString().equals("Laki-laki")) {
     rbtnlaki.setSelected(true);
   } else {
     rbtnperempuan.setSelected(true);
   }
 }
Esempio n. 13
0
  public Produto getLinha(int linha) {
    try {
      produto = new Produto();
      produto.setPro_cod(Integer.parseInt("" + dadosProd.getValueAt(linha, 0)));
      produto.setPro_nome("" + dadosProd.getValueAt(linha, 1));
      produto.setPreco_unit(Double.parseDouble("" + dadosProd.getValueAt(linha, 2)));

      return produto;
    } catch (Exception e) {
      return null;
    }
  }
Esempio n. 14
0
 public Object[][] getTableData(JTable table) {
   DefaultTableModel dtm = (DefaultTableModel) table.getModel();
   int nRow = dtm.getRowCount(), nCol = dtm.getColumnCount();
   Object[][] tableData = new Object[nRow][nCol];
   for (int i = 0; i < nRow; i++)
     for (int j = 0; j < nCol; j++) {
       if (dtm.getValueAt(i, j) == null) tableData[i][j] = " ";
       else tableData[i][j] = dtm.getValueAt(i, j);
     }
   batchState.setData(tableData);
   return tableData;
 }
 public void opBono10_12() {
   if (bono_10_12 == true) {
     for (int i = 0; i < model.getRowCount(); i++) {
       float suma =
           Float.parseFloat(model.getValueAt(i, 10) + "")
               + Float.parseFloat(model.getValueAt(i, 12) + "");
       if (suma > 0) {
         model.setValueAt(0.0, i, 5);
       }
     }
   }
 }
Esempio n. 16
0
  /**
   * @param tableModel
   * @return
   */
  public org.jdesktop.swingx.tips.DefaultTip[] getTipsArray(
      javax.swing.table.DefaultTableModel tableModel) {

    org.jdesktop.swingx.tips.DefaultTip tips[] =
        new org.jdesktop.swingx.tips.DefaultTip[tableModel.getRowCount()];

    for (int i = 0; i < tableModel.getRowCount(); i++) {

      tips[i] =
          new org.jdesktop.swingx.tips.DefaultTip(
              tableModel.getValueAt(i, 0).toString(), tableModel.getValueAt(i, 1));
    }

    return tips;
  }
  public void saveUnit() {
    try {
      DefaultTableModel dtm = (DefaultTableModel) tblUnitList.getModel();
      unitLists.clear();
      unitNames.clear();

      if (dtm.getRowCount() == 0) {
        this.dispose();
        return;
      }
      for (int i = 0; i < dtm.getRowCount(); i++) {
        //                if (((Number) dtm.getValueAt(i, 4)).intValue() == 0 || (userTask ==
        // GlobalMode.RENEW)) {
        //                    RentalUnitBean rub = new RentalUnitBean();
        //                    rub.setRentalDetailID((int) dtm.getValueAt(i, 4));
        //                    UnitBean ub = new UnitBean();
        //                    ub.setUnitID((int) dtm.getValueAt(i, 2));
        //                    rub.setUnitBean(ub);
        //                    unitLists.add(rub);
        //                }
        if (((Number) dtm.getValueAt(i, 4)).intValue() == 0) {
          RentalUnitBean rub = new RentalUnitBean();
          rub.setRentalDetailID((int) dtm.getValueAt(i, 4));
          UnitBean ub = new UnitBean();
          ub.setUnitID((int) dtm.getValueAt(i, 2));
          rub.setUnitBean(ub);
          unitLists.add(rub);
        }
        floor = dtm.getValueAt(i, 3).toString();
        unitNames.add(dtm.getValueAt(i, 0).toString());
      }
      KeyValue kv = (KeyValue) cboBuilding.getSelectedItem();
      buildingID = (int) kv.getKey();
      buildingCode = kv.getRow().toString();

      bb.setBuildingID(buildingID);
      bb.setBuildingCode(buildingCode);
      bb.setBuildingName(cboBuilding.getSelectedItem().toString());
      bb.setContractDraft(kv.getOtherRow().toString());
      bb.setActualContract(kv.getOtherRow2().toString());

      RentalEntry re = (RentalEntry) this.getParent();
      re.setUnits(bb, unitNames, unitLists, floor, totalLeaseArea);
      this.dispose();
    } catch (Exception e) {
      Message.showError(e.getMessage());
    }
  }
Esempio n. 18
0
 private void EditNewButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_EditNewButtonActionPerformed
   int row = jTable5.getSelectedRow();
   int value = Integer.parseInt("" + table.getValueAt(row, 0));
   inventory.GeneralMovie singleMovie = result.get(value);
   new EditTitleDialog(localUIC.getCurrentFrame(), false, singleMovie).setVisible(true);
 } // GEN-LAST:event_EditNewButtonActionPerformed
Esempio n. 19
0
  private void jTableUsersMouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jTableUsersMouseClicked
    if (evt.getClickCount() >= 2) {
      // Double clicked!

      int response =
          JOptionPane.showConfirmDialog(
              null,
              "Weet je zeker dat je deze deelnemer wilt uitschrijven?",
              "Deelnemer uitschrijven",
              JOptionPane.YES_NO_OPTION);

      if (response == 0) {
        // Get the currently selected subscription
        int rowNumber = jTableUsers.getSelectedRow();
        int user_id = (Integer) model.getValueAt(rowNumber, 0);

        Enrollment enrollment = new Enrollment();
        enrollment.unsubscribe(this.subscription.getId(), user_id);

        this.model.removeRow(rowNumber);

        Application.getInstance()
            .showPopup(new SuccessPopup("De deelnemer is succesvol uitgeschreven."));
      }
    }
  } // GEN-LAST:event_jTableUsersMouseClicked
  public void showtblReport() {
    DefaultTableModel model = (DefaultTableModel) tblReport.getModel();
    OrdersDAO cd = new OrdersDAO();
    ResultSet rs = cd.reportDate();
    try {
      while (rs.next()) {
        model.addRow(
            new Object[] {
              rs.getInt("id_cus"),
              rs.getString("name_cus"),
              rs.getDate("date_ship"),
              rs.getDouble("tongtien")
            });
      }
    } catch (SQLException ex) {
      System.out.println(ex);
    }
    tblReport.setModel(model);

    int row = tblReport.getRowCount();
    double sum = 0;
    for (int i = 0; i < row; i++) {
      sum += Double.parseDouble(model.getValueAt(i, 3).toString());
    }
    txtDoanhThu.setText(String.valueOf(sum));
  }
 @Override
 public void insertContractors(JTable table, Group group, User user) {
   DefaultTableModel model = (DefaultTableModel) table.getModel();
   String data[] = new String[6];
   for (int i = 0; i < model.getRowCount(); i++) {
     Boolean selected = (Boolean) model.getValueAt(i, 0);
     if (selected) {
       for (int j = 1; j < model.getColumnCount(); j++)
         data[j - 1] = model.getValueAt(i, j).toString();
       Contractor contractor =
           new Contractor(
               group.getGroupId(), user.getUserId(), data[0], data[1], data[2], data[3], data[4]);
       insertContractor(contractor);
     }
   }
 }
  /**
   * Listens for a topic being removed from the space for either a MainMenuController or a
   * ChatroomController.
   */
  @Override
  public void notify(RemoteEvent remoteEvent) throws UnknownEventException, RemoteException {
    try {
      // Get the event that triggered the notification
      AvailabilityEvent availEvent = (AvailabilityEvent) remoteEvent;
      JMSTopicDeleted topicDeleted = (JMSTopicDeleted) availEvent.getEntry();

      if (isChatroomController) {
        // If the listener is for a ChatroomController, inform the given
        // chatroom that the chatroom's topic has been deleted
        chatroomController.handleTopicDeleted();
      } else {
        // If the listener is for a MainMenuController, remove the given
        // topic from the MainMenuController's topic list.
        DefaultTableModel topicTableModel = mainMenuController.getTopicTableModel();

        // Loop through all of the topics in the MainMenuController's
        // topic list and remove the one that was deleted
        for (int i = 0; i < topicTableModel.getRowCount(); i++) {
          UUID topicIdInTable = (UUID) topicTableModel.getValueAt(i, 3);
          JMSTopic topicRemoved = topicDeleted.getTopic();
          UUID topicDeletedId = topicRemoved.getId();

          if (topicIdInTable.equals(topicDeletedId)) {
            topicTableModel.removeRow(i);

            break;
          }
        }
      }
    } catch (Exception e) {
      System.err.println("Failed to remove topic from list or send notifications to users.");
      e.printStackTrace();
    }
  }
Esempio n. 23
0
 private void checkConstraints(DiscapacidadDetalle toAdd) throws MessageException {
   if (toAdd.getPeriodoYear() == null) {
     throw new MessageException("Número de carpeta no válida");
   }
   DefaultTableModel dtm = (DefaultTableModel) abmPanel.getjTable1().getModel();
   for (int row = 0; row < dtm.getRowCount(); row++) {
     DiscapacidadDetalle oldDiscapacidadDetalle = (DiscapacidadDetalle) dtm.getValueAt(row, 0);
     if (oldDiscapacidadDetalle.getTipoDocumento().equals(toAdd.getTipoDocumento())
         && Objects.equals(
             oldDiscapacidadDetalle.getSubTipoDocumento(), toAdd.getSubTipoDocumento())
         && Objects.equals(oldDiscapacidadDetalle.getDocumentoNumero(), toAdd.getDocumentoNumero())
         && Objects.equals(oldDiscapacidadDetalle.getPeriodoYear(), toAdd.getPeriodoYear())
         && Objects.equals(oldDiscapacidadDetalle.getNombre(), toAdd.getNombre())
         && Objects.equals(oldDiscapacidadDetalle.getApellido(), toAdd.getApellido())) {
       throw new MessageException(
           "Ya existe un detalle con los mismos datos:"
               + "\nTipo de Documento: "
               + toAdd.getTipoDocumento().getNombre()
               + "\nSub-Tipo de Documento: "
               + (toAdd.getSubTipoDocumento() == null
                   ? "<Sin Sub-Tipo>"
                   : toAdd.getSubTipoDocumento().getNombre())
               + "\nN° Documento: "
               + Objects.toString(toAdd.getDocumentoNumero(), "")
               + "\nPeriodo: "
               + Objects.toString(toAdd.getPeriodoYear(), "")
               + "\nNombre: "
               + (toAdd.getApellido() == null ? "" : toAdd.getApellido() + ", ")
               + (Objects.toString(toAdd.getNombre(), "")));
     }
   }
 }
 private void btnAgregarViajeActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnAgregarViajeActionPerformed
   DefaultTableModel modelo = (DefaultTableModel) tblViaje.getModel();
   int fila = tblViaje.getSelectedRow();
   Iterator ite = gestorH.listarClase(Viaje.class).iterator();
   while (ite.hasNext()) {
     Viaje viaje = (Viaje) ite.next();
     if (viaje.getIdViaje() == modelo.getValueAt(fila, 0)) {
       txtNumeroSolicitud.setText(viaje.getSolicitud().toString());
       txtNumViaje.setText(String.valueOf(viaje.getIdViaje()));
       txtFechaRealizacion.setText(viaje.getFecha());
       txtTipoViaje.setText(viaje.getTipoViaje().toString());
       txtCereal.setText(viaje.getSolicitud().getTipoCereal().toString());
       txtProductor.setText(viaje.getProductor().toString());
       txtHoraViaje.setText(viaje.getHora());
       Iterator ite1 = gestorH.listarClase(EstablecimientoPorViaje.class).iterator();
       while (ite1.hasNext()) {
         EstablecimientoPorViaje est = (EstablecimientoPorViaje) ite1.next();
         if (est.getViaje().equals(viaje)) {
           txtDestino.setText(est.getEstablecimiento().getNombreEstablecimiento());
         }
       }
       Iterator ite2 = gestorH.listarClase(PuertoPorViaje.class).iterator();
       while (ite2.hasNext()) {
         PuertoPorViaje est = (PuertoPorViaje) ite2.next();
         if (est.getViaje().equals(viaje)) {
           txtDestino.setText(est.getPuerto().getNombrePuerto());
         }
       }
       gestorA.RellenarTablaVehiculo(tblVehiculo, viaje);
     }
   }
 } // GEN-LAST:event_btnAgregarViajeActionPerformed
Esempio n. 25
0
  public void letterOrDigitTyped() {
    table.setAllowEditing(true);
    table.repaint(); // G.Sturr 2009-10-10: cleanup when keypress edit begins

    // check if cell fixed
    Object o = model.getValueAt(table.getSelectedRow(), table.getSelectedColumn());
    if (o != null && o instanceof GeoElement) {
      GeoElement geo = (GeoElement) o;
      if (geo.isFixed()) return;
    }

    model.setValueAt(null, table.getSelectedRow(), table.getSelectedColumn());
    table.editCellAt(table.getSelectedRow(), table.getSelectedColumn());
    // workaround, see
    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4192625
    final JTextComponent f = (JTextComponent) table.getEditorComponent();
    f.requestFocus();
    f.getCaret().setVisible(true);

    // workaround for Mac OS X 10.5 problem (first character typed deleted)
    if (Application.MAC_OS)
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              f.setSelectionStart(1);
              f.setSelectionEnd(1);
            }
          });

    table.setAllowEditing(false);
  }
  private void importButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_importButtonActionPerformed
    // get selected items from list and try to start import ..
    List<VCard> selectedContacts = new ArrayList<VCard>();
    DefaultTableModel tableModel = (DefaultTableModel) importContactsTable.getModel();
    if (tableModel.getRowCount() == 0) {
      JOptionPane.showMessageDialog(
          this,
          bundle.getString("list.of.contacts.is.empty"),
          bundle.getString("error"),
          JOptionPane.ERROR_MESSAGE);
    } else {
      int[] sel = importContactsTable.getSelectedRows();
      for (int i = 0; i < sel.length; i++) {
        VCard v = (VCard) tableModel.getValueAt(sel[i], 0);
        selectedContacts.add(v);
      }

      if (selectedContacts.size() == 0) {
        JOptionPane.showMessageDialog(
            this,
            bundle.getString("no.contacts.selected"),
            bundle.getString("error"),
            JOptionPane.ERROR_MESSAGE);
      } else {
        // start import of selected contacts
        client.importContacts(
            selectedContacts.toArray(new VCard[selectedContacts.size()]), isVCFVerified);
        this.dispose();
      }
      for (VCard vc : selectedContacts) {
        System.out.println(vc.getStructuredName().getFamily());
      }
    }
  } // GEN-LAST:event_importButtonActionPerformed
Esempio n. 27
0
  private void closeButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_closeButtonActionPerformed
    attachmentHandlerProperties.setClassName(classNameField.getText());
    attachmentHandlerProperties.getProperties().clear();

    DefaultTableModel model = (DefaultTableModel) propertiesTable.getModel();

    for (int i = 0; i < model.getRowCount(); i++) {
      attachmentHandlerProperties
          .getProperties()
          .put((String) model.getValueAt(i, 0), (String) model.getValueAt(i, 1));
    }

    attachmentHandlerProperties = null;
    this.dispose();
  } // GEN-LAST:event_closeButtonActionPerformed
 private void btnAceptarActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnAceptarActionPerformed
   for (int i = 0; i < panelAgregar.getComponents().length; i++) {
     panelAgregar.getComponent(i).setEnabled(true);
   }
   for (int i = 0; i < panelDatosL.getComponents().length; i++) {
     panelDatosL.getComponent(i).setEnabled(true);
   }
   panelDatosL.setVisible(true);
   panelEdicion.setVisible(false);
   DefaultTableModel modeloT = (DefaultTableModel) tblEditar.getModel();
   int fila = tblEditar.getSelectedRow();
   Iterator ite = gestorH.listarClase(Laboratorio.class).iterator();
   while (ite.hasNext()) {
     Laboratorio e = (Laboratorio) ite.next();
     if (e.getRazonSocial().equalsIgnoreCase(modeloT.getValueAt(fila, 0).toString())) {
       txtRazonSocial.setText(e.getRazonSocial());
       txtTelefono.setText(e.getTelefono());
       txtEmail.setText(e.geteMail());
       txtCalle.setText(e.getDomicilio().getCalle());
       txtNum.setText(String.valueOf(e.getDomicilio().getNumero()));
       cmbBarrio.setSelectedItem(e.getDomicilio().getBarrio());
       cmbLocalidad.setSelectedItem(e.getDomicilio().getBarrio().getLocalidad());
       cmbDepartamento.setSelectedItem(
           e.getDomicilio().getBarrio().getLocalidad().getDepartamento());
       cmbProvincia.setSelectedItem(
           e.getDomicilio().getBarrio().getLocalidad().getDepartamento().getProvincia());
       cmbEspecialidad.setSelectedItem(e.getEspecialidad());
     }
   }
   editar = true;
 } // GEN-LAST:event_btnAceptarActionPerformed
Esempio n. 29
0
 /**
  * Обработчик кнопки: Update Изменяет название выделеного жанра NC_Lab1.GUI.GUI.changed = true;
  */
 private void jButtonUpdateActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonUpdateActionPerformed
   if (param == null) {
     param = new ArrayList<>();
   } else {
     param.clear();
   }
   DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
   if (jTable1.getSelectedRow() == -1) {
     if (jTable1.getRowCount() == 0) {
       errorMessage("Таблица пустая!");
     } else {
       errorMessage("Вы должны выбрать жанр!");
     }
   } else {
     try {
       param.add(model.getValueAt(jTable1.getSelectedRow(), 0).toString()); // изменяемый жанр
       param.add(jTextFieldNewGenre.getText()); // его новое значение
       ctrl.updateGenre(param);
       showTable(FindGenre.ByAllGenres, "");
       NC_Lab1.GUI.GUI.changed = true;
     } catch (IOException ex) {
       errorMessage("Ошибка при удалении трека");
       Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 } // GEN-LAST:event_jButtonUpdateActionPerformed
Esempio n. 30
0
  // no funciona
  public void cargarFecha(int id) {
    if (!Base.hasConnection()) {
      Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/quiniela", "tecpro", "tecpro");
    }
    if (!(tablaProducto
        .getValueAt(view.getTablaProductos().getSelectedRow(), 4)
        .equals(Boolean.FALSE))) {
      getView().getInsertar().setEnabled(true);
      getView().getQuitar().setEnabled(true);
      tablaFecha.setRowCount(0);
      listaFS = Fecha.where("producto_id = ?", id);
      Iterator<Fecha> itr = listaFS.iterator();
      while (itr.hasNext()) {
        Fecha p = itr.next();
        Object row[] = new Object[1];
        row[0] = p.getString("diaDeposito");
        tablaFecha.addRow(row);
      }
      tablaFecha.addRow(new Object[1]);
    } else {
      tablaFecha.setRowCount(0);
      getView().getInsertar().setEnabled(false);
      getView().getQuitar().setEnabled(false);
    }

    if (Base.hasConnection()) {
      Base.close();
    }
  }