use of javax.faces.application.ViewHandler in project ART-TIME by Artezio.
the class EffortsBean method resetComponentsTree.
protected void resetComponentsTree() {
Application application = facesContext.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(facesContext, facesContext.getViewRoot().getViewId());
facesContext.setViewRoot(viewRoot);
}
use of javax.faces.application.ViewHandler in project ART-TIME by Artezio.
the class EffortsBeanTest method testResetComponentsTree.
@Test
public void testResetComponentsTree() throws Exception {
FacesContext facesContext = createMock(FacesContext.class);
Application application = createMock(Application.class);
ViewHandler viewHandler = createMock(ViewHandler.class);
UIViewRoot viewRoot = createMock(UIViewRoot.class);
String viewId = "viewId";
setField(effortsBean, "facesContext", facesContext);
expect(facesContext.getApplication()).andReturn(application);
expect(application.getViewHandler()).andReturn(viewHandler);
expect(facesContext.getViewRoot()).andReturn(viewRoot);
expect(viewRoot.getViewId()).andReturn(viewId);
expect(viewHandler.createView(facesContext, viewId)).andReturn(viewRoot);
facesContext.setViewRoot(viewRoot);
replay(facesContext, application, viewHandler, viewRoot);
effortsBean.resetComponentsTree();
verify(facesContext, application, viewHandler, viewRoot);
}
use of javax.faces.application.ViewHandler in project oxCore by GluuFederation.
the class FacesService method renderView.
public void renderView(String viewId) {
final FacesContext fc = FacesContext.getCurrentInstance();
final ViewHandler viewHandler = fc.getApplication().getViewHandler();
fc.setViewRoot(viewHandler.createView(fc, viewId));
fc.getPartialViewContext().setRenderAll(true);
fc.renderResponse();
}
use of javax.faces.application.ViewHandler in project Payara by payara.
the class JSFTestServlet method doGet.
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
FacesContextFactory facesContextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
ServletContext context = getServletContext();
FacesContext facesContext = facesContextFactory.getFacesContext(context, request, response, lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE));
Application application = facesContext.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(facesContext, null);
facesContext.setViewRoot(viewRoot);
PrintWriter pw = response.getWriter();
pw.println("Created viewRoot " + viewRoot);
pw.flush();
pw.close();
}
use of javax.faces.application.ViewHandler in project opentheso by miledrousset.
the class SearchCandidatBean method refreshView.
public void refreshView() {
FacesContext context = FacesContext.getCurrentInstance();
String viewId = context.getViewRoot().getViewId();
ViewHandler handler = context.getApplication().getViewHandler();
UIViewRoot root = handler.createView(context, viewId);
root.setViewId(viewId);
context.setViewRoot(root);
}
Aggregations