if (!handlers.isEmpty()) {
boolean consume = false;
ArrayList<KeyConfigurationResult> results;
results = new ArrayList<KeyConfigurationResult>();
for (Map.Entry<Component, KeyConfigurator> entry : handlers.entrySet()) {
Component comp = entry.getKey();
KeyConfigurator handler = entry.getValue();
KeyConfigurationEvent event = new KeyConfigurationEvent(type,
comp.getAttributeSet(), e, comp);
KeyConfigurationResult result = handler.keyEventReceived(event);
consume |= event.isConsumed();
if (result != null) {
results.add(result);
}
}
if (consume) {
e.consume();
}
if (!results.isEmpty()) {
SetAttributeAction act = new SetAttributeAction(canvas.getCircuit(),
Strings.getter("changeComponentAttributesAction"));
for (KeyConfigurationResult result : results) {
Component comp = (Component) result.getEvent().getData();
Map<Attribute<?>,Object> newValues = result.getAttributeValues();
for (Map.Entry<Attribute<?>,Object> entry : newValues.entrySet()) {
act.set(comp, entry.getKey(), entry.getValue());
}
}