//Validate the "occurence" input
for (int i=0; i< rNumbers.size(); i++) {
int r = rNumbers.get(i);
JPanel rgrpPanel = panels.get(i);
RGroupList rgrpList = rgroupQuery.getRGroupDefinitions().get(r);
JTextField occurrenceField = (JTextField) (rgrpPanel.getComponent(1));
String userOccurrenceText=occurrenceField.getText();
if (userOccurrenceText.trim().equals("") || !RGroupList.isValidOccurrenceSyntax(userOccurrenceText)) {
throw new RuntimeException (GT.get("Invalid occurrence specified for {0}", "R" + r));
}
}
//Aply input to model
for (int i=0; i< rNumbers.size(); i++) {
int r = rNumbers.get(i);
JPanel rgrpPanel = panels.get(i);
RGroupList rgrpList = rgroupQuery.getRGroupDefinitions().get(r);
JTextField occurrenceField = (JTextField) (rgrpPanel.getComponent(1));
String userOccurrenceText=occurrenceField.getText();
try {
rgrpList.setOccurrence(userOccurrenceText);
} catch (CDKException e) {
// won't happen - already checked in previous loop
e.printStackTrace();
}
JComboBox restHBox = (JComboBox) (rgrpPanel.getComponent(3));
String restHString= (String) (restHBox.getSelectedItem());
if (restHString.equals(GT.get("True")))
rgrpList.setRestH(true);
else
rgrpList.setRestH(false);
JComboBox ifThenBox = (JComboBox) (rgrpPanel.getComponent(5));
String ifThenR= (String) (ifThenBox.getSelectedItem());
if (ifThenR.equals(GT.get("None")))
rgrpList.setRequiredRGroupNumber(0);
else {
int userRnumInput = new Integer (ifThenR.substring(1));
rgrpList.setRequiredRGroupNumber(userRnumInput);
}
}
}