Search for handlers and eventlisteners
of all events of this component.
503483
function () {
			this.e.log&&this.e.log("Attaching default event's handlers...",'system');
			var events = this.getEvents();
			for (e in events)
			{
				var eventName = e.split('-').pop(),
					event = this.getEvent(eventName),
					evtConfig = event.getConfig();

				if (evtConfig.handler != null && this[evtConfig.handler] && typeof this[evtConfig.handler] == 'function')
				{
					event.addListener(this[evtConfig.handler]);
					event.setConfig({ handler: null });
				}

				if (evtConfig.listenEvent != null && e.indexOf('event-module') == -1 && this.hasEvent(evtConfig.listenEvent))
				{
					var listenTo = this.getEvent(evtConfig.listenEvent),
						listenName = evtConfig.listenEvent+'';
					listenTo.addListener(function (e) {
						if (typeof e == 'object'
							&& e.stopPropagation == true)
									return false;
						this.event.emit.apply(this.event,arguments);
					}.bind({ event: event }));
					event.setConfig({ listenEvent: null });
				}
			}
		}
372522
protected void initEventAdaptors()
    {
        if ( _clientDecl == null || _clientDecl.getMethods() == null )
            return;
        
        for (MethodDeclaration clientMethod : _clientDecl.getMethods())
        {
            //
            // Do a quick check for the presence of the EventHandler annotation on methods
            //
            if (clientMethod.getAnnotation(EventHandler.class) == null ||
                clientMethod.toString().equals("<clinit>()"))
                continue;

            //
            // EventHandler annotations on private methods cause compilation error.
            //
            if (isPrivateMethod(clientMethod))
            {
                _ap.printError( clientMethod, "eventhandler.method.is.private");
                continue;
            }

            //
            // If found, we must actually read the value using an AnnotationMirror, since it
            // contains a Class element (eventSet) that cannot be loaded
            //
            AnnotationMirror handlerMirror = null;
            for (AnnotationMirror annot : clientMethod.getAnnotationMirrors())
            {
                if ( annot == null ||
                    annot.getAnnotationType() == null ||
                    annot.getAnnotationType().getDeclaration() == null ||
                    annot.getAnnotationType().getDeclaration().getQualifiedName() == null )
                    return;

                if ( annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
                        "org.apache.beehive.controls.api.events.EventHandler"))
                {
                    handlerMirror = annot;
                    break;
                }
            }
            if (handlerMirror == null)
            {
                throw new CodeGenerationException("Unable to find EventHandler annotation on " +
                                                  clientMethod);
            }

            AptAnnotationHelper handlerAnnot = new AptAnnotationHelper(handlerMirror);

            //
            // Locate the EventField based upon the field element value
            //
            String fieldName = (String)handlerAnnot.getObjectValue("field");
            AptEventField eventField = (AptEventField)getField(fieldName);
            if (eventField == null)
            {
                // Deliberately not issuing a diagnostic if an event handler specifies
                // a field that isn't a control.  Other annotation processors also
                // handle event handlers, so delegate diagnostic responsibility to them.
                continue;
            }

            //
            // Locate the EventSet based upon the eventSet element value
            //
            Object tmo = handlerAnnot.getObjectValue("eventSet");
            if (!(tmo instanceof TypeMirror))
                continue;
            
            TypeMirror tm = (TypeMirror)tmo;
            String setName = tm.toString();

            AptControlInterface controlIntf = eventField.getControlInterface();
            AptEventSet eventSet = controlIntf.getEventSet(setName);

            // todo: remove workaround once bug has been resolved.
            /* Workaround JIRA issue BEEHIVE-1143, eventset name may
               contain a '$' seperator between the outer class and inner class.
               Should be a '.' seperator. Only applies to Eclipse APT. This
               workaround is also present in AptControlImplementation.initEventAdapters
             */
            if (tm.getClass().getName().startsWith("org.eclipse.")) {
                setName = setName.replace('$', '.');
            }
            // end of workaround

            if (eventSet == null)
            {
                _ap.printError( clientMethod, "eventhandler.eventset.not.found", setName );
                continue;
            }

            //
            // Register a new EventAdaptor for the EventSet, if none exists already
            //
            EventAdaptor adaptor = eventField.getEventAdaptor(eventSet);
            if (adaptor == null)
            {
                adaptor = new EventAdaptor(eventField, eventSet);
                eventField.addEventAdaptor(eventSet, adaptor);
            }

            //
            // Locate the EventSet method based upon the eventName element value.  Once
            // found, add a new AptEventHandler to the adaptor for this event.
            //
            boolean found = false;
            String eventName = (String)handlerAnnot.getObjectValue("eventName");
            AptMethod handlerMethod = new AptMethod(clientMethod, _ap);

            //
            // Will start at the currrent event set and look up through any ones it
            // extends to try and find a matching event
            //
            while (eventSet != null)
            {
                for (AptEvent controlEvent : eventSet.getEvents())
                {
                    if (controlEvent == null || 
                        controlEvent.getName() == null || 
                        !controlEvent.getName().equals(eventName))
                        continue;

                    if ( controlEvent.getArgTypes() == null )
                        continue;

                    //
                    // BUGBUG: If the arguments are parameterized, then the event handler
                    // might declare a specific bound version of the type, so a direct
                    // comparison will fail.  If parameterized, we don't validate.
                    //
                    if (controlEvent.hasParameterizedArguments() ||
                        (controlEvent.getArgTypes().equals(handlerMethod.getArgTypes()) &&
                         controlEvent.getReturnType().equals(handlerMethod.getReturnType())
                        )
                       )
                    {
                        HashSet<String> throwSet = new HashSet<String>(controlEvent.getThrowsList());
                        ArrayList<String> handlerThrows = handlerMethod.getThrowsList();
                        boolean throwsMatches = true;
                        for ( String t : handlerThrows )
                        {
                            if ( !throwSet.contains(t) )
                                throwsMatches = false;
                        }
                    
                        if ( !throwsMatches )
                        {
                            _ap.printError( clientMethod, "eventhandler.throws.mismatch", handlerMethod.getName() );
                        }

                        adaptor.addHandler(controlEvent, 
                                       new AptEventHandler(controlEvent, clientMethod, _ap ));
                        found = true;
                        break;
                    }
                }
                if (found)  // outer loop too
                    break;

                //
                // Look up on the super event set if not found at the current level
                //
                eventSet = eventSet.getSuperEventSet();
            }
            if (!found)
            {
                _ap.printError( clientMethod, "eventhandler.method.not.found", setName );
            }
        } 
    }
