Examples of PrettyWriter


Examples of org.rendersnake.tools.PrettyWriter

import org.rendersnake.tools.PrettyWriter;

public class PrettyWriterTest extends TestCase {

    public void testIndent() throws IOException {
        PrettyWriter pw = new PrettyWriter();
        StringWriter sw = new StringWriter();
        pw.writer = sw;
        pw.write("<tag>");
            pw.write("<kid>");
                pw.write("<empty/>");
                pw.write("<leaf");
                pw.write(" level=\"");
                pw.write("1\" class=\"green\">");
                pw.write("hello");
                pw.write("</leaf>");
            pw.write("</kid>");       
            pw.write("<empty/>");
        pw.write("</tag>");
        pw.write(".");
        pw.flush();
        pw.close();
        System.out.println(sw);       
    }
View Full Code Here

Examples of org.rendersnake.tools.PrettyWriter

        pw.close();
        System.out.println(sw);       
    }
   
    public void testString() throws IOException {
        PrettyWriter pw = new PrettyWriter();
        StringWriter sw = new StringWriter();
        pw.writer = sw;
        pw.write("<tag>");
        pw.write("content");
        pw.write("</tag>");
        assertEquals("<tag>\ncontent</tag>\n", sw.toString());
    }
View Full Code Here

Examples of org.rendersnake.tools.PrettyWriter

        pw.write("content");
        pw.write("</tag>");
        assertEquals("<tag>\ncontent</tag>\n", sw.toString());
    }
    public void testString1() throws IOException {
        PrettyWriter pw = new PrettyWriter(new StringWriter());
        pw.write("<tag");
        pw.write(" a=\"");
        pw.write("b\"/>");
        assertEquals("<tag a=\"b\"/>", pw.toString());
    }   
View Full Code Here

Examples of org.rendersnake.tools.PrettyWriter

public class HtmlBufferingCanvasTest extends TestCase {

    public void test() throws Exception {
        HtmlBufferingCanvas buf = new HtmlBufferingCanvas(null,null,new StringWriter(1024));
        buf.out = new PrettyWriter(buf.out);
       
        // add something to the head
        buf.headAttributes().add("some", "hot");
        buf.headElements().add(Script.external("loaded-in-top-head.js"));
View Full Code Here

Examples of org.rendersnake.tools.PrettyWriter

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

Examples of org.rendersnake.tools.PrettyWriter

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

Examples of org.rendersnake.tools.PrettyWriter

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

Examples of org.rendersnake.tools.PrettyWriter

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

Examples of org.rendersnake.tools.PrettyWriter

    public void testRender() throws IOException {
        MockHttpRequest req = new MockHttpRequest();
        req.pathInfo = "site/examples.html";
       
        IndexPage index = new IndexPage();
        DebugHtmlCanvas html = new DebugHtmlCanvas(req,null,new PrettyWriter(new StringWriter()));
        html.enabled = false;
        html.render(index);
       
        System.out.println(html.toHtml());
    }
View Full Code Here

Examples of org.rendersnake.tools.PrettyWriter

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
TOP
Copyright © 2018 www.massapi.com. 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.