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.AutotagRuntime; |
10 | |
import org.apache.velocity.context.InternalContextAdapter; |
11 | |
import org.apache.velocity.runtime.directive.Directive; |
12 | |
import org.apache.velocity.runtime.parser.node.Node; |
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | 0 | public class ImportAttributeDirective extends Directive { |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 0 | private org.apache.tiles.template.ImportAttributeModel model = new org.apache.tiles.template.ImportAttributeModel(); |
30 | |
|
31 | |
|
32 | |
@Override |
33 | |
public String getName() { |
34 | 0 | return "tiles_importAttribute"; |
35 | |
} |
36 | |
|
37 | |
|
38 | |
@Override |
39 | |
public int getType() { |
40 | 0 | return LINE; |
41 | |
} |
42 | |
|
43 | |
|
44 | |
@Override |
45 | |
public boolean render(InternalContextAdapter context, Writer writer, Node node) |
46 | |
throws IOException { |
47 | 0 | AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.velocity.autotag.VelocityAutotagRuntime(); |
48 | 0 | if (runtime instanceof Directive) { |
49 | 0 | ((Directive) runtime).render(context, writer, node); |
50 | |
} |
51 | 0 | org.apache.tiles.request.Request request = runtime.createRequest(); |
52 | 0 | model.execute( |
53 | |
runtime.getParameter("name", java.lang.String.class, null), |
54 | |
runtime.getParameter("scope", java.lang.String.class, null), |
55 | |
runtime.getParameter("toName", java.lang.String.class, null), |
56 | |
runtime.getParameter("ignore", java.lang.Boolean.class, false), |
57 | |
request |
58 | |
); |
59 | 0 | return true; |
60 | |
} |
61 | |
} |