/** * Builds the view if not already available. This is mostly required for ViewExpiredException's. * * @param context The {@link FacesContext}. * @param throwable The occurred {@link Throwable}. * @param rootCause The root cause. * @return The unwrapped {@link Throwable}. * @throws java.io.IOException If building the view fails. */ protected Throwable buildView(FacesContext context, Throwable throwable, Throwable rootCause) throws IOException { if (context.getViewRoot() == null) { ViewHandler viewHandler = context.getApplication().getViewHandler(); String viewId = viewHandler.deriveViewId(context, ComponentUtils.calculateViewId(context)); ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(context, viewId); UIViewRoot viewRoot = vdl.createView(context, viewId); context.setViewRoot(viewRoot); vdl.buildView(context, viewRoot); // Workaround for Mojarra // if UIViewRoot == null -> 'IllegalArgumentException' is throwed instead of 'ViewExpiredException' if (rootCause == null && throwable instanceof IllegalArgumentException) { rootCause = new javax.faces.application.ViewExpiredException(viewId); } } return rootCause; }
@Override public void setViewRoot(UIViewRoot root) { delegate.setViewRoot(root); }
@Override public void setViewRoot(final UIViewRoot viewRoot) { viewRootCleared = false; wrapped.setViewRoot(viewRoot); }
@Override public void setViewRoot(UIViewRoot viewRoot) { _facesContext.setViewRoot(viewRoot); }
/** * @since JSF 1.0 */ @Override public void setViewRoot(UIViewRoot viewRoot) { FacesContext.getCurrentInstance().setViewRoot(viewRoot); }
/** * <p>The default behavior of this method is to * call {@link FacesContext#setViewRoot(UIViewRoot)} * on the wrapped {@link FacesContext} object.</p> * * @see javax.faces.context.FacesContext#setViewRoot(UIViewRoot) */ @Override public void setViewRoot(UIViewRoot root) { getWrapped().setViewRoot(root); }
/** * <p>The default behavior of this method is to * call {@link FacesContext#setViewRoot(UIViewRoot)} * on the wrapped {@link FacesContext} object.</p> * * @see javax.faces.context.FacesContext#setViewRoot(UIViewRoot) */ @Override public void setViewRoot(UIViewRoot root) { getWrapped().setViewRoot(root); }
@Override public void setViewRoot(UIViewRoot root) { getWrapped().setViewRoot(root); }
/** * <p>The default behavior of this method is to * call {@link FacesContext#setViewRoot(UIViewRoot)} * on the wrapped {@link FacesContext} object.</p> * * @see javax.faces.context.FacesContext#setViewRoot(UIViewRoot) */ @Override public void setViewRoot(UIViewRoot root) { getWrapped().setViewRoot(root); }
/** * Override super's to make sure our viewRoot is active * * @see org.netbeans.modules.visualweb.insync.faces.FacesUnit#getFacesContext() */ public FacesContext getFacesContext() { FacesContext facesContext = super.getFacesContext(); facesContext.setViewRoot(viewRoot); // the view root for the component tree to be rendered return facesContext; }
/** * <p>The default behavior of this method is to * call {@link FacesContext#setViewRoot(UIViewRoot)} * on the wrapped {@link FacesContext} object.</p> * * @see javax.faces.context.FacesContext#setViewRoot(UIViewRoot) */ public void setViewRoot(UIViewRoot root) { getWrapped().setViewRoot(root); }
/** * @see Faces#setViewRoot(String) */ public static void setViewRoot(FacesContext context, String viewId) { context.setViewRoot(context.getApplication().getViewHandler().createView(context, viewId)); }
/** * @see Faces#setViewRoot(String) */ public static void setViewRoot(FacesContext context, String viewId) { context.setViewRoot(context.getApplication().getViewHandler().createView(context, viewId)); }
public void recreateComponentTree() { FacesContext facesContext = FacesContext.getCurrentInstance(); ViewHandler viewHandler = facesContext.getApplication().getViewHandler(); UIViewRoot viewRoot = viewHandler.createView(facesContext, facesContext.getViewRoot().getViewId()); facesContext.setViewRoot(viewRoot); facesContext.renderResponse(); }
public void resetView(boolean renderResponse) { FacesContext facesContext = FacesContext.getCurrentInstance(); ViewHandler viewHandler = facesContext.getApplication().getViewHandler(); UIViewRoot emptyView = viewHandler.createView(facesContext, facesContext.getViewRoot().getViewId()); facesContext.setViewRoot(emptyView); if (renderResponse) { facesContext.renderResponse(); } }
/** * Proceed to render the Page. */ protected void render(FacesContext context, Page page) { UIViewRoot viewRoot = context.getApplication().getViewHandler() .createView( context, getViewId(page) ); context.setViewRoot(viewRoot); }
@Override public void recreateComponentTree(FacesContext facesContext) { Application application = facesContext.getApplication(); ViewHandler viewHandler = application.getViewHandler(); UIViewRoot oldViewRoot = facesContext.getViewRoot(); UIViewRoot viewRoot = viewHandler.createView(facesContext, oldViewRoot.getViewId()); facesContext.setViewRoot(viewRoot); facesContext.renderResponse(); }
protected void render(FacesContext context, ViewHandler viewHandler, String newViewId) { UIViewRoot viewRoot = viewHandler.createView(context, newViewId); viewRoot.setViewId(newViewId); context.setViewRoot(viewRoot); context.renderResponse(); }
protected void initDefaultView() { UIViewRoot root = new UIViewRoot(); root.setViewId("/viewId"); root.setLocale(getLocale()); root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT); this.facesContext.setViewRoot(root); }
private void configureJsf() throws Exception { this.jsfMock.setUp(); ExceptionEventAwareMockApplication application = new ExceptionEventAwareMockApplication(); ((MockBaseFacesContext) FlowFacesContext.getCurrentInstance()).setApplication(application); PhaseListener trackingListener = new TrackingPhaseListener(); this.jsfMock.lifecycle().addPhaseListener(trackingListener); this.jsfMock.facesContext().setViewRoot(null); this.jsfMock.facesContext().getApplication().setViewHandler(this.viewHandler); }