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 | 0 | return new CredentialInformationViewConfiguration(configurer, false); |
24 | |
} |
25 | |
|
26 | |
public static CredentialInformationViewConfiguration createSpecial(Configurer configurer) { |
27 | 0 | return new CredentialInformationViewConfiguration(configurer, true); |
28 | |
} |
29 | |
|
30 | 0 | private CredentialInformationViewConfiguration(Configurer configurer, boolean isSpecial) { |
31 | 0 | this.setConfigurer(configurer); |
32 | 0 | String title = getLabel(ProgramMsgConstants.PROGRAM_MENU_SECTIONS_PROGRAMINFORMATION); |
33 | 0 | if (!isSpecial){ |
34 | 0 | this.rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW, |
35 | |
title, ProgramConstants.PROGRAM_MODEL_ID); |
36 | |
} else { |
37 | 0 | this.rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW, title, |
38 | |
ProgramConstants.PROGRAM_MODEL_ID, new CredentialEditableHeader(title, ProgramSections.PROGRAM_DETAILS_EDIT)); |
39 | |
} |
40 | 0 | rootSection.addStyleName("programInformationView"); |
41 | 0 | } |
42 | |
|
43 | |
@Override |
44 | |
protected void buildLayout() { |
45 | 0 | HorizontalSection section = new HorizontalSection(); |
46 | 0 | section.addSection(createIdentifyingDetailsSection()); |
47 | 0 | section.addSection(createProgramTitleSection()); |
48 | 0 | section.nextRow(); |
49 | 0 | section.addSection(createDatesSection()); |
50 | 0 | section.addSection(createOtherInformationSection()); |
51 | 0 | rootSection.addSection(section); |
52 | 0 | } |
53 | |
|
54 | |
private TableSection createIdentifyingDetailsSection() { |
55 | 0 | TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_IDENTIFYINGDETAILS))); |
56 | 0 | configurer.addReadOnlyField(section, ProgramConstants.CODE, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_CODE)); |
57 | 0 | configurer.addReadOnlyField(section, ProgramConstants.PROGRAM_LEVEL, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_LEVEL)); |
58 | 0 | configurer.addReadOnlyField(section, ProgramConstants.DEGREE_TYPE, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_DEGREETYPE)); |
59 | 0 | return section; |
60 | |
} |
61 | |
|
62 | |
private TableSection createProgramTitleSection() { |
63 | 0 | TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_PROGRAMTITLE))); |
64 | 0 | configurer.addReadOnlyField(section, ProgramConstants.LONG_TITLE, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLEFULL)); |
65 | 0 | configurer.addReadOnlyField(section, ProgramConstants.SHORT_TITLE, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLESHORT)); |
66 | 0 | return section; |
67 | |
} |
68 | |
|
69 | |
private TableSection createDatesSection() { |
70 | 0 | TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_DATES))); |
71 | |
|
72 | 0 | FieldDescriptor fd = configurer.addField(section, ProgramConstants.PREV_START_TERM, new MessageKeyInfo(ProgramMsgConstants.MAJORDISCIPLINE_PREVSTARTTERM)); |
73 | 0 | fd.getFieldWidget().setVisible(false); |
74 | 0 | fd.hideLabel(); |
75 | |
|
76 | 0 | configurer.addReadOnlyField(section, ProgramConstants.START_TERM, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_STARTTERM)); |
77 | 0 | configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENTRYTERM)); |
78 | 0 | configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENROLLTERM)); |
79 | 0 | return section; |
80 | |
} |
81 | |
|
82 | |
private TableSection createOtherInformationSection() { |
83 | 0 | TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_OTHERINFORMATION))); |
84 | 0 | configurer.addReadOnlyField(section, ProgramConstants.INSTITUTION + "/" + ProgramConstants.ORG_ID, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_INSTITUTION)); |
85 | 0 | return section; |
86 | |
} |
87 | |
|
88 | |
public VerticalSection createActivateProgramSection() { |
89 | 0 | final VerticalSection section = new VerticalSection(SectionTitle.generateH2Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_ACTIVATEPROGRAM))); |
90 | 0 | section.setInstructions("<br>" + getLabel(ProgramMsgConstants.PROGRAMINFORMATION_ACTIVATEINSTRUCTIONS) + "<br><br>"); |
91 | 0 | configurer.addField(section, "proposal/" + ProgramConstants.PREV_END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENTRYTERM)); |
92 | 0 | configurer.addField(section, "proposal/" + ProgramConstants.PREV_END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENROLLTERM)); |
93 | 0 | return section; |
94 | |
} |
95 | |
} |