Пример #1
0
    public boolean isCellEditable(int row, int col) {
      boolean editable;

      AbstractPartitionData partition = options.dataPartitions.get(row);

      switch (col) {
        case 0: // name
          editable = true;
          break;
          //                case 5:// ploidy type selection menu
          //                    editable = true;
          //                    break;
        case 5: // substitution model selection menu
          editable = partition.getDataType().getType() != DataType.CONTINUOUS;
          break;
        case 6: // clock model selection menu
          editable = partition.getDataType().getType() != DataType.CONTINUOUS;
          break;
        case 7: // tree selection menu
          editable = true;
          break;
        default:
          editable = false;
      }

      return editable;
    }
Пример #2
0
  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();
  }
Пример #3
0
 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();
 }