/*
(non-Javadoc)
@see com.ibm.ws.webcontainer.osgi.webapp.WebApp#createListener(java.lang.Class)
358634
@Override
    public <T extends EventListener> T  createListener(Class<T> classToCreate) throws ServletException {        
        boolean valid = false;
        
        T listener = super.createListener(classToCreate);
        
        for (Class c : validListenerClasses) {
            if (c != null && c.isAssignableFrom(classToCreate)) {
                valid = true;
            }
        }
        
        if (!valid) {
            throw new IllegalArgumentException(nls.getString("exception.occurred.while.creating.listener.instance"));
        }
        
        return listener;
    }
590516
@Override
  public void initializeListener(QueryBatcher queryBatcher) {
    HostAvailabilityListener hostAvailabilityListener = HostAvailabilityListener.getInstance(queryBatcher);
    if ( hostAvailabilityListener != null ) {
      BatchFailureListener<QueryBatch> retryListener = hostAvailabilityListener.initializeRetryListener(this);
      if ( retryListener != null )  onFailure(retryListener);
    }
    NoResponseListener noResponseListener = NoResponseListener.getInstance(queryBatcher);
    if ( noResponseListener != null ) {
      BatchFailureListener<QueryBatch> noResponseRetryListener = noResponseListener.initializeRetryListener(this);
      if ( noResponseRetryListener != null )  onFailure(noResponseRetryListener);
    }
  }
871055
public synchronized void addEventListener(EventListener listener)
        throws IllegalArgumentException
    {
        if ((listener instanceof HttpSessionActivationListener)
            || (listener instanceof HttpSessionAttributeListener)
            || (listener instanceof HttpSessionBindingListener)
            || (listener instanceof HttpSessionListener))
        {
            if (_sessionManager != null)
                _sessionManager.addEventListener(listener);
            _sessionListeners= LazyList.add(_sessionListeners, listener);
        }

        if (listener instanceof ServletRequestListener)
        {
            _requestListeners= LazyList.add(_requestListeners, listener);
        }

        if (listener instanceof ServletRequestAttributeListener)
        {
             _requestAttributeListeners= LazyList.add(_requestAttributeListeners, listener);
        }

        if (listener instanceof ServletContextAttributeListener)
        {            
            _contextAttributeListeners= LazyList.add(_contextAttributeListeners, listener);
        }
        
        super.addEventListener(listener);
    }
540063
private void createSingleListener(final SibRaMessagingEngineConnection connection) throws ResourceException
    {
        final String methodName = "createSingleListener";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, connection);
        }

        final SIDestinationAddress destination = _endpointConfiguration.getDestination();

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
        {
            SibTr.debug(TRACE, "Creating a consumer to consume from destination "
                               + destination + " on ME " + connection.getConnection().getMeName());
        }

        try
        {
            connection.createListener(destination, _messageEndpointFactory);
            SibTr.info(TRACE, "CONNECTED_CWSIV0777", new Object[] {
                                                                   connection.getConnection().getMeName(),
                                                                   _endpointConfiguration.getDestination()
                                                                                   .getDestinationName(),
                                                                   _endpointConfiguration.getBusName() });
        } catch (final IllegalStateException exception)
        {
            // No FFDC code needed
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
            {
                SibTr.debug(TRACE, "Failed to create a session - blowing away the connection - rethrow the exception");
            }

            _connections.remove(connection.getConnection().getMeUuid());
            connection.close();
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
            {
                SibTr.exit(this, TRACE, methodName);
            }
            throw exception;
        } catch (final ResourceException exception)
        {
            // No FFDC code needed

            // Failed to create a consumer so blow away the connection and try
            // again
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
            {
                SibTr.debug(TRACE, "Failed to create a session - blowing away the connection - a retry should occur");
                SibTr.debug(TRACE, "Exception cause was " + exception.getCause());
            }

            _connections.remove(connection.getConnection().getMeUuid());
            connection.close();
            throw exception;
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }
    }
809662
public synchronized void addStateListener(@Nonnull EndpointStateListener<VALUE_TYPE, ARG_TYPE> listener) throws IllegalArgumentException {
        checkListenerNonNull(listener);
        fieldStateListeners.add(listener);
        if (informStateListenerOnAdd) {
            informStateListener(getStateAndValue(), listener);
        }
    }
366386
public HyperlinkListener createHyperLinkListener()
    {
        return new HyperlinkListener()
        {
            public void hyperlinkUpdate(HyperlinkEvent e)
            {
                if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
                {
                    if (e instanceof HTMLFrameHyperlinkEvent)
                    {
                        ((HTMLDocument)getDocument()).processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)e);
                    } else {
                        URL url = e.getURL();
                        
                        if (getCallingApplet() != null)
                        	if (getHelpPane() != null)
                        {
                        	String strQuery = url.getQuery();
                        	if ((strQuery != null) && (strQuery.length() > 0) && (strQuery.indexOf(Params.HELP + "=") == -1))
                        	{	// This is a command, not a new help screen
                        		if (BaseApplet.handleAction("?" + strQuery, getCallingApplet(), null, 0))	// Try to have my calling screen handle it
                        			url = null;	// Handled
                        	}
                        }
                        if (url != null)
                        	linkActivated(url, m_applet, 0);
                    }
                }
            }
        };
    }
909605
public final void addListener(
            @NonNull final Listener<DataType, KeyType, ViewType, ParamType> listener) {
        listeners.add(listener);
    }
836987
@Nullable
    public <P> P getListener(Class<P> type) {
        if (mListener != null) {
            return type.cast(mListener);
        }
        return null;
    }
930881
function installEventListener(selector, type, listener)
{
  // Creates the element empty
  var element;

  // Selects, gets & stores the first DOM object matching to the selector
  element = document.querySelector(selector);

  // Installs an Event Listener on this DOM object
  element.addEventListener(type, listener);
}
1089633
function addListener(element, listener) {
        var id = idHandler.get(element);

        if(!eventListeners[id]) {
            eventListeners[id] = [];
        }

        eventListeners[id].push(listener);
    }
1260942
@NonNull
    private View.OnClickListener createNextButtonListener() {
        return new View.OnClickListener() {

            @Override
            public void onClick(final View v) {
                if (navigationFragment != null) {
                    int currentIndex = navigationFragment.getSelectedNavigationPreferenceIndex();

                    if (currentIndex < navigationFragment.getNavigationPreferenceCount() - 1) {
                        Bundle params = notifyOnNextStep();

                        if (params != null) {
                            navigationFragment.selectNavigationPreference(currentIndex + 1, params);
                        }
                    }
                }
            }

        };
    }
838166
public Listener<Listeners<T>> getOrCreateListener()
   {
      List<Node> nodeList = childNode.get("listener");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ListenerImpl<Listeners<T>>(this, "listener", childNode, nodeList.get(0));
      }
      return createListener();
   }
601356
@Override
    public void addConnectionEventListener( ConnectionEventListener listener ) {
        if (listener == null) {
            throw new IllegalArgumentException("Listener is null");
        }
        listeners.add(listener);
    }
279242
private OnClickListener createPreferenceButtonListener() {
        return new OnClickListener() {

            @Override
            public void onClick(final View v) {
                Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
                startActivity(intent);
            }

        };
    }
776885
func createListener() (eventListener, error) {
	listener := &kqueueListener{}
	kq, err := syscall.Kqueue()
	listener.kq = kq
	return listener, err
}
1140460
@NonNull
    private View.OnClickListener createBackButtonListener() {
        return new View.OnClickListener() {

            @Override
            public void onClick(final View v) {
                if (navigationFragment != null) {
                    int currentIndex = navigationFragment.getSelectedNavigationPreferenceIndex();

                    if (currentIndex > 0) {
                        Bundle params = notifyOnPreviousStep();

                        if (params != null) {
                            navigationFragment.selectNavigationPreference(currentIndex - 1, params);
                        }
                    }
                }
            }

        };
    }
1322123
public final void setListener( @Nullable final WebSocketListener listener )
  {
    _listener = null == listener ? NullWebSocketListener.LISTENER : listener;
  }