Ejemplo n.º 1
0
  public void linkClocks() { // keep previous PartitionTreePrior for reuse
    int[] selRows = dataTable.getSelectedRows();

    List<AbstractPartitionData> selectedPartitionData = new ArrayList<AbstractPartitionData>();
    for (int row : selRows) {
      AbstractPartitionData partition = options.dataPartitions.get(row);

      if (!selectedPartitionData.contains(partition)) selectedPartitionData.add(partition);
    }
    Object[] modelArray = options.getPartitionClockModels(selectedPartitionData).toArray();

    if (selectClockDialog == null) {
      selectClockDialog = new SelectClockDialog(frame);
    }

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

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

    modelsChanged();

    fireDataChanged();
    repaint();
  }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 3
0
  public void unlinkClocks() { // reuse previous PartitionTreePrior
    int[] selRows = dataTable.getSelectedRows();
    for (int row : selRows) {
      AbstractPartitionData partition = options.dataPartitions.get(row);

      PartitionClockModel model = partition.getPartitionClockModel();
      if (!model.getName().equals(partition.getName())) {
        PartitionClockModel newModel = new PartitionClockModel(options, partition.getName(), model);
        partition.setPartitionClockModel(newModel);
        newModel.setClockModelGroup(model.getClockModelGroup()); // set clock model group
      }
    }

    modelsChanged();

    fireDataChanged();
    repaint();
  }