Object key = iter.next();
Slot slot = (Slot)slots.get(key);
if (slot.checkBox.isSelected()) {
String functionName = slot.functionMenu.getSelectedItem().toString();
if (slot.aggregate == null) {
NewAggregateCommand cmd =
new NewAggregateCommand(report, fieldWidget, (Group)key,
functionName);
cmd.perform();
commands.add(cmd);
slot.aggregate = cmd.getAggregateWidget();
}
else { // Already have one; change to selected func
EditAggregateFuncCommand cmd =
new EditAggregateFuncCommand(getAggregateField(slot.aggregate),
functionName);
cmd.perform();
commands.add(cmd);
getAggregateField(slot.aggregate).setFunction(functionName);
}
}
else { // We don't want an aggregate for this slot
if (slot.aggregate != null) {
String functionName =
getAggregateField(slot.aggregate).getFunction();
DeleteAggregateCommand cmd =
new DeleteAggregateCommand(report, fieldWidget,
slot.aggregate, functionName,
(Group)key);
cmd.perform();
commands.add(cmd);
slot.aggregate = null;
}
}
}