1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.student.enrollment.class2.courseoffering.keyvalue;
18
19 import org.kuali.rice.core.api.util.ConcreteKeyValue;
20 import org.kuali.rice.core.api.util.KeyValue;
21 import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
22 import org.kuali.rice.krad.uif.view.ViewModel;
23 import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
24 import org.kuali.student.enrollment.class2.courseoffering.dto.CourseOfferingEditWrapper;
25
26 import java.io.Serializable;
27 import java.util.ArrayList;
28 import java.util.Collections;
29 import java.util.List;
30
31
32
33
34
35
36 public class MultipleCreditOptionsKeyValues extends UifKeyValuesFinderBase implements Serializable {
37
38 private static final long serialVersionUID = 1L;
39
40 @Override
41 public List<KeyValue> getKeyValues(ViewModel model) {
42 MaintenanceDocumentForm form1 = (MaintenanceDocumentForm)model;
43 CourseOfferingEditWrapper form = (CourseOfferingEditWrapper)form1.getDocument().getDocumentDataObject();
44
45 List<KeyValue> keyValues = new ArrayList<KeyValue>();
46
47 List<Float> creditOptionsF = new ArrayList();
48 for(String creditOption : form.getCreditOption().getAllowedCredits()){
49 creditOptionsF.add(Float.valueOf(creditOption));
50 }
51 Collections.sort(creditOptionsF);
52 for(Float creditOption : creditOptionsF){
53 keyValues.add(new ConcreteKeyValue(String.valueOf(creditOption), String.valueOf(creditOption)));
54 }
55
56 return keyValues;
57 }
58
59 }