1/*2 * This file was automatically generated by Apache Tiles Autotag.3 */4package org.apache.tiles.velocity.template;
56import java.io.IOException;
7import java.io.Writer;
89import org.apache.tiles.autotag.core.runtime.ModelBody;
10import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
11import org.apache.velocity.context.InternalContextAdapter;
12import org.apache.velocity.runtime.directive.Directive;
13import org.apache.velocity.runtime.parser.node.Node;
1415/**16 * <p>17 * <strong>Inserts the value of an attribute into the page.</strong>18 * </p>19 * <p>20 * This tag can be flexibly used to insert the value of an attribute into a21 * page. As in other usages in Tiles, every attribute can be determined to have22 * a "type", either set explicitly when it was defined, or "computed". If the23 * type is not explicit, then if the attribute value is a valid definition, it24 * will be inserted as such. Otherwise, if it begins with a "/" character, it25 * will be treated as a "template". Finally, if it has not otherwise been26 * assigned a type, it will be treated as a String and included without any27 * special handling.28 * </p>29 * 30 * <p>31 * <strong>Example : </strong>32 * </p>33 * 34 * <pre>35 * <code>36 * <tiles:insertAttribute name="body" />37 * </code>38 * </pre>39 */40publicclassInsertAttributeDirectiveextends Directive {
4142/**43 * The template model.44 */45private org.apache.tiles.template.InsertAttributeModel model = new org.apache.tiles.template.InsertAttributeModel();
4647/** {@inheritDoc} */48 @Override
49public String getName() {
50return"tiles_insertAttribute";
51 }
5253/** {@inheritDoc} */54 @Override
55publicint getType() {
56return BLOCK;
57 }
5859/** {@inheritDoc} */60 @Override
61publicboolean render(InternalContextAdapter context, Writer writer, Node node)
62throws IOException {
63 AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.velocity.autotag.VelocityAutotagRuntime();
64if (runtime instanceof Directive) {
65 ((Directive) runtime).render(context, writer, node);
66 }
67 org.apache.tiles.request.Request request = runtime.createRequest();
68 ModelBody modelBody = runtime.createModelBody();
69 model.execute(
70 runtime.getParameter("ignore", java.lang.Boolean.class, false),
71 runtime.getParameter("preparer", java.lang.String.class, null),
72 runtime.getParameter("role", java.lang.String.class, null),
73 runtime.getParameter("defaultValue", java.lang.Object.class, null),
74 runtime.getParameter("defaultValueRole", java.lang.String.class, null),
75 runtime.getParameter("defaultValueType", java.lang.String.class, null),
76 runtime.getParameter("name", java.lang.String.class, null),
77 runtime.getParameter("value", org.apache.tiles.Attribute.class, null),
78 runtime.getParameter("flush", java.lang.Boolean.class, false),
79 request, modelBody
80 );
81returntrue;
82 }
83 }