Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Row |
|
| 1.3333333333333333;1.333 |
1 | /* | |
2 | * Copyright 2007 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.krad.web.ui; | |
17 | ||
18 | import java.util.ArrayList; | |
19 | import java.util.List; | |
20 | ||
21 | /** | |
22 | * This class represents a row of fields on the ui. | |
23 | */ | |
24 | public class Row implements java.io.Serializable { | |
25 | ||
26 | private static final long serialVersionUID = 5920833652172097098L; | |
27 | private List<Field> fields; | |
28 | private boolean hidden; | |
29 | ||
30 | 0 | public Row() { |
31 | 0 | fields = new ArrayList<Field>(); |
32 | 0 | hidden = false; |
33 | 0 | } |
34 | ||
35 | 0 | public Row(List<Field> fields) { |
36 | 0 | this.fields = fields; |
37 | 0 | hidden = false; |
38 | 0 | } |
39 | ||
40 | 0 | public Row(Field field) { |
41 | 0 | this.fields = new ArrayList<Field>(); |
42 | 0 | fields.add(field); |
43 | 0 | hidden = false; |
44 | 0 | } |
45 | ||
46 | /** | |
47 | * @return the fields contained in the row | |
48 | */ | |
49 | public List<Field> getFields() { | |
50 | 0 | return fields; |
51 | } | |
52 | ||
53 | /** | |
54 | * @param fields the fields to be displayed in the row. | |
55 | */ | |
56 | public void setFields(List<Field> fields) { | |
57 | 0 | this.fields = fields; |
58 | 0 | } |
59 | ||
60 | /** | |
61 | * @return the hidden | |
62 | */ | |
63 | public boolean isHidden() { | |
64 | 0 | return hidden; |
65 | } | |
66 | ||
67 | /** | |
68 | * @param hidden the hidden to set | |
69 | */ | |
70 | public void setHidden(boolean hidden) { | |
71 | 0 | this.hidden = hidden; |
72 | 0 | } |
73 | ||
74 | public Field getField(int index) { | |
75 | 0 | while (fields.size() <= index) { |
76 | 0 | Field field = new Field(); |
77 | 0 | fields.add(field); |
78 | 0 | } |
79 | 0 | return (Field) fields.get(index); |
80 | } | |
81 | ||
82 | public String toString(){ | |
83 | 0 | StringBuffer sRet = new StringBuffer(); |
84 | 0 | sRet.append("["); |
85 | ||
86 | 0 | if(fields != null){ |
87 | 0 | for(Field f: fields){ |
88 | 0 | sRet.append(f.getPropertyName() + ", "); |
89 | } | |
90 | ||
91 | 0 | sRet.delete(sRet.length()-2, sRet.length()); |
92 | } | |
93 | 0 | sRet.append("]"); |
94 | ||
95 | 0 | return sRet.toString(); |
96 | ||
97 | } | |
98 | } |