Package com.sun.facelets

Examples of com.sun.facelets.Facelet


import com.sun.facelets.util.FastWriter;

public class RepeatTestCase extends FaceletTestCase {

    public void testRepeat() throws Exception {
        Facelet f = FaceletFactory.getInstance().getFacelet("repeat.xml");
        FacesContext faces = FacesContext.getCurrentInstance();
       
        Company c = Example.createCompany();
        faces.getExternalContext().getRequestMap().put("company", c);
       
        UIViewRoot root = faces.getViewRoot();
        f.apply(faces, root);
       
        FastWriter fw = new FastWriter();
        ResponseWriter rw = faces.getResponseWriter();
        rw = rw.cloneWithWriter(fw);
        faces.setResponseWriter(rw);
View Full Code Here


      {
         try
         {
            FacesContext facesContext = FacesContext.getCurrentInstance();
            URL url = SeamDebugPhaseListener.class.getClassLoader().getResource("META-INF/debug.xhtml");
            Facelet f = new DefaultFaceletFactory( new SAXCompiler(), new DefaultResourceResolver() ).getFacelet(url);
            UIViewRoot viewRoot = facesContext.getViewRoot();
            f.apply(facesContext, viewRoot);
            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
            response.setCharacterEncoding("UTF-8");
            response.setContentType("text/html; UTF-8");
            ResponseWriter originalWriter = facesContext.getRenderKit().createResponseWriter( response.getWriter(), "text/html", "UTF-8" );
            StateWriterControl.initialize(originalWriter);
View Full Code Here

      if ( viewId!=null && viewId.startsWith("/debug.") && Init.instance().isDebug() )
      {
         try
         {
            URL url = SeamDebugPhaseListener.class.getClassLoader().getResource("META-INF/debug.xhtml");
            Facelet f = new DefaultFaceletFactory( new SAXCompiler(), new DefaultResourceResolver() ).getFacelet(url);
            UIViewRoot root = facesContext.getViewRoot();
            f.apply(facesContext, root);
            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
            response.setContentType("text/html");
            ResponseWriter writer = facesContext.getRenderKit().createResponseWriter( response.getWriter(), "text/html", "UTF-8" );
            facesContext.setResponseWriter(writer);
            //root.renderAll();
View Full Code Here

    private UIComponent target;

    public void testSelectOneMenu() throws Exception {
        this.servletRequest.setAttribute("test", this);

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

        FacesContext faces = FacesContext.getCurrentInstance();

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

        FastWriter fw = new FastWriter();
        ResponseWriter rw = faces.getResponseWriter();
        rw = rw.cloneWithWriter(fw);
        faces.setResponseWriter(rw);
View Full Code Here

    private UIComponent target;

    public void testSelectOneMenu() throws Exception {
        this.servletRequest.setAttribute("test", this);

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

        FacesContext faces = FacesContext.getCurrentInstance();

        UIViewRoot root = faces.getViewRoot();
        f.apply(faces, root);
       
        assertNotNull("target binding", target);
        assertEquals("children", 2, this.target.getChildCount());

        FastWriter fw = new FastWriter();
View Full Code Here

    }
   
    public void testPanelGrid() throws Exception {
        this.servletRequest.setAttribute("test", this);

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

        FacesContext faces = FacesContext.getCurrentInstance();

        UIViewRoot root = faces.getViewRoot();
        f.apply(faces, root);
       
        assertNotNull("target binding", target);
        assertEquals("children", 3, this.target.getChildCount());

        FastWriter fw = new FastWriter();
View Full Code Here

    }
    session.put("list", c);


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

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

    int count = root.getChildCount();
    assertTrue(count == 1);

    UIComponent dataTable = root.getChildren().get(0);
View Full Code Here

  protected void buildView(String viewId) throws IOException {
    FaceletFactory factory = new DefaultFaceletFactory(compiler, createResourceResolver());
    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

      {
         try
         {
            FacesContext facesContext = FacesContext.getCurrentInstance();
            URL url = SeamDebugPhaseListener.class.getClassLoader().getResource("META-INF/debug.xhtml");
            Facelet f = new DefaultFaceletFactory( new SAXCompiler(), new DefaultResourceResolver() ).getFacelet(url);
            UIViewRoot root = facesContext.getViewRoot();
            f.apply(facesContext, root);
            HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
            response.setCharacterEncoding("UTF-8");
            response.setContentType("text/html; UTF-8");
            ResponseWriter writer = facesContext.getRenderKit().createResponseWriter( response.getWriter(), "text/html", "UTF-8" );
            facesContext.setResponseWriter(writer);
View Full Code Here

    public void testClientClient() throws Exception {
        FaceletFactory ff = FaceletFactory.getInstance();
        FacesContext faces = FacesContext.getCurrentInstance();
       
        Facelet f = ff.getFacelet("test-tags.xml");
       
        this.servletRequest.setAttribute("test", "foo");
       
        UIViewRoot root = faces.getViewRoot();
        f.apply(faces, root);
       
        FastWriter fw = new FastWriter();
        MockResponseWriter mrw = new MockResponseWriter(fw);
        faces.setResponseWriter(mrw);
        root.encodeAll(faces);
View Full Code Here

TOP

Related Classes of com.sun.facelets.Facelet

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.