Java Code Examples for javax.faces.event.PhaseId#INVOKE_APPLICATION

The following examples show how to use javax.faces.event.PhaseId#INVOKE_APPLICATION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DelegatingPhaseListenerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void beforeAndAfterPhaseWithMultipleTargets() {
	TestListener target1 = new TestListener();
	TestListener target2 = new TestListener();
	beanFactory.addBean("testListener1", target1);
	beanFactory.addBean("testListener2", target2);

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

	delPhaseListener.beforePhase(event);
	assertTrue(target1.beforeCalled);
	assertTrue(target2.beforeCalled);

	delPhaseListener.afterPhase(event);
	assertTrue(target1.afterCalled);
	assertTrue(target2.afterCalled);
}
 
Example 2
Source File: DelegatingPhaseListenerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void beforeAndAfterPhaseWithMultipleTargets() {
	TestListener target1 = new TestListener();
	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);

	delPhaseListener.afterPhase(event);
	assertTrue(target1.afterCalled);
	assertTrue(target2.afterCalled);
}
 
Example 3
Source File: MessageHandler.java    From development with Apache License 2.0 5 votes vote down vote up
/**
 * save messages after APPLY_REQUEST_VALUES, PROCESS_VALIDATIONS,
 * INVOKE_APPLICATION
 */
public void afterPhase(PhaseEvent event) {
    if (event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES
            || event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS
            || event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {
        FacesContext facesContext = event.getFacesContext();
        saveMessages(facesContext);
    }
}
 
Example 4
Source File: DelegatingPhaseListenerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void beforeAndAfterPhaseWithSingleTarget() {
	TestListener target = new TestListener();
	beanFactory.addBean("testListener", target);

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

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

	delPhaseListener.afterPhase(event);
	assertTrue(target.afterCalled);
}
 
Example 5
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 6
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 7
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 8
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 9
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 10
Source File: MessageHandler.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 11
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 12
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 13
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 14
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 15
Source File: MessageHandler.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 16
Source File: DelegatingPhaseListenerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void beforeAndAfterPhaseWithSingleTarget() {
	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);
	assertTrue(target.afterCalled);
}
 
Example 17
Source File: MessageHandler.java    From javaee8-jsf-sample with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 18
Source File: MessageHandler.java    From ee7-sandbox with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a notification that the processing for a particular phase has just
 * been completed.
 */
public void afterPhase(PhaseEvent event) {

	if(event.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES ||
			event.getPhaseId() == PhaseId.PROCESS_VALIDATIONS ||
			event.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES || 
			event.getPhaseId() == PhaseId.INVOKE_APPLICATION) {

		FacesContext facesContext = event.getFacesContext();
		saveMessages(facesContext);
	}

}
 
Example 19
Source File: DelegatingPhaseListenerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void beforeAndAfterPhaseWithSingleTarget() {
	TestListener target = new TestListener();
	beanFactory.addBean("testListener", target);

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

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

	delPhaseListener.afterPhase(event);
	assertTrue(target.afterCalled);
}
 
Example 20
Source File: ResetInputAjaxActionListener.java    From ctsms with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Construct a new reset input ajax action listener around the given wrapped action listener. This constructor
 * will be used when registering as <code>&lt;action-listener&gt;</code> in <code>faces-config.xml</code>.
 * @param wrapped The wrapped action listener.
 */
public ResetInputAjaxActionListener(ActionListener wrapped) {
	super(PhaseId.INVOKE_APPLICATION);
	this.wrapped = wrapped;
}