Package javax.faces.component

Examples of javax.faces.component.UIViewRoot


   }

   @Override
   public UIViewRoot restoreView(final FacesContext context, final String viewId)
   {
      UIViewRoot view = parent.restoreView(context, viewId);
      return view;
   }
View Full Code Here


  public UIViewRoot createView(FacesContext facesContext, String viewId) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("creating new view with viewId:        '" + viewId + "'");
    }
    UIViewRoot viewRoot = base.createView(facesContext, viewId);
    // ensure tobago UIViewRoot RI don't create the component via application
    if (!(viewRoot instanceof org.apache.myfaces.tobago.component.UIViewRoot)) {
      UIViewRoot tobagoViewRoot = (UIViewRoot)
          facesContext.getApplication().createComponent(UIViewRoot.COMPONENT_TYPE);
      if (!(tobagoViewRoot instanceof org.apache.myfaces.tobago.component.UIViewRoot)) {
        LOG.warn("Application creating wrong UIViewRoot, forcing Tobago");
        tobagoViewRoot = new org.apache.myfaces.tobago.component.UIViewRoot();
      }
      tobagoViewRoot.setLocale(viewRoot.getLocale());
      tobagoViewRoot.setViewId(viewId);
      tobagoViewRoot.setRenderKitId(viewRoot.getRenderKitId());
      viewRoot = tobagoViewRoot;
    }
    ensureClientProperties(facesContext, viewRoot);

    return viewRoot;
View Full Code Here

      LOG.debug("restore view with viewId:             '" + viewId + "'");
    }
    // this is only needed in the first request, the later will be handled by faces
    // TODO: maybe find a way to make this unneeded
    RequestUtils.ensureEncoding(facesContext.getExternalContext());
    UIViewRoot viewRoot = base.restoreView(facesContext, viewId);
    ensureClientProperties(facesContext, viewRoot);
    return viewRoot;
  }
View Full Code Here

            resourceBuilder.getResource(SIMULATION_SCRIPT_NAME);
        } catch (ResourceNotFoundException e) {
            resourceBuilder.createResource(null, SIMULATION_SCRIPT_NAME);
        }

        UIViewRoot viewRoot = facesContext.getViewRoot();
        UIResource resource;
        UIComponent form = application.createComponent(UIForm.COMPONENT_TYPE);

        viewRoot.getChildren().add(form);

        final UIComponent commandButton = application.createComponent(UIAjaxCommandButton.COMPONENT_TYPE);

        form.getChildren().add(commandButton);
        facesContext.getRenderKit().addRenderer(COMPONENT_TYPE, COMPONENT_TYPE,
                new AjaxSubmitFunctionResourceRenderer());
        form.getChildren().add(new AjaxSubmitFunctionComponent());
        resource = (UIResource) application.createComponent("org.ajax4jsf.LoadScript");
        resource.setSrc("resource:///" + SIMULATION_SCRIPT_NAME);
        viewRoot.getChildren().add(resource);
    }
View Full Code Here

        FaceletFactory.setInstance(factory);

        FaceletFactory f = FaceletFactory.getInstance();
        Facelet at = f.getFacelet(viewId);
        UIViewRoot root = facesContext.getViewRoot();

        root.setViewId(viewId);
        at.apply(facesContext, root);
    }
View Full Code Here

     * @param writer
     * @throws IOException
     */
    public void encodeEndForm(FacesContext context, ResponseWriter writer) throws IOException {

        UIViewRoot viewRoot = context.getViewRoot();
        for (UIComponent resource : viewRoot.getComponentResources(context, "form")) {
            resource.encodeAll(context);
        }

        writeState(context);
        writer.endElement(HtmlConstants.FORM_ELEMENT);
View Full Code Here

        writer.writeAttribute("href", ResourceUtils.getResourceURL(context, path), null);
        writer.endElement("link");
        }
       
        //Resources
        UIViewRoot viewRoot = context.getViewRoot();
        ListIterator<UIComponent> iter = (viewRoot.getComponentResources(context, "head")).listIterator();
        while (iter.hasNext()) {
            UIComponent resource = (UIComponent)iter.next();
            resource.encodeAll(context);
        }
    }
View Full Code Here

                listener);

        FaceletFactory f = FaceletFactory.getInstance();
        Facelet at = f.getFacelet("actionListener.xml");

        UIViewRoot root = faces.getViewRoot();
        at.apply(faces, root);

        UICommand action1 = (UICommand) root.findComponent("action1");
        UICommand action2 = (UICommand) root.findComponent("action2");

        assertNotNull("action1", action1);
        assertNotNull("action2", action2);

        assertEquals("action1 listeners", 1,
View Full Code Here

        faces.getExternalContext().getRequestMap().put("title", title);

        FaceletFactory f = FaceletFactory.getInstance();
        Facelet at = f.getFacelet("attribute.xml");

        UIViewRoot root = faces.getViewRoot();
        at.apply(faces, root);

        HtmlGraphicImage graphic1 = (HtmlGraphicImage) root
                .findComponent("graphic1");
        HtmlGraphicImage graphic2 = (HtmlGraphicImage) root
                .findComponent("graphic2");

        assertNotNull("graphic1", graphic1);
        assertNotNull("graphic2", graphic2);
View Full Code Here

        faces.getExternalContext().getRequestMap().put("now", now);

        FaceletFactory f = FaceletFactory.getInstance();
        Facelet at = f.getFacelet("convertDateTime.xml");

        UIViewRoot root = faces.getViewRoot();
        at.apply(faces, root);

        UIOutput out1 = (UIOutput) root.findComponent("form:out1");
        UIOutput out2 = (UIOutput) root.findComponent("form:out2");
        UIOutput out3 = (UIOutput) root.findComponent("form:out3");
        UIOutput out4 = (UIOutput) root.findComponent("form:out4");
        UIOutput out5 = (UIOutput) root.findComponent("form:out5");
        UIOutput out6 = (UIOutput) root.findComponent("form:out6");

        assertNotNull("out1", out1);
        assertNotNull("out2", out2);
        assertNotNull("out3", out3);
        assertNotNull("out4", out4);
View Full Code Here

TOP

Related Classes of javax.faces.component.UIViewRoot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.