protected void commit() {
    if (!model.isTableComplete()) {
      JOptionPane.showMessageDialog(
          this,
          "The table is incomplete.  You must provide names for all series before continuing");
      return;
    }

    searchDatabaseForMatches();

    if (model.areThereMissingEntites(true)) {
      Object[] options = {"Yes", "No", "Cancel"};
      int n =
          JOptionPane.showOptionDialog(
              this,
              "Some of the entities are not currently in the database. If you continue, "
                  + "basic records for these entities will automatically be created.\n\n"
                  + "Would you like to proceed?",
              "Confirmation",
              JOptionPane.YES_NO_CANCEL_OPTION,
              JOptionPane.QUESTION_MESSAGE,
              null,
              options,
              options[2]);

      if (n == JOptionPane.OK_OPTION) {
        model.generateMissingEntities(
            this.chkIncludeSubobjects.isSelected(), defaultEntitiesDialog);
      } else if (n == JOptionPane.CANCEL_OPTION) {
        return;
      }
    }

    // Open the series in an editor if requested
    if (chckbxOpenSeriesIn.isSelected()) {
      openEditor();
    }

    containerFrame.setVisible(false);
  }
  @Override
  public void actionPerformed(ActionEvent evt) {
    if (evt.getActionCommand().equals("SearchDB")) {
      searchDatabaseForMatches();
    } else if (evt.getActionCommand().equals("Finish")) {
      commit();
    } else if (evt.getActionCommand().equals("Cancel")) {
      containerFrame.dispose();
    } else if (evt.getActionCommand().equals("DefineByPattern")) {
      fillTableByPattern();
    } else if (evt.getActionCommand().equals("IncludeExcludeSubObjects")) {
      table.getColumnExt("SubObjectColumn").setVisible(this.chkIncludeSubobjects.isSelected());
    } else if (evt.getActionCommand().equals("SetDefaults")) {

      /*MVCArrayList<ControlledVoc> objectdic = Dictionary.getMutableDictionary("objectTypeDictionary");
      for(ControlledVoc item : objectdic)
      {
      	if(item.getNormal().equals("Site"))
      	{
      		defaultEntitiesDialog.setDefaultValues(item);
      	}
      }*/

      defaultEntitiesDialog.setVisible(true);

      if (defaultEntitiesDialog == null) {
        defaultEntitiesDialog = new DefaultEntityParametersDialog(containerFrame);
      }

    } else if (evt.getActionCommand().equals("GenerateMissing")) {
      if (model.areThereEmptyCells(this.chkIncludeSubobjects.isSelected())) {
        Alert.message(
            containerFrame,
            "Missing entries",
            "You must provide titles for all entities in the table.");
        return;
      }

      searchDatabaseForMatches();

      if (!model.areThereMissingEntites(true)) {
        Alert.message(containerFrame, "Nothing to do", "There are no entities to create!");
        return;
      }

      Object[] options = {"Yes", "No", "Cancel"};
      int n =
          JOptionPane.showOptionDialog(
              this,
              "You are about to create basic database entities for all the red crosses in the table.\n"
                  + "Are you sure you want to continue?",
              "Confirmation",
              JOptionPane.YES_NO_CANCEL_OPTION,
              JOptionPane.QUESTION_MESSAGE,
              null,
              options,
              options[2]);

      if (n == JOptionPane.OK_OPTION) {
        model.generateMissingEntities(
            this.chkIncludeSubobjects.isSelected(), this.defaultEntitiesDialog);
      }

      return;
    }
  }