1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.core.krms;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.uif.UifConstants;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.component.DataBinding;
22 import org.kuali.rice.krad.uif.container.CollectionGroup;
23 import org.kuali.rice.krad.uif.container.Group;
24 import org.kuali.rice.krad.uif.container.collections.LineBuilderContext;
25 import org.kuali.rice.krad.uif.element.Action;
26 import org.kuali.rice.krad.uif.element.Message;
27 import org.kuali.rice.krad.uif.field.Field;
28 import org.kuali.rice.krad.uif.field.FieldGroup;
29 import org.kuali.rice.krad.uif.layout.StackedLayoutManager;
30 import org.kuali.rice.krad.uif.layout.StackedLayoutManagerBase;
31 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleUtils;
32 import org.kuali.rice.krad.uif.util.ComponentUtils;
33 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
34 import org.kuali.rice.krad.uif.view.ViewModel;
35 import org.kuali.rice.krad.util.KRADUtils;
36 import org.kuali.rice.krad.web.form.UifFormBase;
37
38 import java.util.ArrayList;
39 import java.util.List;
40 import java.util.Map;
41
42
43
44
45 public class TreeNodeStackedLayoutManager extends StackedLayoutManagerBase {
46
47 @Override
48 public void buildLine(LineBuilderContext lineBuilderContext) {
49 super.buildLine(lineBuilderContext);
50
51 if (lineBuilderContext.isAddLine()) {
52 String nodePath = this.getNodePath(lineBuilderContext.getCollectionGroup().getContext());
53 if (nodePath != null) {
54 for (Group group : this.getStackedGroups()) {
55
56 ComponentUtils.pushObjectToContext(group, UifConstants.ContextVariableNames.NODE_PATH, nodePath);
57 }
58 }
59 }
60
61 }
62
63 private String getNodePath(Map<String, Object> context) {
64 if (context.containsKey(UifConstants.ContextVariableNames.NODE_PATH)) {
65 return (String) context.get(UifConstants.ContextVariableNames.NODE_PATH);
66
67 } else if (context.containsKey(UifConstants.ContextVariableNames.PARENT)) {
68 Component parent = (Component) context.get(UifConstants.ContextVariableNames.PARENT);
69 return this.getNodePath(parent.getContext());
70 }
71 return null;
72 }
73
74 }