actionComponents.put(component.getComponent(), component);
component.getComponent().addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
ActionComponent source = (ActionComponent) actionComponents.get(e.getSource());
if (source == null) {
throw new BuildException("Received event from unknown source.");
}
if (source.getActionType() == ActionType.OK) {
// check required components
if (!task.requiredStatusOk()) {
return;
}
// notify components
task.ok();
// close form (unless background) and run target (if set and valid)
runTarget(source);
} else if (source.getActionType() == ActionType.CANCEL) {
// notify components
task.cancel();
// close form (unless background) and run target (if set and valid)
runTarget(source);
} else if (source.getActionType() == ActionType.RESET) {
// reset form properties
task.reset();
}
}