private void removeAllCertificates() {
   try {
     int selection =
         JOptionPane.showConfirmDialog(
             this, "Are you sure you want to remove all of the listed certificates?");
     if (selection == JOptionPane.YES_OPTION) {
       GridAdministrationClient client = session.getAdminClient();
       int rowCount = getUserCertificates().getRowCount();
       for (int i = 0; i < rowCount; i++) {
         showProgess("Removing certificates...");
         UserCertificateRecord record =
             (UserCertificateRecord) getUserCertificates().getValueAt(0, 0);
         client.removeUserCertificate(record.getSerialNumber());
         getUserCertificates().removeRow(0);
       }
       stopProgess(rowCount + " certificate(s) removed.");
       GridApplication.getContext()
           .showMessage("The listed certificates were successfully removed!!!");
     }
   } catch (Exception e) {
     stopProgess("Error");
     ErrorDialog.showError(e);
     FaultUtil.logFault(log, e);
   }
   enableButtons();
 }
  private void removeCertificate() {
    try {
      int row = getUserCertificates().getSelectedRow();

      if ((row >= 0) && (row < getUserCertificates().getRowCount())) {
        UserCertificateRecord record =
            (UserCertificateRecord) getUserCertificates().getValueAt(row, 0);
        int selection =
            JOptionPane.showConfirmDialog(
                this, "Are you sure you want to remove the selected certificate?");
        if (selection == JOptionPane.YES_OPTION) {
          showProgess("Removing certificate...");
          GridAdministrationClient client = session.getAdminClient();
          client.removeUserCertificate(record.getSerialNumber());
          getUserCertificates().removeRow(row);
          GridApplication.getContext()
              .showMessage("The selected certificates was successfully removed!!!");
          stopProgess("Certificate successfully removed.");
        }
      } else {
        throw new Exception("Please select a certificate!!!");
      }
    } catch (Exception e) {
      ErrorDialog.showError(e);
      stopProgess("Error");
      FaultUtil.logFault(log, e);
    }
    enableButtons();
  }