1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.layout.collections;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
20 import org.kuali.rice.krad.uif.UifConstants;
21 import org.kuali.rice.krad.uif.container.Group;
22 import org.kuali.rice.krad.uif.field.Field;
23 import org.kuali.rice.krad.uif.field.FieldGroup;
24 import org.kuali.rice.krad.uif.layout.CollectionLayoutManager;
25 import org.kuali.rice.krad.uif.layout.LayoutManagerBase;
26 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleRestriction;
27 import org.kuali.rice.krad.uif.view.ExpressionEvaluator;
28 import org.kuali.rice.krad.uif.element.Pager;
29 import org.kuali.rice.krad.util.KRADUtils;
30
31 import java.util.Map;
32
33
34
35
36
37
38 public abstract class CollectionLayoutManagerBase extends LayoutManagerBase implements CollectionLayoutManager {
39 private static final long serialVersionUID = 5530678364562263669L;
40
41 private Group addLineGroup;
42 private Field selectFieldPrototype;
43 private FieldGroup subCollectionFieldGroupPrototype;
44
45 private Pager pagerWidget;
46
47
48
49
50 @Override
51 @BeanTagAttribute
52 public Group getAddLineGroup() {
53 return addLineGroup;
54 }
55
56
57
58
59 @Override
60 public void setAddLineGroup(Group addLineGroup) {
61 this.addLineGroup = addLineGroup;
62 }
63
64
65
66
67
68
69
70
71
72
73 protected void addEnterKeyDataAttributeToGroup(Group group, Map<String, Object> lineContext,
74 ExpressionEvaluator expressionEvaluator, String enterKeyAction) {
75 if (StringUtils.isNotBlank(enterKeyAction)) {
76 String action = enterKeyAction;
77 if (action.contains("@{")) {
78 action = expressionEvaluator.evaluateExpressionTemplate(lineContext, enterKeyAction);
79 }
80
81 group.addDataAttribute(UifConstants.DataAttributes.ENTER_KEY, KRADUtils.convertToHTMLAttributeSafeString(
82 action));
83 }
84 }
85
86
87
88
89 @Override
90 @ViewLifecycleRestriction(UifConstants.ViewPhases.INITIALIZE)
91 @BeanTagAttribute
92 public Field getSelectFieldPrototype() {
93 return selectFieldPrototype;
94 }
95
96
97
98
99 @Override
100 public void setSelectFieldPrototype(Field selectFieldPrototype) {
101 this.selectFieldPrototype = selectFieldPrototype;
102 }
103
104
105
106
107 @Override
108 @ViewLifecycleRestriction(UifConstants.ViewPhases.INITIALIZE)
109 @BeanTagAttribute
110 public FieldGroup getSubCollectionFieldGroupPrototype() {
111 return this.subCollectionFieldGroupPrototype;
112 }
113
114
115
116
117 @Override
118 public void setSubCollectionFieldGroupPrototype(FieldGroup subCollectionFieldGroupPrototype) {
119 this.subCollectionFieldGroupPrototype = subCollectionFieldGroupPrototype;
120 }
121
122
123
124
125 @Override
126 @BeanTagAttribute
127 public Pager getPagerWidget() {
128 return pagerWidget;
129 }
130
131
132
133
134 @Override
135 public void setPagerWidget(Pager pagerWidget) {
136 this.pagerWidget = pagerWidget;
137 }
138 }