Package org.apache.tiles.renderer

Examples of org.apache.tiles.renderer.AttributeRenderer


        throws IOException {
        if (attr == null) {
            throw new CannotRenderException("Cannot render a null attribute");
        }

        AttributeRenderer renderer = rendererFactory.getRenderer(attr
                .getRenderer());
        if (renderer == null) {
            throw new CannotRenderException(
                    "Cannot render an attribute with renderer name "
                            + attr.getRenderer());
        }
        renderer.render(attr, writer, requestItems);
    }
View Full Code Here


        RendererFactory rendererFactory = factory.createRendererFactory(
                context, applicationContext, contextFactory, container,
                evaluator);
        assertTrue("The class of the renderer factory is not correct",
                rendererFactory instanceof BasicRendererFactory);
        AttributeRenderer renderer = rendererFactory.getRenderer("string");
        assertNotNull("The string renderer is null", renderer);
        assertTrue("The string renderer class is not correct",
                renderer instanceof StringAttributeRenderer);
        renderer = rendererFactory.getRenderer("template");
        assertNotNull("The template renderer is null", renderer);
View Full Code Here

                .createApplicationContext(context);
        LocaleResolver resolver = factory.createLocaleResolver(context,
                applicationContext, contextFactory);
        AttributeEvaluator evaluator = factory.createEvaluator(context,
                applicationContext, contextFactory, resolver);
        AttributeRenderer renderer = factory.createDefaultAttributeRenderer(
                context, applicationContext, contextFactory, container,
                evaluator);
        assertTrue("The default renderer class is not correct",
                renderer instanceof UntypedAttributeRenderer);
    }
View Full Code Here

            throws IOException {
        if (attr == null) {
            throw new CannotRenderException("Cannot render a null attribute");
        }

        AttributeRenderer renderer = rendererFactory.getRenderer(attr
                .getRenderer());
        if (renderer == null) {
            throw new CannotRenderException(
                    "Cannot render an attribute with renderer name "
                            + attr.getRenderer());
        }
        renderer.render(attr, requestContext);
    }
View Full Code Here

        Map<String, String> params = new HashMap<String, String>();
        params.put(BasicRendererFactory.TYPE_RENDERERS_INIT_PARAM, "test,"
                + StringAttributeRenderer.class.getName() + ";test2,"
                + StringAttributeRenderer.class.getName());
        rendererFactory.init(params);
        AttributeRenderer renderer = rendererFactory.getRenderer("string");
        assertNotNull("The renderer is null", renderer);
        assertTrue("The class of the renderer is wrong", renderer instanceof StringAttributeRenderer);
        renderer = rendererFactory.getRenderer("test");
        assertNotNull("The renderer is null", renderer);
        assertTrue("The class of the renderer is wrong", renderer instanceof StringAttributeRenderer);
View Full Code Here

                completeParams.put(pair[0], pair[1]);
            }
        }

        for (Map.Entry<String, String> entry : completeParams.entrySet()) {
            AttributeRenderer renderer = (AttributeRenderer) ClassUtil
                    .instantiate(entry.getValue());
            initializeRenderer(renderer);
            renderers.put(entry.getKey(), renderer);
        }
    }
View Full Code Here

        }
    }

    /** {@inheritDoc} */
    public AttributeRenderer getRenderer(String name) {
        AttributeRenderer retValue;
        if (name != null) {
            retValue = renderers.get(name);
            if (retValue == null) {
                retValue = (AttributeRenderer) ClassUtil.instantiate(name);
                initializeRenderer(retValue);
View Full Code Here

        TilesApplicationContext applicationContext = createMock(TilesApplicationContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        TilesRequestContextFactory requestContextFactory = createMock(TilesRequestContextFactory.class);
        AttributeEvaluatorFactory attributeEvaluatorFactory = createMock(AttributeEvaluatorFactory.class);
        BasicRendererFactory rendererFactory = createMock(BasicRendererFactory.class);
        AttributeRenderer stringRenderer = createMock(TypeDetectingAttributeRenderer.class);
        AttributeRenderer templateRenderer = createMock(TypeDetectingAttributeRenderer.class);
        AttributeRenderer definitionRenderer = createMock(TypeDetectingAttributeRenderer.class);
        AttributeRenderer velocityRenderer = createMock(TypeDetectingAttributeRenderer.class);
        AttributeRenderer freemarkerRenderer = createMock(TypeDetectingAttributeRenderer.class);

        expect(rendererFactory.getRenderer("string")).andReturn(stringRenderer);
        expect(rendererFactory.getRenderer("template")).andReturn(templateRenderer);
        expect(rendererFactory.getRenderer("definition")).andReturn(definitionRenderer);
        expect(rendererFactory.getRenderer("velocity")).andReturn(velocityRenderer);
        expect(rendererFactory.getRenderer("freemarker")).andReturn(freemarkerRenderer);

        replay(container, requestContextFactory, attributeEvaluatorFactory,
                rendererFactory, applicationContext);
        AttributeRenderer renderer = factory.createDefaultAttributeRenderer(
                rendererFactory, applicationContext, requestContextFactory,
                container, attributeEvaluatorFactory);
        assertTrue("The default renderer class is not correct",
                renderer instanceof ChainedDelegateAttributeRenderer);
        verify(container, requestContextFactory, attributeEvaluatorFactory,
View Full Code Here

                requestContextFactory, resolver);
        RendererFactory rendererFactory = factory.createRendererFactory(
                applicationContext, requestContextFactory, container, evaluator);
        assertTrue("The class of the renderer factory is not correct",
                rendererFactory instanceof BasicRendererFactory);
        AttributeRenderer renderer = rendererFactory.getRenderer("string");
        assertNotNull("The string renderer is null", renderer);
        assertTrue("The string renderer class is not correct",
                renderer instanceof StringAttributeRenderer);
        renderer = rendererFactory.getRenderer("template");
        assertNotNull("The template renderer is null", renderer);
View Full Code Here

                .createRequestContextFactory(applicationContext);
        LocaleResolver resolver = factory.createLocaleResolver(applicationContext,
                requestContextFactory);
        AttributeEvaluator evaluator = factory.createEvaluator(applicationContext,
                requestContextFactory, resolver);
        AttributeRenderer renderer = factory.createDefaultAttributeRenderer(
                applicationContext, requestContextFactory, container, evaluator);
        assertTrue("The default renderer class is not correct",
                renderer instanceof UntypedAttributeRenderer);
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.renderer.AttributeRenderer

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.