1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.lifecycle.model;
17
18 import java.util.Map;
19
20 import org.kuali.rice.krad.uif.UifConstants;
21 import org.kuali.rice.krad.uif.layout.LayoutManager;
22 import org.kuali.rice.krad.uif.lifecycle.ApplyModelComponentPhase;
23 import org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhase;
24 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleTaskBase;
25 import org.kuali.rice.krad.uif.util.LifecycleElement;
26
27
28
29
30
31
32 public class PopulateComponentContextTask extends ViewLifecycleTaskBase<LifecycleElement> {
33
34
35
36
37
38
39 public PopulateComponentContextTask(ViewLifecyclePhase phase) {
40 super(phase, LifecycleElement.class);
41 }
42
43
44
45
46 @Override
47 public ApplyModelComponentPhase getElementState() {
48 return (ApplyModelComponentPhase) super.getElementState();
49 }
50
51
52
53
54 @Override
55 protected void performLifecycleTask() {
56 LifecycleElement element = getElementState().getElement();
57 LifecycleElement parent = getElementState().getParent();
58
59 Map<String, Object> commonContext = getElementState().getCommonContext();
60
61 if (parent != null) {
62 element.pushObjectToContext(UifConstants.ContextVariableNames.PARENT, parent);
63 }
64
65
66 element.pushAllToContext(commonContext);
67
68
69 if (element instanceof LayoutManager) {
70 element.pushObjectToContext(UifConstants.ContextVariableNames.MANAGER, element);
71 }
72 }
73
74 }