1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.uif.util; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
19 | |
import org.kuali.rice.core.api.uif.RemotableAbstractWidget; |
20 | |
import org.kuali.rice.core.api.uif.RemotableAttributeField; |
21 | |
import org.kuali.rice.core.api.uif.RemotableCheckboxGroup; |
22 | |
import org.kuali.rice.core.api.uif.RemotableDatepicker; |
23 | |
import org.kuali.rice.core.api.uif.RemotableHiddenInput; |
24 | |
import org.kuali.rice.core.api.uif.RemotableQuickFinder; |
25 | |
import org.kuali.rice.core.api.uif.RemotableRadioButtonGroup; |
26 | |
import org.kuali.rice.core.api.uif.RemotableSelect; |
27 | |
import org.kuali.rice.core.api.uif.RemotableSelectGroup; |
28 | |
import org.kuali.rice.core.api.uif.RemotableTextExpand; |
29 | |
import org.kuali.rice.core.api.uif.RemotableTextInput; |
30 | |
import org.kuali.rice.core.api.uif.RemotableTextarea; |
31 | |
import org.kuali.rice.core.api.util.ConcreteKeyValue; |
32 | |
import org.kuali.rice.core.api.util.KeyValue; |
33 | |
import org.kuali.rice.krad.datadictionary.validation.constraint.ValidCharactersConstraint; |
34 | |
import org.kuali.rice.krad.keyvalues.KeyValuesFinder; |
35 | |
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; |
36 | |
import org.kuali.rice.krad.uif.UifConstants; |
37 | |
import org.kuali.rice.krad.uif.container.CollectionGroup; |
38 | |
import org.kuali.rice.krad.uif.container.Group; |
39 | |
import org.kuali.rice.krad.uif.container.LinkGroup; |
40 | |
import org.kuali.rice.krad.uif.container.NavigationGroup; |
41 | |
import org.kuali.rice.krad.uif.container.PageGroup; |
42 | |
import org.kuali.rice.krad.uif.container.TabGroup; |
43 | |
import org.kuali.rice.krad.uif.container.TreeGroup; |
44 | |
import org.kuali.rice.krad.uif.control.CheckboxControl; |
45 | |
import org.kuali.rice.krad.uif.control.CheckboxGroupControl; |
46 | |
import org.kuali.rice.krad.uif.control.Control; |
47 | |
import org.kuali.rice.krad.uif.control.FileControl; |
48 | |
import org.kuali.rice.krad.uif.control.HiddenControl; |
49 | |
import org.kuali.rice.krad.uif.control.MultiValueControl; |
50 | |
import org.kuali.rice.krad.uif.control.RadioGroupControl; |
51 | |
import org.kuali.rice.krad.uif.control.SelectControl; |
52 | |
import org.kuali.rice.krad.uif.control.SizedControl; |
53 | |
import org.kuali.rice.krad.uif.control.TextAreaControl; |
54 | |
import org.kuali.rice.krad.uif.control.TextControl; |
55 | |
import org.kuali.rice.krad.uif.component.Component; |
56 | |
import org.kuali.rice.krad.uif.field.ActionField; |
57 | |
import org.kuali.rice.krad.uif.field.DataField; |
58 | |
import org.kuali.rice.krad.uif.field.InputField; |
59 | |
import org.kuali.rice.krad.uif.field.BlankField; |
60 | |
import org.kuali.rice.krad.uif.field.ErrorsField; |
61 | |
import org.kuali.rice.krad.uif.field.FieldGroup; |
62 | |
import org.kuali.rice.krad.uif.field.GenericField; |
63 | |
import org.kuali.rice.krad.uif.field.HeaderField; |
64 | |
import org.kuali.rice.krad.uif.field.IframeField; |
65 | |
import org.kuali.rice.krad.uif.field.ImageField; |
66 | |
import org.kuali.rice.krad.uif.field.LabelField; |
67 | |
import org.kuali.rice.krad.uif.field.LinkField; |
68 | |
import org.kuali.rice.krad.uif.field.MessageField; |
69 | |
import org.kuali.rice.krad.uif.view.View; |
70 | |
|
71 | |
import java.util.ArrayList; |
72 | |
import java.util.HashMap; |
73 | |
import java.util.List; |
74 | |
import java.util.Map; |
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | 0 | public class ComponentFactory { |
83 | |
|
84 | |
protected static final String TEXT_CONTROL = "TextControl"; |
85 | |
protected static final String CHECKBOX_CONTROL = "CheckboxControl"; |
86 | |
protected static final String HIDDEN_CONTROL = "HiddenControl"; |
87 | |
protected static final String TEXTAREA_CONTROL = "TextAreaControl"; |
88 | |
protected static final String SELECT_CONTROL = "SelectControl"; |
89 | |
protected static final String CHECKBOX_GROUP_CONTROL = "CheckboxGroupControl"; |
90 | |
protected static final String CHECKBOX_GROUP_CONTROL_HORIZONTAL = "CheckboxGroupControlHorizontal"; |
91 | |
protected static final String RADIO_GROUP_CONTROL = "RadioGroupControl"; |
92 | |
protected static final String RADIO_GROUP_CONTROL_HORIZONTAL = "RadioGroupControlHorizontal"; |
93 | |
protected static final String FILE_CONTROL = "FileControl"; |
94 | |
protected static final String DATE_CONTROL = "DateControl"; |
95 | |
protected static final String USER_CONTROL = "UserControl"; |
96 | |
protected static final String GROUP_CONTROL = "GroupControl"; |
97 | |
|
98 | |
protected static final String DATA_FIELD = "DataField"; |
99 | |
protected static final String INPUT_FIELD = "InputField"; |
100 | |
protected static final String ERRORS_FIELD = "ErrorsField"; |
101 | |
protected static final String ACTION_FIELD = "ActionField"; |
102 | |
protected static final String ACTION_LINK_FIELD = "ActionLinkField"; |
103 | |
protected static final String LINK_FIELD = "LinkField"; |
104 | |
protected static final String IFRAME_FIELD = "IframeField"; |
105 | |
protected static final String IMAGE_FIELD = "ImageField"; |
106 | |
protected static final String BLANK_FIELD = "BlankField"; |
107 | |
protected static final String GENERIC_FIELD = "GenericField"; |
108 | |
protected static final String LABEL_FIELD = "LabelField"; |
109 | |
protected static final String MESSAGE_FIELD = "MessageField"; |
110 | |
protected static final String FIELD_GROUP = "FieldGroup"; |
111 | |
protected static final String HORIZONTAL_FIELD_GROUP = "HorizontalFieldGroup"; |
112 | |
|
113 | |
protected static final String GROUP = "Group"; |
114 | |
protected static final String PAGE_GROUP = "PageGroup"; |
115 | |
protected static final String GROUP_GRID_LAYOUT = "GroupGridLayout"; |
116 | |
protected static final String GROUP_BODY_ONLY = "GroupBodyOnly"; |
117 | |
protected static final String GROUP_GRID_BODY_ONLY = "GroupGridBodyOnly"; |
118 | |
protected static final String TAB_GROUP = "TabGroup"; |
119 | |
protected static final String NAVIGATION_GROUP = "NavigationGroup"; |
120 | |
protected static final String TREE_GROUP = "TreeGroup"; |
121 | |
protected static final String LINK_GROUP = "LinkGroup"; |
122 | |
protected static final String COLLECTION_GROUP = "CollectionGroup"; |
123 | |
protected static final String COLLECTION_GROUP_TABLE_LAYOUT = "CollectionGroupTableLayout"; |
124 | |
protected static final String LIST_GROUP = "ListGroup"; |
125 | |
|
126 | |
protected static final String HEADER = "Header"; |
127 | |
protected static final String FOOTER = "Footer"; |
128 | |
protected static final String FOOTER_SAVECLOSECANCEL = "Footer_SaveCloseCancel"; |
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
public static Component getNewInstanceForRefresh(View view, String id) { |
138 | 0 | Component component = null; |
139 | 0 | Component origComponent = view.getViewIndex().getComponentById(id); |
140 | |
|
141 | 0 | if (view.getViewIndex().getInitialComponentStates().containsKey(origComponent.getFactoryId())) { |
142 | 0 | component = view.getViewIndex().getInitialComponentStates().get(origComponent.getFactoryId()); |
143 | 0 | component = ComponentUtils.copyObject(component); |
144 | |
} |
145 | |
|
146 | 0 | component.setId(origComponent.getFactoryId()); |
147 | |
|
148 | 0 | return component; |
149 | |
} |
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
|
157 | |
public static Component getNewComponentInstance(String beanId) { |
158 | 0 | Component component = (Component) KRADServiceLocatorWeb.getDataDictionaryService().getDictionaryObject(beanId); |
159 | |
|
160 | |
|
161 | 0 | component.setId(null); |
162 | 0 | component.setFactoryId(null); |
163 | |
|
164 | 0 | return component; |
165 | |
} |
166 | |
|
167 | |
public static TextControl getTextControl() { |
168 | 0 | return (TextControl) getNewComponentInstance(TEXT_CONTROL); |
169 | |
} |
170 | |
|
171 | |
public static TextAreaControl getTextAreaControl() { |
172 | 0 | return (TextAreaControl) getNewComponentInstance(TEXTAREA_CONTROL); |
173 | |
} |
174 | |
|
175 | |
public static CheckboxControl getCheckboxControl() { |
176 | 0 | return (CheckboxControl) getNewComponentInstance(CHECKBOX_CONTROL); |
177 | |
} |
178 | |
|
179 | |
public static HiddenControl getHiddenControl() { |
180 | 0 | return (HiddenControl) getNewComponentInstance(HIDDEN_CONTROL); |
181 | |
} |
182 | |
|
183 | |
public static SelectControl getSelectControl() { |
184 | 0 | return (SelectControl) getNewComponentInstance(SELECT_CONTROL); |
185 | |
} |
186 | |
|
187 | |
public static CheckboxGroupControl getCheckboxGroupControl() { |
188 | 0 | return (CheckboxGroupControl) getNewComponentInstance(CHECKBOX_GROUP_CONTROL); |
189 | |
} |
190 | |
|
191 | |
public static CheckboxGroupControl getCheckboxGroupControlHorizontal() { |
192 | 0 | return (CheckboxGroupControl) getNewComponentInstance(CHECKBOX_GROUP_CONTROL_HORIZONTAL); |
193 | |
} |
194 | |
|
195 | |
public static RadioGroupControl getRadioGroupControl() { |
196 | 0 | return (RadioGroupControl) getNewComponentInstance(RADIO_GROUP_CONTROL); |
197 | |
} |
198 | |
|
199 | |
public static RadioGroupControl getRadioGroupControlHorizontal() { |
200 | 0 | return (RadioGroupControl) getNewComponentInstance(RADIO_GROUP_CONTROL_HORIZONTAL); |
201 | |
} |
202 | |
|
203 | |
public static FileControl getFileControl() { |
204 | 0 | return (FileControl) getNewComponentInstance(FILE_CONTROL); |
205 | |
} |
206 | |
|
207 | |
public static TextControl getDateControl() { |
208 | 0 | return (TextControl) getNewComponentInstance(DATE_CONTROL); |
209 | |
} |
210 | |
|
211 | |
public static TextControl getUserControl() { |
212 | 0 | return (TextControl) getNewComponentInstance(USER_CONTROL); |
213 | |
} |
214 | |
|
215 | |
public static TextControl getGroupControl() { |
216 | 0 | return (TextControl) getNewComponentInstance(GROUP_CONTROL); |
217 | |
} |
218 | |
|
219 | |
public static DataField getDataField() { |
220 | 0 | return (DataField) getNewComponentInstance(DATA_FIELD); |
221 | |
} |
222 | |
|
223 | |
public static DataField getDataField(String propertyName, String label) { |
224 | 0 | DataField field = (DataField) getNewComponentInstance(DATA_FIELD); |
225 | |
|
226 | 0 | field.setPropertyName(propertyName); |
227 | 0 | field.setLabel(label); |
228 | |
|
229 | 0 | return field; |
230 | |
} |
231 | |
|
232 | |
public static InputField getInputField() { |
233 | 0 | return (InputField) getNewComponentInstance(INPUT_FIELD); |
234 | |
} |
235 | |
|
236 | |
public static InputField getInputField(String propertyName, String label) { |
237 | 0 | InputField field = (InputField) getNewComponentInstance(INPUT_FIELD); |
238 | |
|
239 | 0 | field.setPropertyName(propertyName); |
240 | 0 | field.setLabel(label); |
241 | |
|
242 | 0 | return field; |
243 | |
} |
244 | |
|
245 | |
public static InputField getInputField(String propertyName, String label, UifConstants.ControlType controlType) { |
246 | 0 | InputField field = (InputField) getNewComponentInstance(INPUT_FIELD); |
247 | |
|
248 | 0 | field.setPropertyName(propertyName); |
249 | 0 | field.setLabel(label); |
250 | 0 | field.setControl(getControl(controlType)); |
251 | |
|
252 | 0 | return field; |
253 | |
} |
254 | |
|
255 | |
public static InputField getInputField(String propertyName, String label, UifConstants.ControlType controlType, |
256 | |
String defaultValue) { |
257 | 0 | InputField field = (InputField) getNewComponentInstance(INPUT_FIELD); |
258 | |
|
259 | 0 | field.setPropertyName(propertyName); |
260 | 0 | field.setLabel(label); |
261 | 0 | field.setControl(getControl(controlType)); |
262 | 0 | field.setDefaultValue(defaultValue); |
263 | |
|
264 | 0 | return field; |
265 | |
} |
266 | |
|
267 | |
public static InputField getInputField(String propertyName, String label, UifConstants.ControlType controlType, |
268 | |
Class<? extends KeyValuesFinder> optionsFinderClass) { |
269 | 0 | InputField field = (InputField) getNewComponentInstance(INPUT_FIELD); |
270 | |
|
271 | 0 | field.setPropertyName(propertyName); |
272 | 0 | field.setLabel(label); |
273 | 0 | field.setControl(getControl(controlType)); |
274 | 0 | field.setOptionsFinderClass(optionsFinderClass); |
275 | |
|
276 | 0 | return field; |
277 | |
} |
278 | |
|
279 | |
public static InputField getInputField(String propertyName, String label, UifConstants.ControlType controlType, |
280 | |
List<KeyValue> options) { |
281 | 0 | InputField field = (InputField) getNewComponentInstance(INPUT_FIELD); |
282 | |
|
283 | 0 | field.setPropertyName(propertyName); |
284 | 0 | field.setLabel(label); |
285 | |
|
286 | 0 | Control control = getControl(controlType); |
287 | 0 | if (control instanceof MultiValueControl) { |
288 | 0 | ((MultiValueControl) control).setOptions(options); |
289 | |
} else { |
290 | 0 | throw new RuntimeException("Control is not instance of multi-value control, cannot set options"); |
291 | |
} |
292 | |
|
293 | 0 | return field; |
294 | |
} |
295 | |
|
296 | |
public static InputField getInputField(String propertyName, String label, UifConstants.ControlType controlType, |
297 | |
int size, int maxLength, int minLength) { |
298 | 0 | InputField field = (InputField) getNewComponentInstance(INPUT_FIELD); |
299 | |
|
300 | 0 | field.setPropertyName(propertyName); |
301 | 0 | field.setLabel(label); |
302 | |
|
303 | 0 | Control control = getControl(controlType); |
304 | 0 | if (control instanceof SizedControl) { |
305 | 0 | ((SizedControl) control).setSize(size); |
306 | |
} else { |
307 | 0 | throw new RuntimeException("Control does not support the size property"); |
308 | |
} |
309 | |
|
310 | 0 | field.setMaxLength(maxLength); |
311 | 0 | field.setMinLength(minLength); |
312 | |
|
313 | 0 | return field; |
314 | |
} |
315 | |
|
316 | |
|
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
|
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
public static InputField translateRemotableField(RemotableAttributeField remotableField) { |
329 | 0 | InputField inputField = getInputField(); |
330 | |
|
331 | 0 | inputField.setPropertyName(remotableField.getName()); |
332 | 0 | inputField.setShortLabel(remotableField.getShortLabel()); |
333 | 0 | inputField.setLabel(remotableField.getLongLabel()); |
334 | 0 | inputField.setHelpSummary(remotableField.getHelpSummary()); |
335 | 0 | inputField.setHelpDescription(remotableField.getHelpDescription()); |
336 | 0 | inputField.setConstraintText(remotableField.getHelpConstraint()); |
337 | 0 | inputField.setPerformUppercase(remotableField.isForceUpperCase()); |
338 | 0 | inputField.setMinLength(remotableField.getMinLength()); |
339 | 0 | inputField.setMaxLength(remotableField.getMaxLength()); |
340 | |
|
341 | |
|
342 | 0 | if (remotableField.getMinValue() != null) { |
343 | 0 | inputField.setExclusiveMin(remotableField.getMinValue().toString()); |
344 | |
} |
345 | 0 | if (remotableField.getMaxValue() != null) { |
346 | 0 | inputField.setInclusiveMax(remotableField.getMaxValue().toString()); |
347 | |
} |
348 | 0 | inputField.setRequired(remotableField.isRequired()); |
349 | |
|
350 | 0 | if ((remotableField.getDefaultValues() != null) && !remotableField.getDefaultValues().isEmpty()) { |
351 | 0 | inputField.setDefaultValue(remotableField.getDefaultValues().iterator().next()); |
352 | |
} |
353 | |
|
354 | 0 | if (StringUtils.isNotBlank(remotableField.getRegexConstraint())) { |
355 | 0 | ValidCharactersConstraint constraint = new ValidCharactersConstraint(); |
356 | 0 | constraint.setValue(remotableField.getRegexConstraint()); |
357 | 0 | inputField.setValidCharactersConstraint(constraint); |
358 | |
|
359 | |
} |
360 | |
|
361 | 0 | RemotableDatepicker remotableDatepicker = null; |
362 | 0 | RemotableTextExpand remotableTextExpand = null; |
363 | 0 | RemotableQuickFinder remotableQuickFinder = null; |
364 | 0 | for (RemotableAbstractWidget remoteWidget : remotableField.getWidgets()) { |
365 | 0 | if (remoteWidget instanceof RemotableDatepicker) { |
366 | 0 | remotableDatepicker = (RemotableDatepicker) remoteWidget; |
367 | 0 | } else if (remoteWidget instanceof RemotableTextExpand) { |
368 | 0 | remotableTextExpand = (RemotableTextExpand) remoteWidget; |
369 | 0 | } else if (remoteWidget instanceof RemotableQuickFinder) { |
370 | 0 | remotableQuickFinder = (RemotableQuickFinder) remoteWidget; |
371 | |
} |
372 | |
} |
373 | |
|
374 | 0 | if (remotableQuickFinder != null) { |
375 | 0 | inputField.getFieldLookup().setBaseLookupUrl(remotableQuickFinder.getBaseLookupUrl()); |
376 | 0 | inputField.getFieldLookup().setDataObjectClassName(remotableQuickFinder.getDataObjectClass()); |
377 | 0 | inputField.getFieldLookup().setLookupParameters(remotableQuickFinder.getLookupParameters()); |
378 | 0 | inputField.getFieldLookup().setFieldConversions(remotableQuickFinder.getFieldConversions()); |
379 | |
} |
380 | |
|
381 | 0 | if (remotableField.getControl() != null) { |
382 | 0 | Control control = null; |
383 | |
|
384 | 0 | org.kuali.rice.core.api.uif.Control remotableControl = remotableField.getControl(); |
385 | 0 | if (remotableControl instanceof RemotableHiddenInput) { |
386 | 0 | control = getHiddenControl(); |
387 | 0 | } else if (remotableControl instanceof RemotableRadioButtonGroup) { |
388 | 0 | RemotableRadioButtonGroup remotableRadioButtonGroup = (RemotableRadioButtonGroup) remotableControl; |
389 | 0 | control = getRadioGroupControl(); |
390 | 0 | ((RadioGroupControl) control).setOptions(buildKeyValuePairs(remotableRadioButtonGroup.getKeyLabels())); |
391 | 0 | } else if (remotableControl instanceof RemotableSelect) { |
392 | 0 | RemotableSelect remotableSelect = (RemotableSelect) remotableControl; |
393 | 0 | control = getSelectControl(); |
394 | |
|
395 | 0 | Map<String, String> keyLabels = new HashMap<String, String>(); |
396 | 0 | if ((remotableSelect.getGroups() != null) && (!remotableSelect.getGroups().isEmpty())) { |
397 | 0 | for (RemotableSelectGroup remotableSelectGroup : remotableSelect.getGroups()) { |
398 | 0 | keyLabels.putAll(remotableSelectGroup.getKeyLabels()); |
399 | |
} |
400 | |
} else { |
401 | 0 | keyLabels = remotableSelect.getKeyLabels(); |
402 | |
} |
403 | |
|
404 | 0 | ((SelectControl) control).setOptions(buildKeyValuePairs(keyLabels)); |
405 | 0 | if (remotableSelect.getSize() != null) { |
406 | 0 | ((SelectControl) control).setSize(remotableSelect.getSize()); |
407 | |
} |
408 | 0 | ((SelectControl) control).setMultiple(remotableSelect.isMultiple()); |
409 | 0 | } else if (remotableControl instanceof RemotableCheckboxGroup) { |
410 | 0 | RemotableCheckboxGroup remotableCheckboxGroup = (RemotableCheckboxGroup) remotableControl; |
411 | 0 | control = getCheckboxGroupControl(); |
412 | 0 | ((CheckboxGroupControl) control).setOptions(buildKeyValuePairs(remotableCheckboxGroup.getKeyLabels())); |
413 | 0 | } else if (remotableControl instanceof RemotableTextarea) { |
414 | 0 | RemotableTextarea remotableTextarea = (RemotableTextarea) remotableControl; |
415 | 0 | control = getTextAreaControl(); |
416 | |
|
417 | 0 | if (remotableTextExpand != null) { |
418 | 0 | ((TextAreaControl) control).setTextExpand(true); |
419 | |
} |
420 | 0 | ((TextAreaControl) control).setRows(remotableTextarea.getRows()); |
421 | 0 | ((TextAreaControl) control).setCols(remotableTextarea.getCols()); |
422 | 0 | ((TextAreaControl) control).setWatermarkText(remotableTextarea.getWatermark()); |
423 | |
|
424 | 0 | } else if (remotableControl instanceof RemotableTextInput) { |
425 | 0 | RemotableTextInput remotableTextInput = (RemotableTextInput) remotableControl; |
426 | |
|
427 | 0 | if (remotableDatepicker != null) { |
428 | 0 | control = getDateControl(); |
429 | |
} else { |
430 | 0 | control = getTextControl(); |
431 | |
} |
432 | |
|
433 | 0 | if (remotableTextExpand != null) { |
434 | 0 | ((TextAreaControl) control).setTextExpand(true); |
435 | |
} |
436 | 0 | ((TextControl) control).setSize(remotableTextInput.getSize()); |
437 | 0 | ((TextControl) control).setWatermarkText(remotableTextInput.getWatermark()); |
438 | |
} |
439 | |
|
440 | 0 | inputField.setControl(control); |
441 | |
} |
442 | |
|
443 | 0 | return inputField; |
444 | |
} |
445 | |
|
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
|
454 | |
public static List<InputField> translateRemotableFields(List<RemotableAttributeField> remotableFields) { |
455 | 0 | List<InputField> inputFields = new ArrayList<InputField>(); |
456 | |
|
457 | 0 | for (RemotableAttributeField remotableField : remotableFields) { |
458 | 0 | inputFields.add(translateRemotableField(remotableField)); |
459 | |
} |
460 | |
|
461 | 0 | return inputFields; |
462 | |
} |
463 | |
|
464 | |
protected static List<KeyValue> buildKeyValuePairs(Map<String, String> optionsMap) { |
465 | 0 | List<KeyValue> options = new ArrayList<KeyValue>(); |
466 | |
|
467 | 0 | for (Map.Entry<String, String> optionEntry : optionsMap.entrySet()) { |
468 | 0 | KeyValue keyValue = new ConcreteKeyValue(optionEntry.getKey(), optionEntry.getValue()); |
469 | 0 | options.add(keyValue); |
470 | 0 | } |
471 | |
|
472 | 0 | return options; |
473 | |
} |
474 | |
|
475 | |
protected static Control getControl(UifConstants.ControlType controlType) { |
476 | 0 | Control control = null; |
477 | 0 | switch (controlType) { |
478 | |
case CHECKBOX: |
479 | 0 | control = getCheckboxControl(); |
480 | |
case CHECKBOXGROUP: |
481 | 0 | control = getCheckboxGroupControl(); |
482 | |
case FILE: |
483 | 0 | control = getFileControl(); |
484 | |
case GROUP: |
485 | 0 | control = getGroupControl(); |
486 | |
case HIDDEN: |
487 | 0 | control = getHiddenControl(); |
488 | |
case RADIOGROUP: |
489 | 0 | control = getRadioGroupControl(); |
490 | |
case SELECT: |
491 | 0 | control = getSelectControl(); |
492 | |
case TEXTAREA: |
493 | 0 | control = getTextAreaControl(); |
494 | |
case TEXT: |
495 | 0 | control = getTextControl(); |
496 | |
case USER: |
497 | 0 | control = getUserControl(); |
498 | |
} |
499 | |
|
500 | 0 | return control; |
501 | |
} |
502 | |
|
503 | |
public static ErrorsField getErrorsField() { |
504 | 0 | return (ErrorsField) getNewComponentInstance(ERRORS_FIELD); |
505 | |
} |
506 | |
|
507 | |
public static ActionField getActionField() { |
508 | 0 | return (ActionField) getNewComponentInstance(ACTION_FIELD); |
509 | |
} |
510 | |
|
511 | |
public static ActionField getActionLinkField() { |
512 | 0 | return (ActionField) getNewComponentInstance(ACTION_LINK_FIELD); |
513 | |
} |
514 | |
|
515 | |
public static LinkField getLinkField() { |
516 | 0 | return (LinkField) getNewComponentInstance(LINK_FIELD); |
517 | |
} |
518 | |
|
519 | |
public static IframeField getIframeField() { |
520 | 0 | return (IframeField) getNewComponentInstance(IFRAME_FIELD); |
521 | |
} |
522 | |
|
523 | |
public static ImageField getImageField() { |
524 | 0 | return (ImageField) getNewComponentInstance(IMAGE_FIELD); |
525 | |
} |
526 | |
|
527 | |
public static BlankField getBlankField() { |
528 | 0 | return (BlankField) getNewComponentInstance(BLANK_FIELD); |
529 | |
} |
530 | |
|
531 | |
public static GenericField getGenericField() { |
532 | 0 | return (GenericField) getNewComponentInstance(GENERIC_FIELD); |
533 | |
} |
534 | |
|
535 | |
public static LabelField getLabelField() { |
536 | 0 | return (LabelField) getNewComponentInstance(LABEL_FIELD); |
537 | |
} |
538 | |
|
539 | |
public static MessageField getMessageField() { |
540 | 0 | return (MessageField) getNewComponentInstance(MESSAGE_FIELD); |
541 | |
} |
542 | |
|
543 | |
public static FieldGroup getFieldGroup() { |
544 | 0 | return (FieldGroup) getNewComponentInstance(FIELD_GROUP); |
545 | |
} |
546 | |
|
547 | |
public static FieldGroup getHorizontalFieldGroup() { |
548 | 0 | return (FieldGroup) getNewComponentInstance(HORIZONTAL_FIELD_GROUP); |
549 | |
} |
550 | |
|
551 | |
public static Group getGroup() { |
552 | 0 | return (Group) getNewComponentInstance(GROUP); |
553 | |
} |
554 | |
|
555 | |
public static PageGroup getPageGroup() { |
556 | 0 | return (PageGroup) getNewComponentInstance(PAGE_GROUP); |
557 | |
} |
558 | |
|
559 | |
public static Group getGroupGridLayout() { |
560 | 0 | return (Group) getNewComponentInstance(GROUP_GRID_LAYOUT); |
561 | |
} |
562 | |
|
563 | |
public static Group getGroupBodyOnly() { |
564 | 0 | return (Group) getNewComponentInstance(GROUP_BODY_ONLY); |
565 | |
} |
566 | |
|
567 | |
public static Group getGroupGridBodyOnly() { |
568 | 0 | return (Group) getNewComponentInstance(GROUP_GRID_BODY_ONLY); |
569 | |
} |
570 | |
|
571 | |
public static TabGroup getTabGroup() { |
572 | 0 | return (TabGroup) getNewComponentInstance(TAB_GROUP); |
573 | |
} |
574 | |
|
575 | |
public static NavigationGroup getNavigationGroup() { |
576 | 0 | return (NavigationGroup) getNewComponentInstance(NAVIGATION_GROUP); |
577 | |
} |
578 | |
|
579 | |
public static TreeGroup getTreeGroup() { |
580 | 0 | return (TreeGroup) getNewComponentInstance(TREE_GROUP); |
581 | |
} |
582 | |
|
583 | |
public static LinkGroup getLinkGroup() { |
584 | 0 | return (LinkGroup) getNewComponentInstance(LINK_GROUP); |
585 | |
} |
586 | |
|
587 | |
public static CollectionGroup getCollectionGroup() { |
588 | 0 | return (CollectionGroup) getNewComponentInstance(COLLECTION_GROUP); |
589 | |
} |
590 | |
|
591 | |
public static CollectionGroup getCollectionGroupTableLayout() { |
592 | 0 | return (CollectionGroup) getNewComponentInstance(COLLECTION_GROUP_TABLE_LAYOUT); |
593 | |
} |
594 | |
|
595 | |
public static CollectionGroup getListGroup() { |
596 | 0 | return (CollectionGroup) getNewComponentInstance(LIST_GROUP); |
597 | |
} |
598 | |
|
599 | |
public static HeaderField getHeader() { |
600 | 0 | return (HeaderField) getNewComponentInstance(HEADER); |
601 | |
} |
602 | |
|
603 | |
public static Group getFooter() { |
604 | 0 | return (Group) getNewComponentInstance(FOOTER); |
605 | |
} |
606 | |
|
607 | |
public static Group getFooterSaveCloseCancel() { |
608 | 0 | return (Group) getNewComponentInstance(FOOTER_SAVECLOSECANCEL); |
609 | |
} |
610 | |
|
611 | |
} |