1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.web.ui;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21
22
23
24 public class Section implements java.io.Serializable {
25 private static final long serialVersionUID = 390440643941774650L;
26 String sectionTitle;
27 String sectionId;
28 String errorKey = "";
29 int numberOfColumns;
30 boolean isCollapsible = true;
31 String extraButtonSource;
32 boolean hidden = false;
33 boolean readOnly = false;
34 String helpUrl="";
35
36 boolean defaultOpen = true;
37
38 Class sectionClass;
39 List<Row> rows;
40 List<String> containedCollectionNames = new ArrayList();
41
42
43
44
45 public Section() {
46 }
47
48
49
50
51
52
53 public Section(List rows) {
54 this.rows = rows;
55 }
56
57
58
59
60
61 public String getErrorKey() {
62 return errorKey;
63 }
64
65
66
67
68
69 public void setErrorKey(String errorKey) {
70 this.errorKey = errorKey;
71 }
72
73
74
75
76
77 public List<Row> getRows() {
78 return rows;
79 }
80
81
82
83
84
85 public void setRows(List<Row> rows) {
86 this.rows = rows;
87 }
88
89
90
91
92
93 public String getSectionTitle() {
94 return sectionTitle;
95 }
96
97
98
99
100
101 public void setSectionTitle(String sectionTitle) {
102 this.sectionTitle = sectionTitle;
103 }
104
105
106
107
108
109 public boolean isCollapsible() {
110 return isCollapsible;
111 }
112
113
114
115
116
117 public void setCollapsible(boolean isCollapsible) {
118 this.isCollapsible = isCollapsible;
119 }
120
121
122
123
124
125 public Class getSectionClass() {
126 return sectionClass;
127 }
128
129
130
131
132
133 public void setSectionClass(Class sectionClass) {
134 this.sectionClass = sectionClass;
135 }
136
137
138 public int getNumberOfColumns() {
139 if (numberOfColumns != 0) {
140 return numberOfColumns;
141 } else {
142
143 return 1;
144 }
145 }
146
147 public void setNumberOfColumns(int numberOfColumns) {
148 this.numberOfColumns = numberOfColumns;
149 }
150
151
152
153
154
155
156 public List<String> getContainedCollectionNames() {
157 return containedCollectionNames;
158 }
159
160
161
162
163
164 public void setContainedCollectionNames(List<String> containedCollectionNames) {
165 this.containedCollectionNames = containedCollectionNames;
166 }
167
168
169
170
171 public String getExtraButtonSource() {
172 return extraButtonSource;
173 }
174
175
176
177
178 public void setExtraButtonSource(String extraButtonSource) {
179 this.extraButtonSource = extraButtonSource;
180 }
181
182
183
184
185 public int getFieldCnt() {
186 if (rows != null && !rows.isEmpty()) {
187 Row firstRow = rows.get(0);
188 List<Field> rowFields = firstRow.getFields();
189 Field firstElement = rowFields.get(0);
190
191 if (Field.CONTAINER.equals(firstElement.getFieldType())) {
192 if (firstElement.getContainerRows().size() > 0) {
193 rowFields = firstElement.getContainerRows().get(0).getFields();
194 }
195 }
196 if (rowFields.size() == 1) {
197 int i = 1;
198 while (i < rows.size() &&(Field.SUB_SECTION_SEPARATOR.equals(firstElement.getFieldType()) ||
199 Field.HIDDEN.equals(firstElement.getFieldType()))) {
200 Row aRow = rows.get(i);
201 rowFields = aRow.getFields();
202 firstElement = rowFields.get(0);
203 i++;
204 }
205 }
206 int cnt = 0;
207 for (Field element : rowFields ) {
208
209 if (!Field.IMAGE_SUBMIT.equals(element.getFieldType())) {
210 cnt += 2;
211 }
212 }
213 return cnt;
214 }
215 else {
216 return 0;
217 }
218 }
219
220 public String getSectionId() {
221 return this.sectionId;
222 }
223
224 public void setSectionId(String sectionId) {
225 this.sectionId = sectionId;
226 }
227
228 public boolean isHidden() {
229 return this.hidden;
230 }
231
232 public void setHidden(boolean hidden) {
233 this.hidden = hidden;
234 }
235
236
237
238
239 public boolean isReadOnly() {
240 return this.readOnly;
241 }
242
243
244
245
246 public void setReadOnly(boolean readOnly) {
247 this.readOnly = readOnly;
248 }
249
250
251
252
253 public boolean isDefaultOpen() {
254 return this.defaultOpen;
255 }
256
257
258
259
260 public void setDefaultOpen(boolean defaultOpen) {
261 this.defaultOpen = defaultOpen;
262 }
263
264 public String getHelpUrl() {
265 return helpUrl;
266 }
267
268 public void setHelpUrl(String helpUrl) {
269 this.helpUrl = helpUrl;
270 }
271
272 }