431026
public static void generateJSEventHandlers(ResponseWriter rw, UIComponent component) throws IOException {
		Map<String, Object> attributes = component.getAttributes();
		String[] eventHandlers = {"onclick", "onblur", "onmouseover"};
        for (String event:eventHandlers) {
        	String handler = A.asString(attributes.get(event));
        	if (null != handler) {
        		rw.writeAttribute(event, handler, event);
        	}
        }
	}
952613
function getHandlers (name, callback, context) {
    var events = [];
    if (!callback && !context) {
        if (name) {
            return (this._events && this._events[name]) || [];
        } else {
            return this._events;
        }
    }
    _.each(this._events, function (value, key) {
        if (!name || key === name) {
            value.forEach(function (event) {
                if ((!callback || event.callback === callback) && (!context || event.context === context)) {
                    events.push(event);
                }
            });
        }
    });
    return events;
}
139282
def check_events(self):
        ''''''
        while self.event_count() > 0:
            event = self.get_event()
            for callback in self._callbacks:
                callback(event)
11970
private static Map<Method, EventType> findMethods(Class<?> type) {
    Map<Method, EventType> events = new HashMap<>();
    for (Method method : type.getDeclaredMethods()) {
      Event event = method.getAnnotation(Event.class);
      if (event != null) {
        String name = event.value().equals("") ? method.getName() : event.value();
        events.put(method, EventType.from(name));
      }
    }
    for (Class<?> iface : type.getInterfaces()) {
      events.putAll(findMethods(iface));
    }
    return events;
  }
902753
@SuppressWarnings("unchecked")
	public <T extends EventListener> T[] getListeners(Class<T> type) {
		final Object[] iListeners = this.listeners;
		final int listenerCount = getListenerCount(iListeners, type);
		final T[] result = (T[]) Array.newInstance(type, listenerCount);
		int j = 0;
		for (int i = iListeners.length - 2; i >= 0; i -= 2) {
			if (iListeners[i] == type) {
				result[j++] = type.cast(iListeners[i + 1]);
			}
		}
		return result;
	}
