1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.container.collections;
17
18 import org.kuali.rice.krad.uif.UifConstants;
19 import org.kuali.rice.krad.uif.component.Component;
20 import org.kuali.rice.krad.uif.container.CollectionGroup;
21 import org.kuali.rice.krad.uif.container.DialogGroup;
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.view.ViewModel;
26
27 import java.io.Serializable;
28 import java.util.Collections;
29 import java.util.List;
30
31
32
33
34
35
36
37
38 public class LineBuilderContext implements Serializable {
39 private static final long serialVersionUID = -2025777471407211781L;
40
41 private int lineIndex;
42 private Object currentLine;
43 private String bindingPath;
44 private boolean bindToForm;
45
46 private ViewModel model;
47 private CollectionGroup collectionGroup;
48
49 private List<? extends Component> lineActions;
50 private List<Field> lineFields;
51 private List<FieldGroup> subCollectionFields;
52 private List<DialogGroup> lineDialogs;
53
54
55
56
57 public LineBuilderContext() {
58
59 }
60
61
62
63
64
65
66
67
68
69
70
71
72 public LineBuilderContext(int lineIndex, Object currentLine, String bindingPath, boolean bindToForm, ViewModel model,
73 CollectionGroup collectionGroup, List<? extends Component> lineActions) {
74 this.lineIndex = lineIndex;
75 this.currentLine = currentLine;
76 this.bindingPath = bindingPath;
77 this.bindToForm = bindToForm;
78 this.model = model;
79 this.collectionGroup = collectionGroup;
80 this.lineActions = lineActions;
81 this.lineDialogs = Collections.emptyList();
82 }
83
84
85
86
87
88
89
90
91
92
93
94
95
96 public LineBuilderContext(int lineIndex, Object currentLine, String bindingPath, boolean bindToForm, ViewModel model,
97 CollectionGroup collectionGroup, List<? extends Component> lineActions, List<DialogGroup> lineDialogs) {
98 this.lineIndex = lineIndex;
99 this.currentLine = currentLine;
100 this.bindingPath = bindingPath;
101 this.bindToForm = bindToForm;
102 this.model = model;
103 this.collectionGroup = collectionGroup;
104 this.lineActions = lineActions;
105 this.lineDialogs = lineDialogs;
106 }
107
108
109
110
111
112
113 public String getIdSuffix() {
114 String idSuffix;
115
116 if (isAddLine()) {
117 idSuffix = UifConstants.IdSuffixes.ADD_LINE;
118 } else {
119 idSuffix = UifConstants.IdSuffixes.LINE + Integer.toString(lineIndex);
120 }
121
122 return idSuffix;
123 }
124
125
126
127
128
129
130 public boolean isAddLine() {
131 return this.lineIndex == -1;
132 }
133
134
135
136
137
138
139
140 public CollectionLayoutManager getLayoutManager() {
141 if (this.collectionGroup != null) {
142 return (CollectionLayoutManager) this.collectionGroup.getLayoutManager();
143 }
144
145 return null;
146 }
147
148
149
150
151
152
153 public int getLineIndex() {
154 return lineIndex;
155 }
156
157
158
159
160 public void setLineIndex(int lineIndex) {
161 this.lineIndex = lineIndex;
162 }
163
164
165
166
167
168
169 public Object getCurrentLine() {
170 return currentLine;
171 }
172
173
174
175
176 public void setCurrentLine(Object currentLine) {
177 this.currentLine = currentLine;
178 }
179
180
181
182
183
184
185 public String getBindingPath() {
186 return bindingPath;
187 }
188
189
190
191
192 public void setBindingPath(String bindingPath) {
193 this.bindingPath = bindingPath;
194 }
195
196
197
198
199
200
201 public boolean isBindToForm() {
202 return bindToForm;
203 }
204
205
206
207
208 public void setBindToForm(boolean bindToForm) {
209 this.bindToForm = bindToForm;
210 }
211
212
213
214
215
216
217 public ViewModel getModel() {
218 return model;
219 }
220
221
222
223
224 public void setModel(ViewModel model) {
225 this.model = model;
226 }
227
228
229
230
231
232
233 public CollectionGroup getCollectionGroup() {
234 return collectionGroup;
235 }
236
237
238
239
240 public void setCollectionGroup(CollectionGroup collectionGroup) {
241 this.collectionGroup = collectionGroup;
242 }
243
244
245
246
247
248
249 public List<? extends Component> getLineActions() {
250 return lineActions;
251 }
252
253
254
255
256 public void setLineActions(List<? extends Component> lineActions) {
257 this.lineActions = lineActions;
258 }
259
260
261
262
263
264
265 public List<Field> getLineFields() {
266 return lineFields;
267 }
268
269
270
271
272 public void setLineFields(List<Field> lineFields) {
273 this.lineFields = lineFields;
274 }
275
276
277
278
279
280
281 public List<FieldGroup> getSubCollectionFields() {
282 return subCollectionFields;
283 }
284
285
286
287
288 public void setSubCollectionFields(List<FieldGroup> subCollectionFields) {
289 this.subCollectionFields = subCollectionFields;
290 }
291
292
293
294
295
296
297 public List<DialogGroup> getLineDialogs() {
298 return lineDialogs;
299 }
300
301
302
303
304 public void setLineDialogs(List<DialogGroup> dialogGroups) {
305 this.lineDialogs = dialogGroups;
306 }
307 }