public void setValueAt(Object aValue, int row, int col) { // PartitionData partition = options.getPartitionDataNoSpecies().get(row); PartitionData partition = options.getNonTraitsDataList().get(row); switch (col) { case 0: String name = ((String) aValue).trim(); if (name.length() > 0) { partition.setName(name); } break; case 5: // partition.setPloidyType((PloidyType) aValue); // break; // case 6: 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<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(); }
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(); }