本文整理汇总了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;
}