1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.field;
17
18 import java.util.List;
19
20 import org.apache.commons.lang.StringUtils;
21 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
22 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
23 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
24 import org.kuali.rice.krad.uif.UifConstants;
25 import org.kuali.rice.krad.uif.component.Component;
26 import org.kuali.rice.krad.uif.container.Group;
27 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleRestriction;
28 import org.kuali.rice.krad.uif.util.LifecycleElement;
29
30
31
32
33
34
35
36
37
38 @BeanTags({@BeanTag(name = "fieldGroup", parent = "Uif-FieldGroupBase"),
39 @BeanTag(name = "verticalFieldGroup", parent = "Uif-VerticalFieldGroup"),
40 @BeanTag(name = "horizontalFieldGroup", parent = "Uif-HorizontalFieldGroup")})
41 public class FieldGroup extends FieldBase {
42 private static final long serialVersionUID = -505654043702442196L;
43
44 private Group group;
45
46 public FieldGroup() {
47 super();
48 }
49
50
51
52
53
54
55
56
57
58
59 @Override
60 public void performInitialization(Object model) {
61 super.performInitialization(model);
62
63 if (StringUtils.isNotBlank(getAlign()) && group != null) {
64 group.setAlign(getAlign());
65 }
66 }
67
68
69
70
71 @Override
72 public void afterEvaluateExpression() {
73 super.afterEvaluateExpression();
74
75 if (group != null) {
76 group.setReadOnly(getReadOnly());
77 }
78 }
79
80 @Override
81 public void performFinalize(Object model, LifecycleElement parent) {
82 super.performFinalize(model, parent);
83
84 this.addDataAttribute(UifConstants.DataAttributes.PARENT, parent.getId());
85 if (group != null) {
86 this.addDataAttribute(UifConstants.DataAttributes.GROUP, group.getId());
87 }
88
89 setNestedComponentIdAndSuffix(getFieldLabel(), UifConstants.IdSuffixes.LABEL);
90
91 if (this.getFieldLabel() != null) {
92 this.getFieldLabel().setLabelForComponentId(this.getId() + UifConstants.IdSuffixes.FIELDSET);
93 }
94 }
95
96
97
98
99
100
101 @BeanTagAttribute(type = BeanTagAttribute.AttributeType.DIRECTORBYTYPE)
102 public Group getGroup() {
103 return this.group;
104 }
105
106
107
108
109
110
111 public void setGroup(Group group) {
112 this.group = group;
113 }
114
115
116
117
118
119
120
121
122
123
124
125 @ViewLifecycleRestriction
126 @BeanTagAttribute
127 public List<? extends Component> getItems() {
128 if (group != null) {
129 return group.getItems();
130 }
131
132 return null;
133 }
134
135
136
137
138
139
140
141
142
143
144
145 public void setItems(List<? extends Component> items) {
146 if (group != null) {
147 group.setItems(items);
148 }
149 }
150 }