Examples of HtmlCanvas


Examples of org.rendersnake.HtmlCanvas

    /**
     * Return the HTML snippet to replace the reference in a template
     */
    public String toString(Object o) {
        RenderableAttribute cc = (RenderableAttribute)o;
        HtmlCanvas attributeCanvas = cc.getCanvas();
        HtmlCanvas localCanvas = attributeCanvas.createLocalCanvas();
        localCanvas.getPageContext().attributes = attributeCanvas.getPageContext().attributes;
        try {
            cc.getComponent().renderOn(localCanvas);
        } catch (IOException e) {
            return "RenderableAttributeRenderer-ERROR:" + e.getMessage();
        }
        return localCanvas.toHtml();
    }
View Full Code Here

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

Examples of org.rendersnake.HtmlCanvas

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

Examples of org.rendersnake.HtmlCanvas

        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

Examples of org.rendersnake.HtmlCanvas

        assertNull(page);
    }

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

    }
View Full Code Here

Examples of org.rendersnake.HtmlCanvas

public class GeneratedHtmlCanvasTest extends TestCase {

    private HtmlCanvas html;

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

Examples of org.rendersnake.HtmlCanvas

        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

Examples of org.rendersnake.HtmlCanvas

    }

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

Examples of org.rendersnake.HtmlCanvas

    /* (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

Examples of org.rendersnake.HtmlCanvas

    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
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.