public void setValueAt(Object aValue, int row, int col) {
   AbstractPartitionData partition = options.dataPartitions.get(row);
   switch (col) {
     case 0:
       String name = ((String) aValue).trim();
       if (options.hasPartitionData(name)) {
         JOptionPane.showMessageDialog(
             frame,
             "Duplicate partition name.",
             "Illegal Argument Exception",
             JOptionPane.ERROR_MESSAGE);
         return;
       }
       if (name.length() > 0) {
         options.renamePartition(partition, name);
       }
       break;
     case 5:
       //                    partition.setPloidyType((PloidyType) aValue);
       //                    break;
       //                case 6:
       if (((PartitionSubstitutionModel) aValue).getDataType().equals(partition.getDataType())) {
         partition.setPartitionSubstitutionModel((PartitionSubstitutionModel) aValue);
       }
       break;
     case 6:
       partition.setPartitionClockModel((PartitionClockModel) aValue);
       break;
     case 7:
       partition.setPartitionTreeModel((PartitionTreeModel) aValue);
       break;
   }
   fireDataChanged();
 }
  public void linkModels() {
    int[] selRows = dataTable.getSelectedRows();
    List<AbstractPartitionData> selectedPartitionData = new ArrayList<AbstractPartitionData>();
    DataType dateType = null;
    for (int row : selRows) {
      AbstractPartitionData partition = options.dataPartitions.get(row);
      if (dateType == null) {
        dateType = partition.getDataType();
      } else {
        if (partition.getDataType() != dateType) {
          JOptionPane.showMessageDialog(
              this,
              "Can only link the models for data partitions \n"
                  + "of the same data type (e.g., nucleotides)",
              "Unable to link models",
              JOptionPane.ERROR_MESSAGE);
          return;
        }
      }

      if (!selectedPartitionData.contains(partition)) selectedPartitionData.add(partition);
    }

    Object[] modelArray = options.getPartitionSubstitutionModels(selectedPartitionData).toArray();

    if (selectModelDialog == null) {
      selectModelDialog = new SelectModelDialog(frame);
    }

    int result = selectModelDialog.showDialog(modelArray);
    if (result != JOptionPane.CANCEL_OPTION) {
      PartitionSubstitutionModel model = selectModelDialog.getModel();
      if (selectModelDialog.getMakeCopy()) {
        model.setName(selectModelDialog.getName());
      }

      for (AbstractPartitionData partition : selectedPartitionData) {
        partition.setPartitionSubstitutionModel(model);
      }
    }

    if (options.getPartitionSubstitutionModels(Microsatellite.INSTANCE).size() <= 1) {
      options.shareMicroSat = true;
    }

    modelsChanged();

    fireDataChanged();
    repaint();
  }
  public void unlinkModels() {
    int[] selRows = dataTable.getSelectedRows();
    for (int row : selRows) {
      AbstractPartitionData partition = options.dataPartitions.get(row);

      PartitionSubstitutionModel model = partition.getPartitionSubstitutionModel();
      if (!model.getName().equals(partition.getName())) {
        PartitionSubstitutionModel newModel =
            new PartitionSubstitutionModel(options, partition.getName(), model);
        partition.setPartitionSubstitutionModel(newModel);
      }
    }

    modelsChanged();

    fireDataChanged();
    repaint();
  }