Package org.rendersnake

Examples of org.rendersnake.HtmlCanvas


import org.rendersnake.tools.PrettyWriter;

public class SidebarTest extends TestCase {
    public void testRender() throws IOException {
        Sidebar sb = new Sidebar();
        HtmlCanvas html = new HtmlServletCanvas(null,null,new PrettyWriter());
        html.render(sb);
        System.out.println(html.toHtml());
    }
View Full Code Here


import org.rendersnake.tools.PrettyWriter;

public class HeadTest extends TestCase {
    public void testRender() throws IOException {
        Head head = new Head();
        HtmlCanvas html = new HtmlServletCanvas(null,null,new PrettyWriter());
        html.render(head);
        System.out.println(html.toHtml());
    }
View Full Code Here

import org.rendersnake.tools.PrettyWriter;

public class IconImageTest extends TestCase {
    public void testRender() throws IOException {
        IconImage icon = new IconImage("tooltip").alt("happy");
        HtmlCanvas html = new HtmlServletCanvas(null,null,new PrettyWriter());
        html.render(icon);
        System.out.println(html.toHtml());
    }   
View Full Code Here

public class ContentTest extends TestCase {

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

import org.rendersnake.tools.PrettyWriter;

public class FooterTest extends TestCase {
    public void testRender() throws IOException {
        Footer ui = new Footer();
        HtmlCanvas html = new HtmlServletCanvas(null,null,new PrettyWriter());
        html.render(ui);
        System.out.println(html.toHtml());
    }
View Full Code Here

    private RequestToComponentResolver resolver = new QualifiedClassNameResolver();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        HtmlCanvas html = HtmlCanvasFactory.createCanvas(request, response, response.getWriter());
        Renderable component = resolver.renderComponentForRequest(request);
        if (component == null) {
            component = new MissingComponentError(resolver);  
        }
        try {
            html.render(component);
        } catch (RenderException rex) { 
            LOG.log(Level.SEVERE,"[renderSnake render failure]",rex);
            html.render(rex);
        } catch (Exception ex) {
            LOG.log(Level.SEVERE,"[renderSnake render failure]",ex);
            html.render(RenderException.caught(ex));
        }
    }
View Full Code Here

        response.setContentType("text/html");
        try {
            this.safeHandle(request, response);
        } catch (Exception ex) {           
            LOG.log(Level.SEVERE,"[renderSnake form validate|handle failure]",ex);
            final HtmlCanvas html = new HtmlServletCanvas(request, response, response.getWriter());
            html.render(RenderException.caught(ex));
        }
    }
View Full Code Here

    private String who;
    @Test
    public void test() throws Exception {
       
        Callback call = this.helpClicked();
        HtmlCanvas html = new HtmlCanvas();
        html.getPageContext().withString("who","me");
        call.respondOn(html);
        Assert.assertEquals("me", who);
       
        //html.a(onClick(this.helpClicked()));
    }
View Full Code Here

public class FancyHeaderTest {
    @Test
    public void test() throws Exception {
       
        HtmlCanvas html = new HtmlCanvas();
        html
            .render(new FancyHeader.Before())
            .write("Hello")
            .render(new FancyHeader.After());
       
        System.out.println(html.toHtml());
    }
View Full Code Here

        FileUtils.copyDirectory(new File("src/main/webapp/htdocs"), new File(home + "/htdocs"));
    }

    private static void generate(String home, Renderable page, String uri) throws IOException {
        FileWriter fw = new FileWriter(home + "/" + uri);
        new HtmlCanvas(fw).render(page);
        fw.close();
        System.out.println("[generator] wrote " + uri + " size:" + new File(home + "/" + uri).length());
    }
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.