1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.util;
17
18 import org.kuali.rice.core.api.util.tree.Node;
19 import org.kuali.rice.core.api.util.tree.Tree;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.container.Group;
22 import org.kuali.rice.krad.uif.container.TreeGroup;
23 import org.kuali.rice.krad.uif.element.Message;
24 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
25 import org.kuali.rice.krad.uif.view.View;
26 import org.kuali.rice.krms.dto.PropositionEditor;
27 import org.kuali.rice.krms.tree.node.RuleEditorTreeNode;
28
29
30
31
32 public class EditTreeGroup extends TreeGroup {
33
34 protected void buildTreeGroups(Object model) {
35
36 Tree<Object, String> treeData = ObjectPropertyUtils.getPropertyValue(model, getBindingInfo().getBindingPath());
37
38 if(treeData==null){
39 return;
40 }
41
42
43 Tree<Group, Message> treeGroups = new Tree<Group, Message>();
44
45 String bindingPrefix = getBindingInfo().getBindingPrefixForNested();
46 Node<Group, Message> rootNode = buildTreeNode(treeData.getRootElement(),
47 bindingPrefix + ".rootElement", "root");
48 treeGroups.setRootElement(rootNode);
49
50 setTreeGroups(treeGroups);
51 }
52
53 protected Node<Group, Message> buildTreeNode(Node<Object, String> nodeData, String bindingPrefix,
54 String parentNode) {
55 Node<Group, Message> node = super.buildTreeNode(nodeData, bindingPrefix, parentNode);
56
57
58 if(nodeData.getData() instanceof RuleEditorTreeNode){
59 PropositionEditor proposition = ((RuleEditorTreeNode) nodeData.getData()).getProposition();
60 proposition.setBindingPath(bindingPrefix + ".data");
61 proposition.setIdSuffix(parentNode);
62 }
63
64 return node;
65 }
66 }