22030
private List<String> processAllListeners(View rootView) {
        List<String> refinementAttributes = new ArrayList<>();

        // Register any AlgoliaResultsListener (unless it has a different variant than searcher)
        final List<AlgoliaResultsListener> resultListeners = LayoutViews.findByClass((ViewGroup) rootView, AlgoliaResultsListener.class);
        if (resultListeners.isEmpty()) {
            throw new IllegalStateException(Errors.LAYOUT_MISSING_RESULT_LISTENER);
        }
        for (AlgoliaResultsListener listener : resultListeners) {
            if (!this.resultListeners.contains(listener)) {
                final String variant = BindingHelper.getVariantForView((View) listener);
                if (variant == null || searcher.variant.equals(variant)) {
                    this.resultListeners.add(listener);
                    searcher.registerResultListener(listener);
                    prepareWidget(listener, refinementAttributes);
                }
            }
        }

        // Register any AlgoliaErrorListener (unless it has a different variant than searcher)
        final List<AlgoliaErrorListener> errorListeners = LayoutViews.findByClass((ViewGroup) rootView, AlgoliaErrorListener.class);
        for (AlgoliaErrorListener listener : errorListeners) {
            if (!this.errorListeners.contains(listener)) {
                final String variant = BindingHelper.getVariantForView((View) listener);
                if (variant == null || searcher.variant.equals(variant)) {
                    this.errorListeners.add(listener);
                }
            }
            searcher.registerErrorListener(listener);
            prepareWidget(listener, refinementAttributes);
        }

        // Register any AlgoliaSearcherListener (unless it has a different variant than searcher)
        final List<AlgoliaSearcherListener> searcherListeners = LayoutViews.findByClass((ViewGroup) rootView, AlgoliaSearcherListener.class);
        for (AlgoliaSearcherListener listener : searcherListeners) {
            final String variant = BindingHelper.getVariantForView((View) listener);
            if (variant == null || searcher.variant.equals(variant)) {
                listener.initWithSearcher(searcher);
                prepareWidget(listener, refinementAttributes);
            }
        }

        return refinementAttributes;
    }
521140
function hasCompleteEventParams(eventType, listener) {
        var hasParams = eventType && listener,
            isTypeString = typeof eventType === 'string',
            isTypeFunction = typeof listener === 'function';

        if (!isTypeFunction) {
            throw new TypeError(EventDispatcher.TYPE_ERROR);
        }

        return hasParams && isTypeString && isTypeFunction;
    }
810445
private <E extends Event> EventListener<E> getEventListener(E event) {
        @SuppressWarnings("unchecked")
        EventListener<E> eventListener = (EventListener<E>) eventListenerMap.get(event.getClass());
        return eventListener;
    }
336303
function(component, eventNames) {
          eventNames = eventNames.trim().split(/\s+/);

          for (var i = 0, l = eventNames.length; i < l; i++) {
            var eventName = eventNames[i];
            this._registerEventHandler(component, eventName);
          }
        }
1140432
function filterListeners (listenerCollection) {
        return function(filters) {
            var handlers = [];

            _.each(listenerCollection, function(listener){
                handlers = handlers.concat( findMatch(filters, listener) );
            });

            return handlers;
        };
    }
146901
def getEvents(self):
        
        caught_events = self._observer.caught_events
        self._observer.caught_events = []
        for event in caught_events:
            self._observer.activate_event(event["name"])
        return caught_events
449360
function (eventType, evt) {
    if (!this.eventListeners) {
      this.eventListeners = {};
    }
    if (!evt) {
      evt = {};
    }
    evt.type = eventType;
    if (!evt.source) {
      evt.source = this;
    }
    var events = this.eventListeners[eventType];
    if (events) {
      var len = events.length;
      for (var i = 0; i < len; i++) {
        events[i].handler.apply(this, [evt]);
      }
    }
    return this;
  }
1012693
private void findListeners(BaseComponent cmpt) {
        for (BaseComponent child : cmpt.getChildren()) {
            tryRegisterListener(child, true);
            tryRegisterListener(FrameworkController.getController(child), true);
            findListeners(child);
        }
    }
1023238
function getListeners(obj, eventName) {
    var listenerDesc = Object.getOwnPropertyDescriptor(obj, '__jahEventListeners__')
    if (!listenerDesc) {
        Object.defineProperty(obj, '__jahEventListeners__', {
            value: {}
        })
    }
    if (!eventName) {
        return obj.__jahEventListeners__;
    }
    if (!obj.__jahEventListeners__[eventName]) {
        obj.__jahEventListeners__[eventName] = {};
    }
    return obj.__jahEventListeners__[eventName];
}
1260764
def list_listeners(self, retrieve_all=True, **_params):
        """"""
        return self.list('listeners', self.lbaas_listeners_path,
                         retrieve_all, **_params)