Package javax.faces.event

Examples of javax.faces.event.PhaseEvent


         }
      }

      private void restoreViewPhase()
      {
         phases.beforePhase(new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE));
         try
         {
            UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, getViewId());
            facesContext.setViewRoot(viewRoot);
            Map restoredViewRootAttributes = facesContext.getViewRoot().getAttributes();
            if (conversationId != null)
            {
               if (isGetRequest())
               {
                  setParameter(Manager.instance().getConversationIdParameter(), conversationId);
                  // TODO: what about conversationIsLongRunning????
               }
               else
               {
                  if (conversationViewRootAttributes.containsKey(conversationId))
                  {
                     // should really only do this if the view id matches (not
                     // really possible to implement)
                     Map state = conversationViewRootAttributes.get(conversationId);
                     restoredViewRootAttributes.putAll(state);
                  }
               }
            }
            if (isGetRequest())
            {
               facesContext.renderResponse();
            }
            else
            {
               restoredViewRootAttributes.putAll(pageParameters);
            }
         }
         finally
         {
            phases.afterPhase(new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE));
         }
      }
View Full Code Here


   
    if(requestContext.isAjaxRequest()) {     
      LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
      Lifecycle lifecycle = factory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
      PrimeFacesPhaseListener listener = new PrimeFacesPhaseListener();
      PhaseEvent phaseEvent = new PhaseEvent(FacesContext.getCurrentInstance(), PhaseId.RENDER_RESPONSE, lifecycle);

      requestContext.setAjaxRedirectUrl(url);
     
      listener.beforePhase(phaseEvent)//send ajax redirect request
     
View Full Code Here

            PhaseListener phaseListener = phaseListeners[i];
            int listenerPhaseId = phaseListener.getPhaseId().getOrdinal();
            if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal() ||
                listenerPhaseId == phaseId.getOrdinal())
            {
                phaseListener.beforePhase(new PhaseEvent(facesContext, phaseId, this));
            }
        }

    }
View Full Code Here

            PhaseListener phaseListener = phaseListeners[i];
            int listenerPhaseId = phaseListener.getPhaseId().getOrdinal();
            if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal() ||
                listenerPhaseId == phaseId.getOrdinal())
            {
                phaseListener.afterPhase(new PhaseEvent(facesContext, phaseId, this));
            }
        }

    }
View Full Code Here

        // get the UIViewRoot (note that it must not be null at this point)
        UIViewRoot root = facesContext.getViewRoot();
        MethodExpression afterPhaseExpression = root.getAfterPhaseListener();
        if (afterPhaseExpression != null)
        {
            PhaseEvent event = new PhaseEvent(facesContext, getPhase(), _getLifecycle(facesContext));
            try
            {
                afterPhaseExpression.invoke(facesContext.getELContext(), new Object[] { event });
            }
            catch (Throwable t)
View Full Code Here

    void informPhaseListenersBefore(PhaseId phaseId)
    {
        boolean[] beforePhaseSuccess = new boolean[phaseListeners.length];
        listenerSuccessMap.put(phaseId, beforePhaseSuccess);

        PhaseEvent event = new PhaseEvent(facesContext, phaseId, lifecycle);

        for (int i = 0; i < phaseListeners.length; i++)
        {
            PhaseListener phaseListener = phaseListeners[i];
            if (isListenerForThisPhase(phaseListener, phaseId))
View Full Code Here

    void informPhaseListenersAfter(PhaseId phaseId)
    {
        boolean[] beforePhaseSuccess = listenerSuccessMap.get(phaseId);

        PhaseEvent event = null;

        for (int i = phaseListeners.length - 1; i >= 0; i--)
        {
            PhaseListener phaseListener = phaseListeners[i];
            if (isListenerForThisPhase(phaseListener, phaseId) && beforePhaseSuccess[i])
            {
                if (event == null)
                {
                    event = new PhaseEvent(facesContext, phaseId, lifecycle);
                }
                try
                {
                    phaseListener.afterPhase(event);
                }
View Full Code Here

                    beforePhaseSuccess = new boolean[listenerCount];
                    Arrays.fill(beforePhaseSuccess, true);
                }
            }
           
            PhaseEvent event = createEvent(context, phaseId);

            // only invoke the listener if we are in beforePhase
            // or if the related before PhaseListener finished without an Exception
            if (listener != null && (beforePhase || beforePhaseSuccess[0]))
            {
View Full Code Here

            {
                id = LifecycleFactory.DEFAULT_LIFECYCLE;
            }
            _lifecycle = factory.getLifecycle(id);
        }
        return new PhaseEvent(context, phaseId, _lifecycle);
    }
View Full Code Here

            return;
        }
        MethodExpression afterPhase = viewRoot.getAfterPhaseListener();
        if (null != afterPhase) {
            try {
                PhaseEvent event = new PhaseEvent(context, PhaseId.RESTORE_VIEW, lifecycle);
                afterPhase.invoke(context.getELContext(), new Object[]{event});
            }
            catch (Exception e) {
                if (LOGGER.isLoggable(Level.SEVERE)) {
                    LOGGER.log(Level.SEVERE,
View Full Code Here

TOP

Related Classes of javax.faces.event.PhaseEvent

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.