Package org.rendersnake

Examples of org.rendersnake.HtmlCanvas


     * Answer a pretty formatted HTML output for a Renderable component.
     * @param component
     * @return
     */
    public static String toString(Renderable component) {
        HtmlCanvas html = new HtmlCanvas(new PrettyWriter());
        try {
            component.renderOn(html);
        } catch (Exception ex){
            throw new RuntimeException("Error writing HTML for component:" + component);
        }
        return html.toHtml();
    }
View Full Code Here


import org.rendersnake.test.components.PersonUI;

public class StringTemplateTest extends TestCase {

    public void testTemplate() throws IOException {
        HtmlCanvas html = new HtmlCanvas();
        html.getPageContext().set("timestamp", new Date().toString());
        html.render(StringTemplate.get("templates/wrapper.html"));
        System.out.println(html.toHtml());
    }   
View Full Code Here

        html.render(StringTemplate.get("templates/wrapper.html"));
        System.out.println(html.toHtml());
    }   
   
    public void testTemplateWithRenderable() throws IOException {
        HtmlCanvas html = new HtmlCanvas();
       
        html.getPageContext().set("timestamp", new Date().toString());
       
        PersonUI ui = new PersonUI(new Person());
        html.getPageContext().set("person", new RenderableAttribute(html,ui));
       
        html.render(StringTemplate.get("templates/wrapper.html"));
        System.out.println(html.toHtml());
    }        
View Full Code Here

        assertNull(page);
    }

    public void testRender() throws IOException {
        URIMappingResolver res = new URIMappingResolver();
        res.renderOn(new HtmlCanvas());

    }
View Full Code Here

public class GeneratedHtmlCanvasTest extends TestCase {

    private HtmlCanvas html;

    public void setUp() {
        html = new HtmlCanvas();
    }
View Full Code Here

        return false;
    }
    @Override
    public String toString() {
        try {
            return new HtmlCanvas().render(this).toHtml();
        } catch (Exception ex) {
            return "*** error in Link>>toString() ***";
        }
    }   
View Full Code Here

    }

    @Override
    public String toString() {
        try {
            return new HtmlCanvas().render(this).toHtml();
        } catch (Exception ex) {
            return "*** error in Script>>toString() ***";
        }
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.springframework.web.servlet.View#render(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response) throws Exception {

        HtmlCanvas html = HtmlCanvasFactory.createCanvas(request, response, response.getWriter());
        html.getPageContext().attributes.putAll(model);
        html.render(component);
    }
View Full Code Here

    if (methodParameter.getParameterType() != HtmlCanvas.class)
      return UNRESOLVED;
   
    HttpServletRequest request = (HttpServletRequest)(webRequest.getNativeRequest());
    HttpServletResponse response = (HttpServletResponse)(webRequest.getNativeResponse());
        HtmlCanvas canvas = HtmlCanvasFactory.createCanvas(request,response,response.getWriter());
        PageContext context = canvas.getPageContext();
       
        boolean empty = true;
    if (this.shareSessionAttributes) {
        HttpSession session = request.getSession(false);
        if (session != null) {           
View Full Code Here

import org.rendersnake.tools.PrettyWriter;

public class MenuBarTest extends TestCase {
    public void testRender() throws IOException {
        MenuBar mb = new MenuBar("examples.html");
        HtmlCanvas html = new HtmlServletCanvas(null,null,new PrettyWriter());
        html.render(mb);
        System.out.println(html.toHtml());
    }
View Full Code Here

TOP

Related Classes of org.rendersnake.HtmlCanvas

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.