AbstractComponent commonSelectedEvaluator = null;
boolean commonEvaluator = true;
boolean mixedEvaluatorSet = false;
boolean firstCell = true;
ComponentTableModel tableModel = ComponentTableModel.class.cast(model);
// Enumeration control is always showing, so add None as option
EnumerationItem none = new EnumerationItem(null);
enumerationModel.addElement(none);
enumerationModel.setSelectedItem(none);
AbstractComponent component = (AbstractComponent) model.getStoredValueAt(table.getSelectedRows()[0], table.getSelectedColumns()[0]);
AbstractComponent referencedComponent = component;
// Add the component itself, if it can be a self-evaluator.
if (referencedComponent.getCapability(Evaluator.class) != null &&
!referencedComponent.getCapability(Evaluator.class).requiresMultipleInputs()) {
EnumerationItem item = new EnumerationItem(referencedComponent);
enumerationModel.addElement(item);
}
for (AbstractComponent parent : referencedComponent.getReferencingComponents()) {
// For now, we only find evaluators that have exactly one child (the current component).
Evaluator e = parent.getCapability(Evaluator.class);
if (e != null && !e.requiresMultipleInputs()) {
// Found an enumeration for the component.
commonEnums.add(new EnumerationItem(parent));
}
}
for (int row : table.getSelectedRows()) {
for (int column : table.getSelectedColumns()) {
component = (AbstractComponent) model.getStoredValueAt(row, column);
if (component == null) {
mixedEvaluatorSet = true;
continue;
}
referencedComponent = component;
TableCellSettings cellSettings = tableModel.getCellSettings(tableModel.getKey(referencedComponent));
AbstractComponent evaluator = cellSettings.getEvaluator();
if (commonSelectedEvaluator != null)
if (evaluator != null) {
if (!evaluator.getId().equals(commonSelectedEvaluator.getId())) {
mixedEvaluatorSet = true;