@Override
    public void editItem(Object[] items) {
      try {
        String projName = (String) items[0];
        int projID =
            MedSavantClient.ProjectManager.getProjectID(
                LoginController.getInstance().getSessionID(), projName);

        // Check for existing unpublished changes to this project.
        if (ProjectController.getInstance().promptForUnpublished()) {
          try {
            // Get lock.
            if (MedSavantClient.SettingsManager.getDBLock(
                LoginController.getInstance().getSessionID())) {
              try {
                ProjectWizard wiz =
                    new ProjectWizard(
                        projID,
                        projName,
                        MedSavantClient.PatientManager.getCustomPatientFields(
                            LoginController.getInstance().getSessionID(), projID),
                        MedSavantClient.ProjectManager.getProjectDetails(
                            LoginController.getInstance().getSessionID(), projID));
                wiz.setVisible(true);

              } finally {
                try {
                  MedSavantClient.SettingsManager.releaseDBLock(
                      LoginController.getInstance().getSessionID());
                } catch (Exception ex1) {
                  LOG.error("Error releasing database lock.", ex1);
                }
              }
            } else {
              DialogUtils.displayMessage(
                  "Cannot Modify Project",
                  "The database is currently locked.\nTo unlock, see the Projects page in the Administration section.");
            }
          } catch (Exception ex) {
            ClientMiscUtils.reportError("Error getting database lock: %s", ex);
          }
        }
      } catch (Exception ex) {
        ClientMiscUtils.reportError("Error checking for changes: %s", ex);
      }
    }
    @Override
    public void deleteItems(List<Object[]> items) {
      int nameIndex = 0;
      int keyIndex = 0;

      int result;

      if (items.size() == 1) {
        String name = (String) items.get(0)[nameIndex];
        result =
            DialogUtils.askYesNo(
                "Confirm",
                "<html>Are you sure you want to remove <i>%s</i>?<br>This cannot be undone.</html>",
                name);
      } else {
        result =
            DialogUtils.askYesNo(
                "Confirm",
                "<html>Are you sure you want to remove these %d projects?<br>This cannot be undone.</html>",
                items.size());
      }

      if (result == DialogUtils.YES) {
        for (Object[] v : items) {
          String projectName = (String) v[keyIndex];
          controller.removeProject(projectName);
        }

        try {
          if (controller.getProjectNames().length == 0) {
            LoginController.getInstance().logout();
          }
          DialogUtils.displayMessage("Successfully removed " + items.size() + " project(s)");
        } catch (Exception ex) {
          ClientMiscUtils.reportError("Unable to get updated project list: %s.", ex);
        }
      }
    }
    private synchronized void setDetailsList(ProjectDetails[] projectDetails) {

      details.removeAll();

      ViewUtil.setBoxYLayout(details);

      String[][] values = new String[projectDetails.length][2];
      for (int i = 0; i < projectDetails.length; i++) {
        values[i][0] = projectDetails[i].getReferenceName();
        values[i][1] = projectDetails[i].getNumAnnotations() + " annotation(s) applied";
      }

      details.add(ViewUtil.getKeyValuePairList(values));
      try {
        if (MedSavantClient.SettingsManager.getSetting(
                LoginController.getInstance().getSessionID(), "db lock")
            .equals("true")) {
          JPanel p = new JPanel();
          ViewUtil.applyHorizontalBoxLayout(p);
          p.add(
              ViewUtil.alignLeft(
                  new JLabel(
                      "The database is locked. Administrators cannot make further changes.")));

          JButton b = new JButton("Unlock");
          b.addActionListener(
              new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent ae) {
                  try {
                    int result =
                        DialogUtils.askYesNo(
                            "Warning",
                            "Unlocking the database while another administrator is making changes can\n"
                                + "cause permanent damage. Only unlock if you are sure no one is in the process of\n"
                                + "making changes. Are you sure you want to proceed?");

                    if (result == DialogUtils.YES) {
                      MedSavantClient.SettingsManager.releaseDBLock(
                          LoginController.getInstance().getSessionID());
                      refreshSelectedProject();
                    }
                  } catch (Exception ex) {
                  }
                }
              });
          p.add(b);
          details.add(Box.createVerticalStrut(10));
          details.add(p);
        } else {
          JPanel p = new JPanel();
          ViewUtil.applyHorizontalBoxLayout(p);
          p.add(
              ViewUtil.alignLeft(
                  new JLabel("The database is unlocked. Administrators can make changes.")));

          JButton b = new JButton("Lock");
          b.addActionListener(
              new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent ae) {
                  try {
                    MedSavantClient.SettingsManager.getDBLock(
                        LoginController.getInstance().getSessionID());
                    refreshSelectedProject();
                  } catch (Exception ex) {
                  }
                }
              });
          p.add(b);
          details.add(Box.createVerticalStrut(10));
          details.add(p);
        }
      } catch (Exception ex) {
      }

      details.updateUI();
    }
 @Override
 protected ProjectDetails[] doInBackground() throws Exception {
   int projectId = ProjectController.getInstance().getProjectID(projectName);
   return MedSavantClient.ProjectManager.getProjectDetails(
       LoginController.getInstance().getSessionID(), projectId);
 }