1 package org.kuali.student.lum.program.client.credential.view;
2
3 import org.kuali.student.common.ui.client.configurable.mvc.Configurer;
4 import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor;
5 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
6 import org.kuali.student.common.ui.client.configurable.mvc.sections.HorizontalSection;
7 import org.kuali.student.common.ui.client.configurable.mvc.sections.TableSection;
8 import org.kuali.student.common.ui.client.configurable.mvc.sections.VerticalSection;
9 import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
10 import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo;
11 import org.kuali.student.lum.common.client.configuration.AbstractSectionConfiguration;
12 import org.kuali.student.lum.program.client.ProgramConstants;
13 import org.kuali.student.lum.program.client.ProgramMsgConstants;
14 import org.kuali.student.lum.program.client.ProgramSections;
15 import org.kuali.student.lum.program.client.credential.CredentialEditableHeader;
16
17
18
19
20 public class CredentialInformationViewConfiguration extends AbstractSectionConfiguration {
21
22 public static CredentialInformationViewConfiguration create(Configurer configurer) {
23 return new CredentialInformationViewConfiguration(configurer, false);
24 }
25
26 public static CredentialInformationViewConfiguration createSpecial(Configurer configurer) {
27 return new CredentialInformationViewConfiguration(configurer, true);
28 }
29
30 private CredentialInformationViewConfiguration(Configurer configurer, boolean isSpecial) {
31 this.setConfigurer(configurer);
32 String title = getLabel(ProgramMsgConstants.PROGRAM_MENU_SECTIONS_PROGRAMINFORMATION);
33 if (!isSpecial){
34 this.rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW,
35 title, ProgramConstants.PROGRAM_MODEL_ID);
36 } else {
37 this.rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW, title,
38 ProgramConstants.PROGRAM_MODEL_ID, new CredentialEditableHeader(title, ProgramSections.PROGRAM_DETAILS_EDIT));
39 }
40 rootSection.addStyleName("programInformationView");
41 }
42
43 @Override
44 protected void buildLayout() {
45 HorizontalSection section = new HorizontalSection();
46 section.addSection(createIdentifyingDetailsSection());
47 section.addSection(createProgramTitleSection());
48 section.nextRow();
49 section.addSection(createDatesSection());
50 section.addSection(createOtherInformationSection());
51 rootSection.addSection(section);
52 }
53
54 private TableSection createIdentifyingDetailsSection() {
55 TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_IDENTIFYINGDETAILS)));
56 configurer.addReadOnlyField(section, ProgramConstants.CODE,
57 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_CODE));
58 configurer.addReadOnlyField(section, ProgramConstants.PROGRAM_LEVEL,
59 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_LEVEL));
60 configurer.addReadOnlyField(section, ProgramConstants.DEGREE_TYPE,
61 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_DEGREETYPE));
62 return section;
63 }
64
65 private TableSection createProgramTitleSection() {
66 TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_PROGRAMTITLE)));
67 configurer.addReadOnlyField(section, ProgramConstants.LONG_TITLE,
68 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_TITLEFULL));
69 configurer.addReadOnlyField(section, ProgramConstants.SHORT_TITLE,
70 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_TITLESHORT));
71 return section;
72 }
73
74 private TableSection createDatesSection() {
75 TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_DATES)));
76
77 FieldDescriptor fd = configurer.addField(section, ProgramConstants.PREV_START_TERM,
78 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.MAJORDISCIPLINE_PREVSTARTTERM));
79 fd.getFieldWidget().setVisible(false);
80 fd.hideLabel();
81
82 configurer.addReadOnlyField(section, ProgramConstants.START_TERM,
83 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_STARTTERM));
84 configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM,
85 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_ENTRYTERM));
86 configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM,
87 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_ENROLLTERM));
88 return section;
89 }
90
91 private TableSection createOtherInformationSection() {
92 TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_OTHERINFORMATION)));
93 configurer.addReadOnlyField(section, ProgramConstants.INSTITUTION + "/" + ProgramConstants.ORG_ID,
94 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_INSTITUTION));
95 return section;
96 }
97
98 public VerticalSection createActivateProgramSection() {
99 final VerticalSection section = new VerticalSection(SectionTitle.generateH2Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_ACTIVATEPROGRAM)));
100 section.setInstructions("<br>" + getLabel(ProgramMsgConstants.PROGRAMINFORMATION_ACTIVATEINSTRUCTIONS) + "<br><br>");
101 configurer.addField(section, "proposal/" + ProgramConstants.PREV_END_PROGRAM_ENTRY_TERM,
102 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_ENTRYTERM));
103 configurer.addField(section, "proposal/" + ProgramConstants.PREV_END_PROGRAM_ENROLL_TERM,
104 new MessageKeyInfo(ProgramMsgConstants.PROGRAM_MSG_GROUP, "course", ProgramMsgConstants.STATUS_ACTIVE, ProgramMsgConstants.PROGRAMINFORMATION_ENROLLTERM));
105 return section;
106 }
107 }