boolean modified = false; int n = ULThreads.length; for (int i = 0; i < n; i++) { JCheckBox cb = (JCheckBox)ULThreadCheckBoxes.get(i); Boolean b = (Boolean)originalThreadSelected.get(i); if (b.booleanValue() == cb.isSelected()) continue; if (!modified) { if (!cloneExperiment()) return; modified = true; } ExperimentDB.setULThreadSelected(trialId, ULDBThreads[i], cb.isSelected()); } n = groupCheckBoxes.size(); for (int i = 0; i < n; i++) { String groupName = groupNames[i]; JCheckBox cb = (JCheckBox)groupCheckBoxes.get(i); Boolean b = (Boolean)originalGroupSelected.get(i); if (b.booleanValue() != cb.isSelected()) { if (!modified) { if (!cloneExperiment()) return; modified = true; } ExperimentDB.setGroupSelected(trialId, groupName, cb.isSelected()); } JTextField multiplierField = (JTextField)multiplierFields.get(i); int multiplier = ((Integer)originalGroupMultiplier.get(i)).intValue(); try { int newMultiplier = Integer.parseInt(multiplierField.getText()); if (multiplier == newMultiplier) continue; if (!modified) { if (!cloneExperiment()) return; modified = true; } ExperimentDB.setMultiplier(trialId, groupName, newMultiplier); } catch (NumberFormatException e) { } } if (modified) { ExperimentDB.updateCMTAssembly(experimentId); trialId = ExperimentDB.getTrialId(experimentId); }
  private void ok_actionPerformed() {    setVisible(false);    boolean modified = false;    int n = ULThreads.length;    for (int i = 0; i < n; i++) {      JCheckBox cb = (JCheckBox)ULThreadCheckBoxes.get(i);      Boolean b = (Boolean)originalThreadSelected.get(i);      if (b.booleanValue() == cb.isSelected())        continue;      if (!modified) {        if (!cloneExperiment())          return; // user cancelled modifications        modified = true;      }      ExperimentDB.setULThreadSelected(trialId, ULDBThreads[i],                                        cb.isSelected());    }    n = groupCheckBoxes.size();    for (int i = 0; i < n; i++) {      String groupName = groupNames[i];      JCheckBox cb = (JCheckBox)groupCheckBoxes.get(i);      Boolean b = (Boolean)originalGroupSelected.get(i);      if (b.booleanValue() != cb.isSelected()) {        if (!modified) {          if (!cloneExperiment())            return; // user cancelled modifications          modified = true;        }        ExperimentDB.setGroupSelected(trialId, groupName, cb.isSelected());      }      JTextField multiplierField = (JTextField)multiplierFields.get(i);      int multiplier = ((Integer)originalGroupMultiplier.get(i)).intValue();      try {        int newMultiplier = Integer.parseInt(multiplierField.getText());        if (multiplier == newMultiplier)          continue;        if (!modified) {          if (!cloneExperiment())            return; // user cancelled modifications          modified = true;        }        ExperimentDB.setMultiplier(trialId, groupName, newMultiplier);      } catch (NumberFormatException e) {      }    }    if (modified) {      ExperimentDB.updateCMTAssembly(experimentId);      trialId = ExperimentDB.getTrialId(experimentId);    }  }