Experience some type of Renderers

    • This text is created by snippet.(1)
    • This text is created by snippet.(2)
    • This text is created by snippet.(3)
/templates/renderertypes.html
<section>
	<article>
		<afd:snippet render="ComplicatedSnippet">
			<ul id="childreplacer">
				<li>This is dummy list.</li>
				<li>This is dummy list.</li>
			</ul>
			<ul id="clearnode">
				<p>This is dummy text.</p>
			</ul>
		</afd:snippet>
	</article>
</section>
/snippet/ComplicatedSnippet.java
public Renderer render() {
    // a renderer which does nothing
    Renderer render = Renderer.create();

    // replace all the children nodes of the corresponding node by selector
    render.add("ul#childreplacer", new ChildReplacer(createElement()));

    // remove a node
    render.add("ul#clearnode", Clear);

    // output the whole html string of current node to log console
    render.addDebugger("current element");

    return render;
}

private Element createElement() {
    Element ul = new Element(Tag.valueOf("ul"), "");
    ul.appendChild(new Element(Tag.valueOf("li"), "").appendText("This text is created by snippet.(1)"));
    ul.appendChild(new Element(Tag.valueOf("li"), "").appendText("This text is created by snippet.(2)"));
    ul.appendChild(new Element(Tag.valueOf("li"), "").appendText("This text is created by snippet.(3)"));
    return ul;
}