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.ViewLifecyclePhase;
22 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleTaskBase;
23 import org.kuali.rice.krad.uif.view.View;
24
25
26
27
28
29
30 public class AddViewTemplatesTask extends ViewLifecycleTaskBase<Component> {
31
32
33
34
35
36
37 public AddViewTemplatesTask(ViewLifecyclePhase phase) {
38 super(phase, Component.class);
39 }
40
41
42
43
44 @Override
45 protected void performLifecycleTask() {
46 Component component = (Component) getElementState().getElement();
47 View view = ViewLifecycle.getView();
48
49
50 if (!component.isSelfRendered() && StringUtils.isNotBlank(component.getTemplate())) {
51 String template = component.getTemplate();
52 view.addViewTemplate(template);
53
54 for (String additionalTemplate : component.getAdditionalTemplates()) {
55 view.addViewTemplate(additionalTemplate);
56 }
57 }
58 }
59
60 }