This project has retired. For details please refer to its
Attic page.
InsertDefinitionDirective xref
1
2
3
4 package org.apache.tiles.velocity.template;
5
6 import java.io.IOException;
7 import java.io.Writer;
8
9 import org.apache.tiles.autotag.core.runtime.ModelBody;
10 import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
11 import org.apache.velocity.context.InternalContextAdapter;
12 import org.apache.velocity.runtime.directive.Directive;
13 import org.apache.velocity.runtime.parser.node.Node;
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 public class InsertDefinitionDirective extends Directive {
49
50
51
52
53 private org.apache.tiles.template.InsertDefinitionModel model = new org.apache.tiles.template.InsertDefinitionModel();
54
55
56 @Override
57 public String getName() {
58 return "tiles_insertDefinition";
59 }
60
61
62 @Override
63 public int getType() {
64 return BLOCK;
65 }
66
67
68 @Override
69 public boolean render(InternalContextAdapter context, Writer writer, Node node)
70 throws IOException {
71 AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.velocity.autotag.VelocityAutotagRuntime();
72 if (runtime instanceof Directive) {
73 ((Directive) runtime).render(context, writer, node);
74 }
75 org.apache.tiles.request.Request request = runtime.createRequest();
76 ModelBody modelBody = runtime.createModelBody();
77 model.execute(
78 runtime.getParameter("name", java.lang.String.class, null),
79 runtime.getParameter("template", java.lang.String.class, null),
80 runtime.getParameter("templateType", java.lang.String.class, null),
81 runtime.getParameter("templateExpression", java.lang.String.class, null),
82 runtime.getParameter("role", java.lang.String.class, null),
83 runtime.getParameter("preparer", java.lang.String.class, null),
84 runtime.getParameter("flush", java.lang.Boolean.class, false),
85 request, modelBody
86 );
87 return true;
88 }
89 }