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