String[] compIds = (String[]) keySet.toArray(new String[keySet.size()]);
for (int i=0; i < compIds.length; i++)
{
String compId = compIds[i];
ComponentEventProperty property = (ComponentEventProperty) events.get(compId);
// find the targeted component
IComponent comp = findComponent(compId, component.getPage());
if (comp == null)
continue;
if (Component.class.isInstance(comp))
((Component)comp).setHasEvents(true);
// wire up with idPath
String idPath = comp.getExtendedId();
component.getSpecification().rewireComponentId(compId, idPath);
_invoker.addEventListener(idPath, component.getSpecification());
wireFormEvents(comp, component.getSpecification());
}
// find form element targets for re-mapping with proper idpath && IEventInvoker connection
events = component.getSpecification().getElementEvents();
Iterator it = events.keySet().iterator();
// for efficiency later in ComponentEventConnectionWorker
if (events.size() > 0 && Component.class.isInstance(component)) {
((Component)component).setHasEvents(true);
}
while (it.hasNext())
{
String elementId = (String) it.next();
ComponentEventProperty property = (ComponentEventProperty) events.get(elementId);
Iterator bindingIt = property.getFormEvents().iterator();
while (bindingIt.hasNext())
{
String key = (String) bindingIt.next();
List listeners = property.getFormEventListeners(key);
for (int i=0; i < listeners.size(); i++) {
EventBoundListener listener = (EventBoundListener) listeners.get(i);
wireElementFormEvents(listener, component, component.getSpecification());