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
/** Creates new form ImportIdentitiesDialog */ public ImportIdentitiesDialog(PanboxClient client) { super(client.getMainWindow()); this.client = client; initComponents(); importPINTextField.getDocument().addDocumentListener(contactLoadingListener); // fileLocTextField.getDocument().addDocumentListener( // contactLoadingListener); // importContactList.getSelectionModel().addListSelectionListener( // contactSelectionListener); importContactsTable.getSelectionModel().addListSelectionListener(contactSelectionListener); }