1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.lifecycle.finalize;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.uif.component.Component;
20 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle;
21 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleTaskBase;
22 import org.kuali.rice.krad.uif.view.View;
23
24
25
26
27
28
29 public class AddViewTemplatesTask extends ViewLifecycleTaskBase<Component> {
30
31
32
33
34 public AddViewTemplatesTask() {
35 super(Component.class);
36 }
37
38
39
40
41 @Override
42 protected void performLifecycleTask() {
43 Component component = (Component) getElementState().getElement();
44 View view = ViewLifecycle.getView();
45
46
47 if (!component.isSelfRendered() && StringUtils.isNotBlank(component.getTemplate())) {
48 String template = component.getTemplate();
49 view.addViewTemplate(template);
50
51 for (String additionalTemplate : component.getAdditionalTemplates()) {
52 view.addViewTemplate(additionalTemplate);
53 }
54 }
55 }
56
57 }