+ "criterion or operation instance.");
}
}
public boolean apply() {
GTIngredientList ingredientList = new GTIngredientList(_attribute);
Vector<?> dataVector = _tableModel.getDataVector();
for (Object rowData : dataVector) {
Vector<?> rowVector = (Vector<?>) rowData;
Row row = (Row) rowVector.get(1);
GTIngredient incredient = _createIngredientFromRow(row);
ingredientList.add(incredient);
}
try {
ingredientList.validate();
} catch (ValidationException e) {
String message = e.getMessage()
+ "\nPress Edit to return to modify the criterion or "
+ "operation, or press Revert to revert to its previous "
+ "value.";
String[] options = new String[] { "Edit", "Revert" };
int selected = JOptionPane.showOptionDialog(null, message,
"Validation Error", JOptionPane.OK_CANCEL_OPTION,
JOptionPane.ERROR_MESSAGE, null, options, options[1]);
if (selected == 1) {
resetTable(_initialIngredientList);
}
return false;
}
String moml = "<property name=\"" + _attribute.getName()
+ "\" value=\""
+ StringUtilities.escapeForXML(ingredientList.toString())
+ "\"/>";
MoMLChangeRequest request = new MoMLChangeRequest(this, _target, moml,
null);
request.setUndoable(true);
_attribute.requestChange(request);