Package org.rendersnake

Examples of org.rendersnake.Renderable


        if (exception != null) {
            // general error
            html.write(String.format("[Render Error] general exception [%s]", exception.getMessage()));
        }
        // if debugging, the error component is available
        Renderable errorComponent = (Renderable)(html.getPageContext().get("renderable.error"));
        if (errorComponent != null) {
            html.write(" in ").write(errorComponent.getClass().getName());
        } else {
            html.a(href("?inspect")).write(" Inspect details")._a();
            this.renderStackTraceOn(html);
        }
        html._div();
View Full Code Here


        String uri = "";
        String info = req.getPathInfo();
        if (null != info && info.length() > 0) {
            uri = info.substring(1);           
        }
        Renderable component = this.dispatchMap.get(uri);
        if (component == null) {
            resp.sendError(404);
        } else {
            HtmlServletCanvas canvas = new HtmlServletCanvas(req, resp, resp.getWriter());
            this.copyParametersIntoPageContext(req, canvas);
View Full Code Here

        for (Key<?> key : injector.getBindings().keySet()) {
            Type type = key.getTypeLiteral().getType();
            if (type instanceof Class<?>) {
                Class<?> klass = (Class<?>) type;
                if (Renderable.class.isAssignableFrom(klass)) {
                    Renderable p = (Renderable)injector.getInstance(klass);
                    Named annotation = klass.getAnnotation(Named.class);
                    if (annotation != null) {
                        dispatchMap.put(annotation.value(), p);
                        LOG.info("Binding component:"+klass+" to:" + annotation);
                    } else {
View Full Code Here

     * @param html
     * @return
     * @throws IOException
     */
    private Renderable renderContentOn(final HtmlCanvas html) throws IOException {
        return new Renderable() {

            public void renderOn(HtmlCanvas html) throws IOException {
               
                html.h1().write("Minimal")._h1();
                html.write(StringResource.get("content/Example-minimal.html"),false);
View Full Code Here

     * @param html
     * @return
     * @throws IOException
     */
    private Renderable renderContentOn(final HtmlCanvas html) throws IOException {
        return new Renderable() {

            public void renderOn(HtmlCanvas html) throws IOException {
                html.write(StringResource.get("content/Tutorial.html"),false);
            }
           
View Full Code Here

     * @param html
     * @return
     * @throws IOException
     */
    private Renderable renderContentOn(final HtmlCanvas html) throws IOException {
        return new Renderable() {

            public void renderOn(HtmlCanvas html) throws IOException {
                html
                .render(StringResource.valueOf("content/DevGuide.html"))
                .render(StringResource.valueOf("content/guides/canvas.html"))
View Full Code Here

            ._div()
        ._body()
        ._html();
    }
    private Renderable renderContentOn(HtmlCanvas html) {
        return new Renderable() {
           
            public void renderOn(HtmlCanvas html) throws IOException {
               
                html
                    .div()
View Full Code Here

     * @param html
     * @return
     * @throws IOException
     */
    private Renderable renderContentOn(final HtmlCanvas html) throws IOException {
        return new Renderable() {

            public void renderOn(HtmlCanvas html) throws IOException {
               
                html
                    .h3().content("JQuery")
View Full Code Here

    }

    public void testRenderableFound() {
        MockHttpRequest request = new MockHttpRequest();
        request.pathInfo = "/org.rendersnake.test.PersonalPage";
        Renderable comp = resolver.renderComponentForRequest(request);
        assertTrue(comp.getClass() == PersonalPage.class);
    }
View Full Code Here

    }

    public void testRenderableNotFound() {
        MockHttpRequest request = new MockHttpRequest();
        request.pathInfo = "/org.rendersnake.test.MissingPage";
        Renderable comp = resolver.renderComponentForRequest(request);
        assertNull(comp);
    }
View Full Code Here

TOP

Related Classes of org.rendersnake.Renderable

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.