Package javax.faces.event

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


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

        for (int i = 0; i < phaseListeners.length; i++) {
            PhaseListener phaseListener = phaseListeners[i];
            int listenerPhaseId = phaseListener.getPhaseId().getOrdinal();
            if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal()
                    || listenerPhaseId == phaseId.getOrdinal()) {
                phaseListener.beforePhase(new PhaseEvent(FacesContext
                        .getCurrentInstance(), phaseId, lifecycle));
            }
        }

    }
View Full Code Here

        for (int i = 0; i < phaseListeners.length; i++) {
            PhaseListener phaseListener = phaseListeners[i];
            int listenerPhaseId = phaseListener.getPhaseId().getOrdinal();
            if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal()
                    || listenerPhaseId == phaseId.getOrdinal()) {
                phaseListener.afterPhase(new PhaseEvent(FacesContext
                        .getCurrentInstance(), phaseId, lifecycle));
            }
        }

    }
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

            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

  public void testBeforeAndAfterPhaseWithSingleTarget() {
    TestListener target = new TestListener();
    beanFactory.addBean("testListener", target);

    assertEquals(delPhaseListener.getPhaseId(), PhaseId.ANY_PHASE);
    PhaseEvent event = new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, new MockLifecycle());

    delPhaseListener.beforePhase(event);
    assertTrue(target.beforeCalled);

    delPhaseListener.afterPhase(event);
View Full Code Here

    TestListener target2 = new TestListener();
    beanFactory.addBean("testListener1", target1);
    beanFactory.addBean("testListener2", target2);

    assertEquals(delPhaseListener.getPhaseId(), PhaseId.ANY_PHASE);
    PhaseEvent event = new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, new MockLifecycle());

    delPhaseListener.beforePhase(event);
    assertTrue(target1.beforeCalled);
    assertTrue(target2.beforeCalled);
View Full Code Here

      JSF_12 = false;
    }
  }

  public static void notifyAfterListeners(PhaseId phaseId, Lifecycle lifecycle, FacesContext context) {
    PhaseEvent afterPhaseEvent = new PhaseEvent(context, phaseId, lifecycle);
    for (int i = 0; i < lifecycle.getPhaseListeners().length; i++) {
      PhaseListener listener = lifecycle.getPhaseListeners()[i];
      if (listener.getPhaseId() == phaseId || listener.getPhaseId() == PhaseId.ANY_PHASE) {
        listener.afterPhase(afterPhaseEvent);
      }
View Full Code Here

      }
    }
  }

  public static void notifyBeforeListeners(PhaseId phaseId, Lifecycle lifecycle, FacesContext context) {
    PhaseEvent beforePhaseEvent = new PhaseEvent(context, phaseId, lifecycle);
    for (int i = 0; i < lifecycle.getPhaseListeners().length; i++) {
      PhaseListener listener = lifecycle.getPhaseListeners()[i];
      if (listener.getPhaseId() == phaseId || listener.getPhaseId() == PhaseId.ANY_PHASE) {
        listener.beforePhase(beforePhaseEvent);
      }
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.