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 AddAttributeFMModel implements TemplateDirectiveModel { |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
private org.apache.tiles.template.AddAttributeModel model; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | 1 | public AddAttributeFMModel(org.apache.tiles.template.AddAttributeModel 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("value", java.lang.Object.class, null), |
60 | |
runtime.getParameter("expression", java.lang.String.class, null), |
61 | |
runtime.getParameter("role", java.lang.String.class, null), |
62 | |
runtime.getParameter("type", java.lang.String.class, null), |
63 | |
request, modelBody |
64 | |
); |
65 | 0 | } |
66 | |
} |