use of com.moneychanger.ui.dialogs.DeleteNYMDialog in project otapij by FellowTraveler.
the class MainPage method jButton_RemoveAccount1ActionPerformed.
//GEN-LAST:event_jButton_EditAccount1ActionPerformed
private void jButton_RemoveAccount1ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton_RemoveAccount1ActionPerformed
if (jTable_NymsList.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(this, "Please select NYM to delete", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
String nymID = (String) jTable_NymsList.getModel().getValueAt(jTable_NymsList.getSelectedRow(), 1);
int userSelection = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete NYM", "NYM Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
System.out.println("userSelection:" + userSelection);
NYM nym = new NYM();
if (userSelection == 0) {
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Map registeredServers = new NYM().registeredServers(nymID);
if (registeredServers == null || registeredServers.size() < 1) {
boolean status = new NYM().deleteWalletNym(nymID);
if (status) {
JOptionPane.showMessageDialog(this, "Nym deleted sucessfully from the wallet", "NYM deletion success", JOptionPane.INFORMATION_MESSAGE);
refreshNYMSList();
return;
} else {
JOptionPane.showMessageDialog(this, "Cannot delete nym from the wallet", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
dispose();
}
new DeleteNYMDialog(this, true, nymID).setVisible(true);
}
}
Aggregations