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 | |
public class GetAsStringFMModel implements TemplateDirectiveModel { |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
private org.apache.tiles.template.GetAsStringModel model; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | 1 | public GetAsStringFMModel(org.apache.tiles.template.GetAsStringModel model) { |
44 | 1 | this.model = model; |
45 | 1 | } |
46 | |
|
47 | |
|
48 | |
@SuppressWarnings("unchecked") |
49 | |
@Override |
50 | |
public void execute(Environment env, @SuppressWarnings("rawtypes") Map params, TemplateModel[] loopVars, |
51 | |
TemplateDirectiveBody body) throws TemplateException, IOException { |
52 | 0 | AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.freemarker.autotag.FreemarkerAutotagRuntime(); |
53 | 0 | if (runtime instanceof TemplateDirectiveModel) { |
54 | 0 | ((TemplateDirectiveModel) runtime).execute(env, params, loopVars, body); |
55 | |
} |
56 | 0 | org.apache.tiles.request.Request request = runtime.createRequest(); |
57 | 0 | ModelBody modelBody = runtime.createModelBody(); |
58 | 0 | model.execute( |
59 | |
runtime.getParameter("ignore", java.lang.Boolean.class, false), |
60 | |
runtime.getParameter("preparer", java.lang.String.class, null), |
61 | |
runtime.getParameter("role", java.lang.String.class, null), |
62 | |
runtime.getParameter("defaultValue", java.lang.Object.class, null), |
63 | |
runtime.getParameter("defaultValueRole", java.lang.String.class, null), |
64 | |
runtime.getParameter("defaultValueType", java.lang.String.class, null), |
65 | |
runtime.getParameter("name", java.lang.String.class, null), |
66 | |
runtime.getParameter("value", org.apache.tiles.Attribute.class, null), |
67 | |
request, modelBody |
68 | |
); |
69 | 0 | } |
70 | |
} |