Example #1
0
 public Object getValueAt(int row, int col) {
   //            PartitionData partition = options.getPartitionDataNoSpecies().get(row);
   PartitionData partition = options.getNonTraitsDataList().get(row);
   switch (col) {
     case 0:
       return partition.getName();
     case 1:
       return partition.getFileName();
     case 2:
       return "" + partition.getTaxaCount();
     case 3:
       return "" + partition.getSiteCount(); // sequence length
     case 4:
       return partition.getDataType();
     case 5:
       //                    return partition.getPloidyType();
       //                case 6:
       return partition.getPartitionSubstitutionModel().getName();
     case 6:
       return partition.getPartitionClockModel().getName();
     case 7:
       return partition.getPartitionTreeModel().getName();
     default:
       throw new IllegalArgumentException("unknown column, " + col);
   }
 }
Example #2
0
  public void linkModels() {
    int[] selRows = dataTable.getSelectedRows();
    List<PartitionData> selectedPartitionData = new ArrayList<PartitionData>();
    DataType dateType = null;
    for (int row : selRows) {
      PartitionData partition = options.dataPartitions.get(row);
      if (dateType == null) {
        dateType = partition.getPartitionSubstitutionModel().getDataType();
      } else {
        if (partition.getPartitionSubstitutionModel().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);
        }
      }

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

    Object[] modelArray =
        options.getPartitionSubstitutionModels(dateType, 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 (PartitionData partition : selectedPartitionData) {
        partition.setPartitionSubstitutionModel(model);
      }
    }

    modelsChanged();

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

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

    modelsChanged();

    fireDataChanged();
    repaint();
  }