1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.enrollment.class1.krms.util;
17
18 import org.kuali.rice.krad.uif.UifParameters;
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.Group;
22 import org.kuali.rice.krad.uif.element.Action;
23 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleUtils;
24 import org.kuali.rice.krad.uif.util.ComponentUtils;
25 import org.kuali.rice.krms.dto.AgendaEditor;
26 import org.kuali.rice.krms.util.AgendaBuilder;
27 import org.kuali.rice.krms.util.AgendaSection;
28
29 import java.util.List;
30
31
32
33
34 public class FinalExamAgendaBuilder extends AgendaBuilder {
35
36
37
38
39
40
41
42 public Component buildAgenda(AgendaEditor agenda, int index, AgendaSection agendaSection) {
43
44 FinalExamAgendaSection feAgendaSection;
45 if (agendaSection instanceof FinalExamAgendaSection) {
46 feAgendaSection = (FinalExamAgendaSection) agendaSection;
47
48 String agendaSuffix = "_agenda" + Integer.toString(index);
49 Group group = ComponentUtils.copy(feAgendaSection.getAgendaPrototypeMap().get(agenda.getAgendaTypeInfo().getType()), agendaSuffix);
50 group.setHeaderText(agenda.getAgendaTypeInfo().getDescription());
51
52 String bindingPrefix = "agendas[" + index + "]";
53 List<CollectionGroup> components = ViewLifecycleUtils.getElementsOfTypeDeep(group, CollectionGroup.class);
54 for (CollectionGroup fieldCollectionGroup : components) {
55 ComponentUtils.prefixBindingPath(fieldCollectionGroup, bindingPrefix);
56 fieldCollectionGroup.setSubCollectionSuffix(agendaSuffix);
57 }
58
59 List<Action> actionLinks = ViewLifecycleUtils.getElementsOfTypeDeep(group, Action.class);
60 for (Action actionLink : actionLinks) {
61 actionLink.getActionParameters().put(UifParameters.SELECTED_LINE_INDEX, "" + index);
62 }
63
64 return group;
65 }
66 throw new RuntimeException("Error retrieving Maintenance document form from UifFormBase");
67 }
68
69 }