Package org.apache.tiles.evaluator

Examples of org.apache.tiles.evaluator.AttributeEvaluator


        RendererFactory rendererFactory =
            (RendererFactory) createFactory(configuration,
                RENDERER_FACTORY_INIT_PARAM);

        AttributeEvaluator evaluator = (AttributeEvaluator) createFactory(
                configuration, ATTRIBUTE_EVALUATOR_INIT_PARAM);

        if (evaluator instanceof TilesApplicationContextAware) {
            ((TilesApplicationContextAware) evaluator)
                    .setApplicationContext(context);
        }

        if (evaluator instanceof TilesContainerAware) {
            ((TilesContainerAware) evaluator).setContainer(container);
        }

        evaluator.init(configuration);

        if (rendererFactory instanceof TilesRequestContextFactoryAware) {
            ((TilesRequestContextFactoryAware) rendererFactory)
                    .setRequestContextFactory(requestContextFactory);
        }
View Full Code Here


        container.setApplicationContext(applicationContext);
        LocaleResolver resolver = createLocaleResolver(applicationContext,
                requestContextFactory);
        container.setDefinitionsFactory(createDefinitionsFactory(applicationContext,
                requestContextFactory, resolver));
        AttributeEvaluator evaluator = createEvaluator(applicationContext,
                requestContextFactory, resolver);
        container.setEvaluator(evaluator);
        container.setPreparerFactory(createPreparerFactory(applicationContext,
                requestContextFactory));
        container.setRendererFactory(createRendererFactory(applicationContext,
View Full Code Here

    }

    @Override
    protected AttributeEvaluatorFactory createAttributeEvaluatorFactory(TilesApplicationContext applicationContext,
        TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
      AttributeEvaluator evaluator;
      if (tilesElPresent && JspFactory.getDefaultFactory() != null) {
        evaluator = TilesElActivator.createEvaluator(applicationContext);
      }
      else {
        evaluator = new DirectAttributeEvaluator();
View Full Code Here

    }

    @Override
    protected AttributeEvaluatorFactory createAttributeEvaluatorFactory(ApplicationContext context,
        LocaleResolver resolver) {
      AttributeEvaluator evaluator;
      if (tilesElPresent && JspFactory.getDefaultFactory() != null) {
        evaluator = new TilesElActivator().createEvaluator();
      }
      else {
        evaluator = new DirectAttributeEvaluator();
View Full Code Here

        RendererFactory rendererFactory =
            (RendererFactory) createFactory(configuration,
                RENDERER_FACTORY_INIT_PARAM);

        AttributeEvaluator evaluator = (AttributeEvaluator) createFactory(
                configuration, ATTRIBUTE_EVALUATOR_INIT_PARAM);
        AttributeEvaluatorFactory attributeEvaluatorFactory = new BasicAttributeEvaluatorFactory(
                evaluator);

        if (evaluator instanceof TilesApplicationContextAware) {
            ((TilesApplicationContextAware) evaluator)
                    .setApplicationContext(context);
        }

        if (evaluator instanceof TilesContainerAware) {
            ((TilesContainerAware) evaluator).setContainer(container);
        }

        evaluator.init(configuration);

        if (rendererFactory instanceof TilesRequestContextFactoryAware) {
            ((TilesRequestContextFactoryAware) rendererFactory)
                    .setRequestContextFactory(requestContextFactory);
        }
View Full Code Here

     * .
     */
    @Test
    public void testIsRenderable() {
        AttributeEvaluatorFactory evaluatorFactory = createMock(AttributeEvaluatorFactory.class);
        AttributeEvaluator evaluator = createMock(AttributeEvaluator.class);
        TilesRequestContext request = createMock(TilesRequestContext.class);
        Attribute attribute = new Attribute("value", new Expression(
                "expression"), "role", "rendererName");

        expect(evaluatorFactory.getAttributeEvaluator(attribute)).andReturn(evaluator);
        expect(evaluator.evaluate(attribute, request)).andReturn("myValue");

        replay(evaluatorFactory, evaluator, request);

        AbstractTypeDetectingAttributeRenderer renderer = new AbstractTypeDetectingAttributeRenderer() {

View Full Code Here

public abstract class AbstractTypeDetectingAttributeRenderer extends
        AbstractBaseAttributeRenderer implements TypeDetectingAttributeRenderer {

    /** {@inheritDoc} */
    public boolean isRenderable(Attribute attribute, TilesRequestContext request) {
        AttributeEvaluator evaluator = attributeEvaluatorFactory
                .getAttributeEvaluator(attribute);
        Object value = evaluator.evaluate(attribute, request);
        return isRenderable(value, attribute, request);
    }
View Full Code Here

                        + attribute.getRoles() + "'");
            }
            return;
        }

        AttributeEvaluator evaluator = attributeEvaluatorFactory
                .getAttributeEvaluator(attribute);
        Object value = evaluator.evaluate(attribute, request);

        write(value, attribute, request);
    }
View Full Code Here

    /** {@inheritDoc} */
    public Object evaluate(Attribute attribute, Object... requestItems) {
        TilesRequestContext request = getRequestContextFactory()
                .createRequestContext(context, requestItems);
        AttributeEvaluator evaluator = attributeEvaluatorFactory
                .getAttributeEvaluator(attribute);
        return evaluator.evaluate(attribute, request);
    }
View Full Code Here

        }
    }

    /** {@inheritDoc} */
    public Object evaluate(Attribute attribute, Request request) {
        AttributeEvaluator evaluator = attributeEvaluatorFactory
                .getAttributeEvaluator(attribute);
        return evaluator.evaluate(attribute, request);
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.evaluator.AttributeEvaluator

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.