本文整理匯總了Java中javax.faces.event.PhaseId.INVOKE_APPLICATION屬性的典型用法代碼示例。如果您正苦於以下問題:Java PhaseId.INVOKE_APPLICATION屬性的具體用法?Java PhaseId.INVOKE_APPLICATION怎麽用?Java PhaseId.INVOKE_APPLICATION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.faces.event.PhaseId
的用法示例。
在下文中一共展示了PhaseId.INVOKE_APPLICATION屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: beforeAndAfterPhaseWithMultipleTargets
@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);
}
示例2: testBeforeAndAfterPhaseWithMultipleTargets
public void testBeforeAndAfterPhaseWithMultipleTargets() {
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);
}
示例3: afterPhase
@Override
public void afterPhase(PhaseEvent event)
{
// Set an attribute on to the session just so that we can force the session to get serialized
// We target the invoke application phase as well since the redirects get issued at that stage.
if (event.getPhaseId() == PhaseId.INVOKE_APPLICATION || event.getPhaseId() == PhaseId.RENDER_RESPONSE)
{
final String METHOD_NAME = "afterPhase";
LOGGER.logp(Level.FINEST, CLASS_NAME, METHOD_NAME, "Adding a random attribute to the session map.");
Map<String, Object> sessionMap = event.getFacesContext().getExternalContext().getSessionMap();
if (sessionMap != null)
{
sessionMap.put("__timestamp__", System.currentTimeMillis());
}
}
}
示例4: afterPhase
/**
* 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);
}
}
示例5: afterPhase
/**
* 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);
}
}
示例6: beforeAndAfterPhaseWithSingleTarget
@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);
}
示例7: testBeforeAndAfterPhaseWithSingleTarget
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);
assertTrue(target.afterCalled);
}
示例8: goToPage2
public void goToPage2(ValueChangeEvent event) {
if (event.getPhaseId() != PhaseId.INVOKE_APPLICATION) {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
event.queue();
} else {
// refresh current page state.
goToPage(null);
}
}
示例9: documentZoomLevelChange
public void documentZoomLevelChange(ValueChangeEvent event) {
if (event.getPhaseId() != PhaseId.INVOKE_APPLICATION) {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
event.queue();
} else {
// refresh current page state.
refreshDocumentState();
}
}
示例10: ResetInputAjaxActionListener
/**
* Construct a new reset input ajax action listener around the given wrapped action listener. This constructor
* will be used when registering as <code><action-listener></code> in <code>faces-config.xml</code>.
* @param wrapped The wrapped action listener.
*/
public ResetInputAjaxActionListener(ActionListener wrapped) {
super(PhaseId.INVOKE_APPLICATION);
this.wrapped = wrapped;
}