Package javax.faces.event

Examples of javax.faces.event.SystemEventListener


            // and the loop will be complete.
            while (processedListenerIndex < listenersCopy.size())
            {               
                for (; processedListenerIndex < listenersCopy.size(); processedListenerIndex++ )
                {
                    SystemEventListener listener = listenersCopy.get(processedListenerIndex);
                    // Call SystemEventListener.isListenerForSource(java.lang.Object), passing the source argument.
                    // If this returns false, take no action on the listener.
                    if (listener.isListenerForSource(source))
                    {
                        // Otherwise, if the event to be passed to the listener instances has not yet been constructed,
                        // construct the event, passing source as the argument
                        // to the one-argument constructor that takes
                        // an Object. This same event instance must be passed to all listener instances.
                        event = _createEvent(systemEventClass, source, event);
   
                        // Call SystemEvent.isAppropriateListener(javax.faces.event.FacesListener), passing the listener
                        // instance as the argument. If this returns false, take no action on the listener.
                        if (event.isAppropriateListener(listener))
                        {
                            // Call SystemEvent.processListener(javax.faces.event.FacesListener), passing the listener
                            // instance.
                            event.processListener(listener);
                        }
                    }
                }
               
                boolean listChanged = false;
                if (listeners.size() == listenersCopy.size())
                {
                    for (int i = 0; i < listenersCopy.size(); i++)
                    {
                        if (listenersCopy.get(i) != listeners.get(i))
                        {
                            listChanged = true;
                            break;
                        }
                    }
                }
                else
                {
                    listChanged = true;
                }
               
                if (listChanged)
                {
                    for (int i = 0; i < listeners.size(); i++)
                    {
                        SystemEventListener listener = listeners.get(i);
                       
                        // check if listenersCopy.get(i) is valid
                        if (i < listenersCopy.size())
                        {
                            // The normal case is a listener was added,
                            // so as heuristic, check first
                            // if we can find it at the same location
                            if (!listener.equals(listenersCopy.get(i)))
                            {
                                if (!listenersCopy.contains(listener))
                                {
                                    listenersCopy.add(listener);
                                }
View Full Code Here


        if (componentListener == null)
        {
            throw new NullPointerException("componentListener required");
        }

        SystemEventListener listener = new EventListenerWrapper(this, componentListener);

        // Make sure the map exists
        if (_systemEventListenerClassMap == null)
        {
            _systemEventListenerClassMap = new HashMap<Class<? extends SystemEvent>, List<SystemEventListener>>();
View Full Code Here

              // go thru copy completely
              // compare copy to original
              // if original differs from copy, make a new copy.
              // The new copy consists of the original list - processed

              SystemEventListener listenersCopy[] =
                      new SystemEventListener[listeners.size()];
              int i = 0;
              for (i = 0; i < listenersCopy.length; i++) {
                  listenersCopy[i] = listeners.get(i);
              }

              Map<SystemEventListener, Boolean> processedListeners =
                      new HashMap<SystemEventListener, Boolean>(listeners.size());
              boolean processedSomeEvents = false,
                      originalDiffersFromCopy = false;

              do {
                  i = 0;
                  originalDiffersFromCopy = false;
                  if (0 < listenersCopy.length) {
                      for (i = 0; i < listenersCopy.length; i++) {
                          SystemEventListener curListener = listenersCopy[i];
                          if (curListener != null && curListener.isListenerForSource(source)) {
                              if (event == null) {
                                  event = eventInfo.createSystemEvent(source);
                              }
                              assert (event != null);
                              if (!processedListeners.containsKey(curListener)
View Full Code Here

            SystemEventListener copy[]) {
        boolean foundDifference = false;
        int i = 0, originalLen = original.size(), copyLen = copy.length;

        if (originalLen == copyLen) {
            SystemEventListener originalItem, copyItem;
            Iterator<SystemEventListener> iter = original.iterator();
            while (iter.hasNext() && !foundDifference) {
                originalItem = iter.next();
                copyItem = copy[i++];
                foundDifference = originalItem != copyItem;
View Full Code Here

                    sourceClass = getNodeText(n);
                }
            }
        }
        if (listenerClass != null) {
            SystemEventListener selInstance = (SystemEventListener)
                  createInstance(listenerClass,
                                 SystemEventListener.class,
                                 null,
                                 systemEventListener);
            if (selInstance != null) {
                try {
                    // If there is an eventClass, use it, otherwise use
                    // SystemEvent.class
                    //noinspection unchecked
                    Class<? extends SystemEvent> eventClazz =
                          (Class<? extends SystemEvent>) loadClass(eventClass, this, null);
                    // If there is a sourceClass, use it, otherwise use null
                    Class sourceClazz =
                          (sourceClass != null && sourceClass.length() != 0)
                          ? Util.loadClass(sourceClass, this.getClass())
                          : null;
                    application.subscribeToEvent(eventClazz,
                                                 sourceClazz,
                                                 selInstance);
                    if (LOGGER.isLoggable(Level.FINE)) {
                        LOGGER.log(Level.FINE,
                                   "Subscribing for event {0} and source {1} using listener {2}",
                                   new Object[]{
                                         eventClazz.getName(),
                                         ((sourceClazz != null) ? sourceClazz
                                               .getName() : "ANY"),
                                         selInstance.getClass().getName()
                                   });
                    }
                } catch (ClassNotFoundException cnfe) {
                    throw new ConfigurationException(cnfe);
                }
View Full Code Here

    // ---------------------------------------------------------- Public Methods


    public void notifyTrackChanges(UIViewRoot root) {

        SystemEventListener listener = new AddRemoveListener(this);
        root.subscribeToViewEvent(PostAddToViewEvent.class, listener);
        root.subscribeToViewEvent(PreRemoveFromViewEvent.class, listener);

    }
View Full Code Here

            // and the loop will be complete.
            while (processedListenerIndex < listenersCopy.size())
            {               
                for (; processedListenerIndex < listenersCopy.size(); processedListenerIndex++ )
                {
                    SystemEventListener listener = listenersCopy.get(processedListenerIndex);
                    // Call SystemEventListener.isListenerForSource(java.lang.Object), passing the source argument.
                    // If this returns false, take no action on the listener.
                    if (listener.isListenerForSource(source))
                    {
                        // Otherwise, if the event to be passed to the listener instances has not yet been constructed,
                        // construct the event, passing source as the argument to the one-argument constructor that takes
                        // an Object. This same event instance must be passed to all listener instances.
                        event = _createEvent(systemEventClass, source, event);
   
                        // Call SystemEvent.isAppropriateListener(javax.faces.event.FacesListener), passing the listener
                        // instance as the argument. If this returns false, take no action on the listener.
                        if (event.isAppropriateListener(listener))
                        {
                            // Call SystemEvent.processListener(javax.faces.event.FacesListener), passing the listener
                            // instance.
                            event.processListener(listener);
                        }
                    }
                }
               
                boolean listChanged = false;
                if (listeners.size() == listenersCopy.size())
                {
                    for (int i = 0; i < listenersCopy.size(); i++)
                    {
                        if (listenersCopy.get(i) != listeners.get(i))
                        {
                            listChanged = true;
                            break;
                        }
                    }
                }
                else
                {
                    listChanged = true;
                }
               
                if (listChanged)
                {
                    for (int i = 0; i < listeners.size(); i++)
                    {
                        SystemEventListener listener = listeners.get(i);
                       
                        // check if listenersCopy.get(i) is valid
                        if (i < listenersCopy.size())
                        {
                            // The normal case is a listener was added,
                            // so as heuristic, check first
                            // if we can find it at the same location
                            if (!listener.equals(listenersCopy.get(i)))
                            {
                                if (!listenersCopy.contains(listener))
                                {
                                    listenersCopy.add(listener);
                                }
View Full Code Here

        if (componentListener == null)
        {
            throw new NullPointerException("componentListener required");
        }
       
        SystemEventListener listener = new EventListenerWrapper(this, componentListener);

        // Make sure the map exists
        if (_systemEventListenerClassMap == null) {
            _systemEventListenerClassMap = new HashMap<Class<? extends SystemEvent>, List<SystemEventListener>>();
        }
View Full Code Here

        }
        if (null == listenersByEventClass) {
            listenersByEventClass = new HashMap<Class<? extends SystemEvent>,
                                                List<SystemEventListener>>(3, 1.0f);
        }
        SystemEventListener facesLifecycleListener =
              new ComponentSystemEventListenerAdapter(componentListener, this);
        List<SystemEventListener> listenersForEventClass =
              listenersByEventClass.get(eventClass);
        if (listenersForEventClass == null) {
            listenersForEventClass = new ArrayList<SystemEventListener>(3);
View Full Code Here

        List<SystemEventListener> listeners =
              getListenersForEventClass(eventClass);
        if (listeners != null && !listeners.isEmpty()) {
            for (Iterator<SystemEventListener> i = listeners.iterator(); i.hasNext();) {
                SystemEventListener item = i.next();
                ComponentSystemEventListenerAdapter csla =
                      (ComponentSystemEventListenerAdapter) item;
                ComponentSystemEventListener l = csla.getWrapped();
                if (l.equals(componentListener)) {
                    i.remove();
View Full Code Here

TOP

Related Classes of javax.faces.event.SystemEventListener

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.