Examples of PhaseEvent


Examples of javax.faces.event.PhaseEvent

         }
      }

      private void invokeApplicationPhase() throws Exception
      {
         phases.beforePhase(new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, MockLifecycle.INSTANCE));
         try
         {
            updateConversationId();

            invokeApplicationBegun = true;

            invokeApplication();

            invokeApplicationComplete = true;

            String outcome = getInvokeApplicationOutcome();
            facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, action, outcome);

            viewId = getRenderedViewId();

            updateConversationId();
         }
         finally
         {
            phases.afterPhase(new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, MockLifecycle.INSTANCE));
         }
      }
View Full Code Here

Examples of javax.faces.event.PhaseEvent

         }
      }

      private void updateModelValuesPhase() throws Exception
      {
         phases.beforePhase(new PhaseEvent(facesContext, PhaseId.UPDATE_MODEL_VALUES, MockLifecycle.INSTANCE));
         try
         {
            updateConversationId();

            updateModelValues();

            updateConversationId();
         }
         finally
         {
            phases.afterPhase(new PhaseEvent(facesContext, PhaseId.UPDATE_MODEL_VALUES, MockLifecycle.INSTANCE));
         }
      }
View Full Code Here

Examples of javax.faces.event.PhaseEvent

         }
      }

      private void processValidationsPhase() throws Exception
      {
         phases.beforePhase(new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, MockLifecycle.INSTANCE));
         try
         {
            updateConversationId();

            processValidations();

            updateConversationId();

            if (isValidationFailure())
            {
               facesContext.renderResponse();
            }
         }
         finally
         {
            phases.afterPhase(new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, MockLifecycle.INSTANCE));
         }
      }
View Full Code Here

Examples of javax.faces.event.PhaseEvent

         }
      }

      private void applyRequestValuesPhase() throws Exception
      {
         phases.beforePhase(new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, MockLifecycle.INSTANCE));
         try
         {
            updateConversationId();

            applyRequestValues();

            updateConversationId();
         }
         finally
         {
            phases.afterPhase(new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, MockLifecycle.INSTANCE));
         }
      }
View Full Code Here

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

Examples of javax.faces.event.PhaseEvent

   */
  public void send(ResourceContext resourceContext, InternetResource resource)
      throws IOException {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    PhaseListener[] phaseListeners = null;
    PhaseEvent renderViewEvent = null;
    if (null != facesContext) {
      Lifecycle facesLifecycle = getFacesLifecycle();
      phaseListeners = facesLifecycle.getPhaseListeners();
      PhaseEvent restoreViewEvent = new PhaseEvent(facesContext,
          PhaseId.RESTORE_VIEW, this);
      processPhaseListeners(phaseListeners, restoreViewEvent, true);
      // Fix for a http://jira.jboss.org/jira/browse/RF-1056
      if (facesContext.getResponseComplete())
        return;
      // fix for a http://jira.jboss.com/jira/browse/RF-1064 .
      // viewRoot can be created outside.
      UIViewRoot savedViewRoot = facesContext.getViewRoot();
      try {
        // create "dummy" viewRoot, to avoid problems in phase
        // listeners.
        UIViewRoot root = new UIViewRoot();
        root.setViewId(resource.getKey());
        root.setLocale(Locale.getDefault());
        root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
        facesContext.setViewRoot(root);
        // Invoke after restore view phase listeners
        processPhaseListeners(phaseListeners, restoreViewEvent, false);
        // Fix for a http://jira.jboss.org/jira/browse/RF-1056
        if (!facesContext.getResponseComplete()) {
          // Invoke before render view phase listeners
          renderViewEvent = new PhaseEvent(facesContext,
              PhaseId.RENDER_RESPONSE, this);
          processPhaseListeners(phaseListeners, renderViewEvent, true);
          sendResource(resourceContext, resource);
          processPhaseListeners(phaseListeners, renderViewEvent,
              false);
View Full Code Here

Examples of javax.faces.event.PhaseEvent

        // 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

Examples of javax.faces.event.PhaseEvent

                    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

Examples of javax.faces.event.PhaseEvent

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

Examples of javax.faces.event.PhaseEvent

            boolean checkAfter) throws Throwable
    {
        expect(_lifecycleFactory.getLifecycle(eq(LifecycleFactory.DEFAULT_LIFECYCLE))).andReturn(_lifecycle);
        expect(_externalContext.getInitParameter(eq(FacesServlet.LIFECYCLE_ID_ATTR))).andReturn(null).anyTimes();

        PhaseEvent event = new PhaseEvent(_facesContext, phaseId, _lifecycle);

        if (expectSuperCall)
            _testimpl = _mocksControl.createMock(UIViewRoot.class, new Method[] { UIViewRoot.class.getMethod(
                    "isRendered", new Class[0]) });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.