protected Event doExecute(RequestContext context) throws Exception { if (viewFactory != null) { viewFactory.getView(context).render(); } return new Event(this, "success"); } }
private void render(RequestControlContext context, View view) throws ViewRenderingException { if (logger.isDebugEnabled()) { logger.debug("Rendering + " + view); logger.debug(" Flash scope = " + context.getFlashScope()); logger.debug(" Messages = " + context.getMessageContext()); } context.viewRendering(view); renderActionList.execute(context); try { view.render(); } catch (IOException e) { throw new ViewRenderingException(getOwner().getId(), getId(), view, e); } clearFlash(context); context.getExternalContext().recordResponseComplete(); context.viewRendered(view); }
protected Event doExecute(RequestContext context) throws Exception { if (viewFactory != null) { viewFactory.getView(context).render(); } return new Event(this, "success"); } }
protected Event doExecute(RequestContext context) throws Exception { if (viewFactory != null) { viewFactory.getView(context).render(); } return new Event(this, "success"); } }
private void render(RequestControlContext context, View view) throws ViewRenderingException { if (logger.isDebugEnabled()) { logger.debug("Rendering + " + view); logger.debug(" Flash scope = " + context.getFlashScope()); logger.debug(" Messages = " + context.getMessageContext()); } context.viewRendering(view); renderActionList.execute(context); try { view.render(); } catch (IOException e) { throw new ViewRenderingException(getOwner().getId(), getId(), view, e); } clearFlash(context); context.getExternalContext().recordResponseComplete(); context.viewRendered(view); }
private void render(RequestControlContext context, View view) throws ViewRenderingException { if (logger.isDebugEnabled()) { logger.debug("Rendering + " + view); logger.debug(" Flash scope = " + context.getFlashScope()); logger.debug(" Messages = " + context.getMessageContext()); } context.viewRendering(view); renderActionList.execute(context); try { view.render(); } catch (IOException e) { throw new ViewRenderingException(getOwner().getId(), getId(), view, e); } context.getFlashScope().clear(); context.getMessageContext().clearMessages(); context.getExternalContext().recordResponseComplete(); context.viewRendered(view); }
public void handle(FlowExecutionException exception, RequestControlContext requestControlContext) { requestControlContext.getMessageContext().addMessage( new MessageBuilder() .error() .source(null) .defaultText( findBusinessException(exception).getMessage()) .build()); Object testState = requestControlContext.getCurrentState(); if (testState instanceof ViewState) { ViewState viewState = (ViewState) testState; try { viewState.getViewFactory().getView(requestControlContext) .render(); } catch (IOException e) { e.printStackTrace(); // Properly handle rendering errors here } } }
public void testRender() throws Exception { UIViewRoot newRoot = new UIViewRoot(); newRoot.setViewId(VIEW_ID); newRoot.setRenderKitId("HTML_BASIC"); ((MockViewHandler) this.viewHandler).setCreateView(newRoot); this.context.inViewState(); EasyMock.expectLastCall().andReturn(false); EasyMock.replay(new Object[] { this.context }); View view = this.factory.getView(this.context); ((JsfView) view).getViewRoot().setTransient(true); view.render(); assertTrue(newRoot.isTransient()); assertTrue(((NoRenderViewHandler) this.viewHandler).rendered); }
public void testGetView() throws Exception { TestAction action = new TestAction(); ActionExecutingViewFactory factory = new ActionExecutingViewFactory(action); MockRequestContext context = new MockRequestContext(); View view = factory.getView(context); assertFalse(action.isExecuted()); view.render(); assertTrue(action.isExecuted()); }
public void testProcessUserEventNoEvent() throws IOException { TestAction action = new TestAction(); ActionExecutingViewFactory factory = new ActionExecutingViewFactory(action); MockRequestContext context = new MockRequestContext(); View view = factory.getView(context); assertFalse(action.isExecuted()); view.render(); assertTrue(action.isExecuted()); view.processUserEvent(); assertFalse(view.hasFlowEvent()); assertNull(view.getFlowEvent()); } }
public void testProcessUserEvent() throws IOException { TestAction action = new TestAction(); ActionExecutingViewFactory factory = new ActionExecutingViewFactory(action); MockRequestContext context = new MockRequestContext(); View view = factory.getView(context); assertFalse(action.isExecuted()); view.render(); assertTrue(action.isExecuted()); context.putRequestParameter("_eventId", "foo"); view.processUserEvent(); assertTrue(view.hasFlowEvent()); assertEquals("foo", view.getFlowEvent().getId()); }
public void testProcessUserEventButton() throws IOException { TestAction action = new TestAction(); ActionExecutingViewFactory factory = new ActionExecutingViewFactory(action); MockRequestContext context = new MockRequestContext(); View view = factory.getView(context); assertFalse(action.isExecuted()); view.render(); assertTrue(action.isExecuted()); context.putRequestParameter("_eventId_foo", "doesn't matter"); view.processUserEvent(); assertTrue(view.hasFlowEvent()); assertEquals("foo", view.getFlowEvent().getId()); }