Package javax.faces.event

Examples of javax.faces.event.PhaseListener


            }
        }

        public PhaseId getPhaseId()
        {
            PhaseListener listener = getPhaseListener();
            if (listener != null)
            {
                return listener.getPhaseId();
            }

            return null;

        }
View Full Code Here


            // add phase listeners
            for (String listenerClassName : getDispenser().getLifecyclePhaseListeners())
            {
                try
                {
                    PhaseListener listener = (PhaseListener)
                            ClassUtils.newInstance(listenerClassName, PhaseListener.class);

                    Object creationMetaData = getInjectionProvider().inject(listener);

                    injectedBeanStorage.add(new BeanEntry(listener, creationMetaData));
View Full Code Here

        _testimpl.setAfterPhaseListener(afterListener);

        Method[] mockedMethods = new Method[] {
                PhaseListener.class.getMethod("beforePhase", new Class[] { PhaseEvent.class }),
                PhaseListener.class.getMethod("afterPhase", new Class[] { PhaseEvent.class }) };
        PhaseListener phaseListener = _mocksControl.createMock(phaseListenerClasses.get(phaseId), mockedMethods);
        _testimpl.addPhaseListener(phaseListener);

        PhaseListener anyPhaseListener = _mocksControl.createMock(AnyPhasePhaseListener.class, mockedMethods);
        _testimpl.addPhaseListener(anyPhaseListener);

        PhaseListener restoreViewPhaseListener = _mocksControl.createMock(RestoreViewPhasePhaseListener.class,
                mockedMethods);
        _testimpl.addPhaseListener(restoreViewPhaseListener);

        _mocksControl.checkOrder(true);
View Full Code Here

        // attribute is set, instantiate an instance of the specified class, and register it by calling
        // addPhaseListener(). If the binding attribute was also set, store the listener instance
        // by calling binding.setValue(). If there was an exception thrown, rethrow the
        // exception as a JspException.

        PhaseListener listener = null;
        try
        {
            listener = new BindingPhaseListener(binding, type);
        }
        catch (Exception ex)
View Full Code Here

            this.type = type;
        }

        public void afterPhase(PhaseEvent event)
        {
            PhaseListener listener = getPhaseListener();
            if (listener != null)
            {
                listener.afterPhase(event);
            }
        }
View Full Code Here

            }
        }

        public void beforePhase(PhaseEvent event)
        {
            PhaseListener listener = getPhaseListener();
            if (listener != null)
            {
                listener.beforePhase(event);
            }
        }
View Full Code Here

            }
        }

        public PhaseId getPhaseId()
        {
            PhaseListener listener = getPhaseListener();
            if (listener != null)
            {
                return listener.getPhaseId();
            }

            return null;

        }
View Full Code Here

                if (beforePhase)
                {
                    // process listeners in ascending order
                    for (int i = 0; i < beforePhaseSuccess.length - 1; i++)
                    {
                        PhaseListener phaseListener;
                        try
                        {
                            phaseListener = phaseListeners.get(i);
                        }
                        catch (IndexOutOfBoundsException e)
                        {
                            // happens when a PhaseListener removes another PhaseListener
                            // from UIViewRoot in its beforePhase method
                            throw new IllegalStateException("A PhaseListener must not remove " +
                                    "PhaseListeners from UIViewRoot.");
                        }
                        PhaseId listenerPhaseId = phaseListener.getPhaseId();
                        if (phaseId.equals(listenerPhaseId) || PhaseId.ANY_PHASE.equals(listenerPhaseId))
                        {
                            listenerCalled = true;
                            try
                            {
                                phaseListener.beforePhase(event);
                                beforePhaseSuccess[i + 1] = true;
                            }
                            catch (Throwable t)
                            {
                                beforePhaseSuccess[i + 1] = false; // redundant - for clarity
                                _getLogger().log(Level.SEVERE, "An Exception occured while processing the " +
                                                         "beforePhase method of PhaseListener " + phaseListener +
                                                         " in Phase " + phaseId, t);
                                return context.getResponseComplete() ||
                                        (context.getRenderResponse() && !PhaseId.RENDER_RESPONSE.equals(phaseId));
                            }
                        }
                    }
                }
                else
                {
                    // afterPhase
                    // process listeners in descending order
                    for (int i = beforePhaseSuccess.length - 1; i > 0; i--)
                    {
                        PhaseListener phaseListener;
                        try
                        {
                            phaseListener = phaseListeners.get(i - 1);
                        }
                        catch (IndexOutOfBoundsException e)
                        {
                            // happens when a PhaseListener removes another PhaseListener
                            // from UIViewRoot in its beforePhase or afterPhase method
                            throw new IllegalStateException("A PhaseListener must not remove " +
                                    "PhaseListeners from UIViewRoot.");
                        }
                        PhaseId listenerPhaseId = phaseListener.getPhaseId();
                        if ((phaseId.equals(listenerPhaseId) || PhaseId.ANY_PHASE.equals(listenerPhaseId))
                                && beforePhaseSuccess[i])
                        {
                            listenerCalled = true;
                            try
                            {
                                phaseListener.afterPhase(event);
                            }
                            catch (Throwable t)
                            {
                                logger.log(Level.SEVERE, "An Exception occured while processing the " +
                                                         "afterPhase method of PhaseListener " + phaseListener +
View Full Code Here

            // add phase listeners
            for (String listenerClassName : getDispenser().getLifecyclePhaseListeners())
            {
                try
                {
                    PhaseListener listener = (PhaseListener)
                            ClassUtils.newInstance(listenerClassName, PhaseListener.class);

                    Object creationMetaData = getInjectionProvider().inject(listener);

                    injectedBeanStorage.add(new BeanEntry(listener, creationMetaData));
View Full Code Here

        _testimpl.setAfterPhaseListener(afterListener);

        Method[] mockedMethods = new Method[] {
                PhaseListener.class.getMethod("beforePhase", new Class[] { PhaseEvent.class }),
                PhaseListener.class.getMethod("afterPhase", new Class[] { PhaseEvent.class }) };
        PhaseListener phaseListener = _mocksControl.createMock(phaseListenerClasses.get(phaseId), mockedMethods);
        _testimpl.addPhaseListener(phaseListener);

        PhaseListener anyPhaseListener = _mocksControl.createMock(AnyPhasePhaseListener.class, mockedMethods);
        _testimpl.addPhaseListener(anyPhaseListener);

        PhaseListener restoreViewPhaseListener = _mocksControl.createMock(RestoreViewPhasePhaseListener.class,
                mockedMethods);
        _testimpl.addPhaseListener(restoreViewPhaseListener);

        _mocksControl.checkOrder(true);
View Full Code Here

TOP

Related Classes of javax.faces.event.PhaseListener

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.