1 | |
|
2 | |
|
3 | |
|
4 | |
package org.apache.tiles.freemarker.template; |
5 | |
|
6 | |
import java.io.IOException; |
7 | |
import java.util.Map; |
8 | |
|
9 | |
import org.apache.tiles.autotag.core.runtime.ModelBody; |
10 | |
import org.apache.tiles.autotag.core.runtime.AutotagRuntime; |
11 | |
|
12 | |
import freemarker.core.Environment; |
13 | |
import freemarker.template.TemplateDirectiveBody; |
14 | |
import freemarker.template.TemplateDirectiveModel; |
15 | |
import freemarker.template.TemplateException; |
16 | |
import freemarker.template.TemplateModel; |
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 | |
public class InsertAttributeFMModel implements TemplateDirectiveModel { |
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
private org.apache.tiles.template.InsertAttributeModel model; |
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | 1 | public InsertAttributeFMModel(org.apache.tiles.template.InsertAttributeModel model) { |
57 | 1 | this.model = model; |
58 | 1 | } |
59 | |
|
60 | |
|
61 | |
@SuppressWarnings("unchecked") |
62 | |
@Override |
63 | |
public void execute(Environment env, @SuppressWarnings("rawtypes") Map params, TemplateModel[] loopVars, |
64 | |
TemplateDirectiveBody body) throws TemplateException, IOException { |
65 | 0 | AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.freemarker.autotag.FreemarkerAutotagRuntime(); |
66 | 0 | if (runtime instanceof TemplateDirectiveModel) { |
67 | 0 | ((TemplateDirectiveModel) runtime).execute(env, params, loopVars, body); |
68 | |
} |
69 | 0 | org.apache.tiles.request.Request request = runtime.createRequest(); |
70 | 0 | ModelBody modelBody = runtime.createModelBody(); |
71 | 0 | model.execute( |
72 | |
runtime.getParameter("ignore", java.lang.Boolean.class, false), |
73 | |
runtime.getParameter("preparer", java.lang.String.class, null), |
74 | |
runtime.getParameter("role", java.lang.String.class, null), |
75 | |
runtime.getParameter("defaultValue", java.lang.Object.class, null), |
76 | |
runtime.getParameter("defaultValueRole", java.lang.String.class, null), |
77 | |
runtime.getParameter("defaultValueType", java.lang.String.class, null), |
78 | |
runtime.getParameter("name", java.lang.String.class, null), |
79 | |
runtime.getParameter("value", org.apache.tiles.Attribute.class, null), |
80 | |
runtime.getParameter("flush", java.lang.Boolean.class, false), |
81 | |
request, modelBody |
82 | |
); |
83 | 0 | } |
84 | |
} |