Exemple #1
0
  public void removeSelection() {
    int[] selRows = dataTable.getSelectedRows();
    Set<PartitionData> partitionsToRemove = new HashSet<PartitionData>();
    for (int row : selRows) {
      partitionsToRemove.add(options.dataPartitions.get(row));
    }

    // TODO: would probably be a good idea to check if the user wants to remove the last partition
    options.dataPartitions.removeAll(partitionsToRemove);

    //        if (options.allowDifferentTaxa && options.dataPartitions.size() < 2) {
    //            uncheckAllowDifferentTaxa();
    //        }

    if (options.getNonTraitsDataList().size() == 0) {
      // all data partitions removed so reset the taxa
      options.reset();
      useStarBEASTCheck.setSelected(false);
      frame.statusLabel.setText("");
      frame.setAllOptions();
      frame.getExportAction().setEnabled(false);
    }

    dataTableModel.fireTableDataChanged();

    fireDataChanged();
  }
  public void removeSelection() {
    int[] selRows = dataTable.getSelectedRows();
    Set<AbstractPartitionData> partitionsToRemove = new HashSet<AbstractPartitionData>();
    for (int row : selRows) {
      partitionsToRemove.add(options.dataPartitions.get(row));
    }

    boolean hasIdenticalTaxa =
        options.hasIdenticalTaxa(); // need to check this before removing partitions

    // TODO: would probably be a good idea to check if the user wants to remove the last partition
    options.dataPartitions.removeAll(partitionsToRemove);

    if (options.dataPartitions.size() == 0) {
      // all data partitions removed so reset the taxa
      options.reset();
      useStarBEASTCheck.setSelected(false);
      frame.setupStarBEAST(false);
      frame.statusLabel.setText("");
      frame.setAllOptions();
      frame.getExportAction().setEnabled(false);
    } else if (!hasIdenticalTaxa) {
      options.updateTaxonList();
    }

    dataTableModel.fireTableDataChanged();

    fireDataChanged();
  }
Exemple #3
0
  public void setOptions(BeautiOptions options) {

    this.options = options;

    modelsChanged();

    useStarBEASTCheck.setEnabled(
        options.getNonTraitsDataList().size() > 0); // single partition is allowed
    createImportTraitButton.setEnabled(options.getNonTraitsDataList().size() > 0);

    dataTableModel.fireTableDataChanged();
  }
  public void setOptions(BeautiOptions options) {

    this.options = options;

    modelsChanged();

    boolean taxaAvailable = options.taxonList != null && options.taxonList.getTaxonCount() > 0;
    boolean traitAvailable =
        options.traits != null && options.traits.size() > 0 && (!options.useStarBEAST);

    useStarBEASTCheck.setEnabled(taxaAvailable);
    createTraitPartitionAction.setEnabled(traitAvailable);

    dataTableModel.fireTableDataChanged();
  }
  public boolean createFromTraits(List<TraitData> traits) {
    int selRow = -1;

    if (selectTraitDialog == null) {
      selectTraitDialog = new SelectTraitDialog(frame);
    }

    if (traits == null || traits.size() == 0) {
      int result = selectTraitDialog.showDialog(options.traits, null);
      if (result != JOptionPane.CANCEL_OPTION) {
        TraitData trait = selectTraitDialog.getTrait();
        String name = trait.getName();
        if (selectTraitDialog.getMakeCopy()) {
          name = selectTraitDialog.getName();
        }

        selRow = options.createPartitionForTraits(name, trait);
      } else {
        return false;
      }
    } else {
      if (traits.size() > 1) {
        // a set of traits have been passed to the function
        int result = selectTraitDialog.showDialog(null, null);
        if (result != JOptionPane.CANCEL_OPTION) {
          String name = selectTraitDialog.getName();
          selRow = options.createPartitionForTraits(name, traits);
        } else {
          return false;
        }
      } else {
        selRow = options.createPartitionForTraits(traits.get(0).getName(), traits);
      }
    }

    modelsChanged();
    dataTableModel.fireTableDataChanged();

    if (selRow != -1) {
      dataTable.getSelectionModel().setSelectionInterval(selRow, selRow);
    }
    fireDataChanged();
    repaint();

    return true;
  }
Exemple #6
0
 public void createFromTraits() {
   frame.createImportTraits();
   dataTableModel.fireTableDataChanged();
 }