Package org.apache.tiles

Examples of org.apache.tiles.Attribute


            assertNotNull("Definitions not returned.", definitions);
            Definition def = definitions.get("doc.cascaded.test");

            assertNotNull("Couldn't find doc.role.test tile.", def);
            Attribute attribute = def.getLocalAttribute("title");
            assertNotNull("Couldn't Find title local attribute.", attribute);
            attribute = def.getCascadedAttribute("title2");
            assertNotNull("Couldn't Find title2 cascaded attribute.", attribute);
            attribute = def.getLocalAttribute("items1");
            assertNotNull("Couldn't Find items1 local attribute.", attribute);
View Full Code Here


     * Tests
     * {@link DirectAttributeEvaluator#evaluate(Attribute, org.apache.tiles.context.TilesRequestContext)}.
     */
    public void testEvaluate() {
        String expression = "This is an expression";
        Attribute attribute = new Attribute(expression);
        Object result = evaluator.evaluate(attribute, null);
        assertEquals("The expression has not been evaluated correctly", result,
                expression);
        expression = "${attributeName}";
        attribute.setValue(expression);
        result = evaluator.evaluate(attribute, null);
        assertEquals("The expression has not been evaluated correctly", result,
                expression);
    }
View Full Code Here

                        + "Attribute with null key found.");
            } else if (name == null) {
                continue;
            }

            Attribute attr = attributeContext.getAttribute(name);

            if (attr != null) {
                try {
                    Object attributeValue = container.evaluate(attr, pageContext);
                    if (attributeValue == null) {
View Full Code Here

     * tags.
     *
     * @param nestedTag the put tag desciendent.
     */
    public void processNestedTag(AddAttributeTag nestedTag) {
        Attribute attribute = new Attribute(nestedTag.getValue(), nestedTag
                .getRole(), nestedTag.getType());

        this.addValue(attribute);
    }
View Full Code Here

     * tags.
     *
     * @param nestedTag the put tag desciendent.
     */
    public void processNestedTag(AddAttributeTag nestedTag) {
        Attribute attribute = new Attribute(nestedTag.getValue(), nestedTag
                .getRole(), nestedTag.getType());

        this.addValue(attribute);
    }
View Full Code Here

     * </p>
     *
     * @param nestedTag the put tag desciendent.
     */
    public void processNestedTag(PutAttributeTag nestedTag) {
        Attribute attribute = new Attribute(
            nestedTag.getValue(), nestedTag.getRole(),
            nestedTag.getType());

        attributeContext.putAttribute(nestedTag.getName(), attribute, nestedTag
                .isCascade());
View Full Code Here

     */
    class DefaultMutator implements AttributeContextMutator {

        /** {@inheritDoc} */
        public void mutate(AttributeContext ctx, ServletRequest req) {
            Attribute attr = new Attribute();
            attr.setRenderer("template");
            attr.setValue(getRequestBase(req));
            ctx.putAttribute(definitionAttributeName, attr);
        }
View Full Code Here

        nudef.setPreparer(replace(d.getPreparer(), vars));
        nudef.setRole(replace(d.getRole(), vars));
        nudef.setTemplate(replace(d.getTemplate(), vars));

        for (String attributeName : d.getLocalAttributeNames()) {
            Attribute attr = d.getLocalAttribute(attributeName);
            Attribute nuattr = new Attribute();

            nuattr.setRole(replace(attr.getRole(), vars));
            nuattr.setRenderer(attr.getRenderer());

            Object value = attr.getValue();
            if (value instanceof String) {
                value = replace((String) value, vars);
            }
            nuattr.setValue(value);

            nudef.putAttribute(replace(attributeName, vars), nuattr);
        }

        return nudef;
View Full Code Here

        /** {@inheritDoc} */
        @Override
        public void begin(String namespace, String name, Attributes attributes)
                throws Exception {
            Attribute attribute = (Attribute) digester.peek();
            attribute.setValue(attributes.getValue("value"));
            attribute.setRole(attributes.getValue("role"));
            attribute.setRenderer(attributes.getValue("type"));
        }
View Full Code Here

        /** {@inheritDoc} */
        @Override
        public void begin(String namespace, String name, Attributes attributes)
                throws Exception {
            Attribute attribute = (Attribute) digester.peek(0);
            Definition definition = (Definition) digester.peek(1);
            definition.putAttribute(attributes.getValue("name"), attribute,
                    "true".equals(attributes.getValue("cascade")));
        }
View Full Code Here

TOP

Related Classes of org.apache.tiles.Attribute

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.