/**
   * Add the sample to the export dialog and close.
   *
   * @param evt
   */
  private void okButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_okButtonActionPerformed

    ArrayList<CvTerm> cvTerms = new ArrayList<CvTerm>();

    // add species
    if (speciesJComboBox.getSelectedIndex() > 0
        && speciesJComboBox.getSelectedIndex() < speciesJComboBox.getItemCount() - 1) {

      if (!((String) speciesJComboBox.getSelectedItem()).equalsIgnoreCase(comboboxSeparator)) {
        cvTerms.add(
            new CvTerm(
                "NEWT",
                speciesMap.get((String) speciesJComboBox.getSelectedItem()),
                (String) speciesJComboBox.getSelectedItem(),
                null));
      }
    }

    // add tissue type
    if (tissueJComboBox.getSelectedIndex() > 0
        && tissueJComboBox.getSelectedIndex() < tissueJComboBox.getItemCount() - 1) {

      if (!((String) tissueJComboBox.getSelectedItem()).equalsIgnoreCase(comboboxSeparator)) {
        cvTerms.add(
            new CvTerm(
                "BTO",
                tissueMap.get((String) tissueJComboBox.getSelectedItem()),
                (String) tissueJComboBox.getSelectedItem(),
                null));
      }
    }

    // add cell type
    if (cellTypeJComboBox.getSelectedIndex() > 0
        && cellTypeJComboBox.getSelectedIndex() < cellTypeJComboBox.getItemCount() - 1) {

      if (!((String) cellTypeJComboBox.getSelectedItem()).equalsIgnoreCase(comboboxSeparator)) {
        cvTerms.add(
            new CvTerm(
                "CL",
                cellTypeMap.get((String) cellTypeJComboBox.getSelectedItem()),
                (String) cellTypeJComboBox.getSelectedItem(),
                null));
      }
    }

    // add additional cv terms
    for (int i = 0; i < sampleCvTermsJTable.getRowCount(); i++) {
      cvTerms.add(
          new CvTerm(
              (String) sampleCvTermsJTable.getValueAt(i, 1),
              (String) sampleCvTermsJTable.getValueAt(i, 2),
              (String) sampleCvTermsJTable.getValueAt(i, 3),
              (String) sampleCvTermsJTable.getValueAt(i, 4)));
    }

    prideExportDialog.setSample(new Sample(sampleNameJTextField.getText(), cvTerms));
    dispose();
  } // GEN-LAST:event_okButtonActionPerformed
 /**
  * Try to delete the given sample.
  *
  * @param evt
  */
 private void deleteButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_deleteButtonActionPerformed
   dispose();
   prideExportDialog.deleteSample(
       new Sample(sampleNameJTextField.getText(), new ArrayList<CvTerm>()));
 } // GEN-LAST:event_deleteButtonActionPerformed