Package java.util

Examples of java.util.EventListener


    public void setListenerClassNames(Collection eventListeners) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        if (eventListeners != null) {
            for (Iterator iterator = eventListeners.iterator(); iterator.hasNext();) {
                String listenerClassName = (String) iterator.next();
                Class clazz = loadClass(listenerClassName);
                EventListener listener = (EventListener) clazz.newInstance();
                addEventListener(listener);
                handler.addEventListener(listener);
            }
        }
    }
View Full Code Here


            return b;
        }
        if (oldl == b) {
            return a;
        }
        EventListener a2 = removeInternal(a, oldl);
        EventListener b2 = removeInternal(b, oldl);
        if (a2 == a && b2 == b) {
            return this;    // it's not here
        }
        return addInternal(a2, b2);
    }
View Full Code Here

            for (Entry<BundleContext, List<ListenerInfo>> entry : listeners.entrySet())
            {
                for (ListenerInfo info : entry.getValue())
                {
                    Bundle bundle = info.getBundle();
                    EventListener l = info.getListener();
                    Filter filter = info.getParsedFilter();
                    Object acc = info.getSecurityContext();

                    try
                    {
View Full Code Here

           
        super.setEventListeners(eventListeners);
     
        for (int i=0; eventListeners!=null && i<eventListeners.length;i ++)
        {
            EventListener listener = eventListeners[i];
           
            if ((listener instanceof HttpSessionActivationListener)
                            || (listener instanceof HttpSessionAttributeListener)
                            || (listener instanceof HttpSessionBindingListener)
                            || (listener instanceof HttpSessionListener))
View Full Code Here

    {
        if (oldListener == a)
            return b;
        else if (oldListener == b)
            return a;
        EventListener a2 = removeInternal(a, oldListener);
        EventListener b2 = removeInternal(b, oldListener);
        if (a2 == a && b2 == b)
            return this;
        else
            return addInternal(a2, b2);
    }
View Full Code Here

        this.singleEventListenerRegistry.addWhite(0, source.size());

        // add listeners to all source list elements
        for (int i = 0, n = size(); i < n; i++) {
            // connect a listener to the element
            final EventListener listener = this.connectElement(get(i));

            // record the listener in the registry
            this.registerListener(i, listener, false);
        }
View Full Code Here

            if (changeType == ListEvent.INSERT) {
                final E inserted = get(changeIndex);
                this.observedElements.add(changeIndex, inserted);

                // connect a listener to the freshly inserted element
                final EventListener listener = this.connectElement(inserted);
                // record the listener in the registry
                this.registerListener(changeIndex, listener, false);

            // unregister a listener on the deleted object
            } else if (changeType == ListEvent.DELETE) {
                // try to get the previous value through the ListEvent
                E deleted = listChanges.getOldValue();
                E deletedElementFromPrivateCopy = this.observedElements.remove(changeIndex);

                // if the ListEvent could give us the previous value, use the value from our private copy of the source
                if (deleted == ListEvent.UNKNOWN_VALUE)
                    deleted = deletedElementFromPrivateCopy;

                // remove the listener from the registry
                final EventListener listener = this.unregisterListener(changeIndex);
                // disconnect the listener from the freshly deleted element
                this.disconnectElement(deleted, listener);

            // register/unregister listeners if the value at the changeIndex is now a different object
            } else if (changeType == ListEvent.UPDATE) {
                E previousValue = listChanges.getOldValue();

                // if the ListEvent could give us the previous value, use the value from our private copy of the source
                if (previousValue == ListEvent.UNKNOWN_VALUE)
                    previousValue = this.observedElements.get(changeIndex);

                final E newValue = get(changeIndex);

                // if a different object is present at the index
                if (newValue != previousValue) {
                    this.observedElements.set(changeIndex, newValue);

                    // disconnect the listener from the previous element at the index
                    this.disconnectElement(previousValue, this.getListener(changeIndex));
                    // connect the listener to the new element at the index
                    final EventListener listener = this.connectElement(newValue);
                    // replace the old listener in the registry with the new listener for the new element
                    this.registerListener(changeIndex, listener, true);
                }
            }
        }
View Full Code Here

     *
     * @param index the location of the {@link EventListener} to be returned
     * @return the {@link EventListener} at the given <code>index</code>
     */
    private EventListener getListener(int index) {
        EventListener listener = null;

        if (this.singleListenerMode) {
            if (this.singleEventListenerRegistry.get(index) == Barcode.BLACK)
                listener = this.singleEventListener;
        } else {
View Full Code Here

     * @param index the index of the {@link EventListener} to be unregistered
     * @return the EventListener that was unregistered or <code>null</code> if
     *      no EventListener existed at the given <code>index</code>
     */
    private EventListener unregisterListener(int index) {
        EventListener listener = null;

        if (this.singleListenerMode) {
            if (this.singleEventListenerRegistry.get(index) == Barcode.BLACK)
                listener = this.singleEventListener;
            this.singleEventListenerRegistry.remove(index, 1);
View Full Code Here

        // listeners cannot be installed on null listElements
        if (listElement == null)
            return null;

        // use the elementConnector to install a listener on the listElement
        final EventListener listener = this.elementConnector.installListener(listElement);

        // test if the new listener transfers us from single event mode to multi event mode
        if (this.singleListenerMode && listener != null) {
            if (this.singleEventListener == null)
                this.singleEventListener = listener;
View Full Code Here

TOP

Related Classes of java.util.EventListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.