1 | |
package org.kuali.student.lum.program.client.core.view; |
2 | |
|
3 | |
import com.google.gwt.user.client.ui.VerticalPanel; |
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.SectionView; |
10 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
11 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo; |
12 | |
import org.kuali.student.lum.common.client.configuration.AbstractSectionConfiguration; |
13 | |
import org.kuali.student.lum.program.client.ProgramConstants; |
14 | |
import org.kuali.student.lum.program.client.ProgramSections; |
15 | |
import org.kuali.student.lum.program.client.core.CoreEditableHeader; |
16 | |
import org.kuali.student.lum.program.client.properties.ProgramProperties; |
17 | |
import org.kuali.student.lum.program.client.core.CredentialProgramsBinding; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
public class CoreInformationViewConfiguration extends AbstractSectionConfiguration { |
23 | |
|
24 | |
public static CoreInformationViewConfiguration create() { |
25 | 0 | CoreInformationViewConfiguration instance = new CoreInformationViewConfiguration(new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW, ProgramProperties.get().program_menu_sections_programInformation(), ProgramConstants.PROGRAM_MODEL_ID)); |
26 | 0 | return instance; |
27 | |
} |
28 | |
|
29 | |
public static CoreInformationViewConfiguration createSpecial() { |
30 | 0 | CoreInformationViewConfiguration instance = new CoreInformationViewConfiguration(new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW, ProgramProperties.get().program_menu_sections_programInformation(), ProgramConstants.PROGRAM_MODEL_ID, new CoreEditableHeader(ProgramProperties.get().program_menu_sections_programInformation(), ProgramSections.PROGRAM_DETAILS_EDIT))); |
31 | 0 | return instance; |
32 | |
} |
33 | |
|
34 | 0 | private CoreInformationViewConfiguration(SectionView sectionView) { |
35 | 0 | rootSection = sectionView; |
36 | 0 | rootSection.addStyleName("programInformationView"); |
37 | 0 | } |
38 | |
|
39 | |
@Override |
40 | |
protected void buildLayout() { |
41 | 0 | HorizontalSection section = new HorizontalSection(); |
42 | 0 | section.addSection(createIdentifyingDetailsSection()); |
43 | 0 | section.addSection(createProgramTitleSection()); |
44 | 0 | section.nextRow(); |
45 | 0 | section.addSection(createDatesSection()); |
46 | 0 | rootSection.addSection(section); |
47 | 0 | } |
48 | |
|
49 | |
private TableSection createIdentifyingDetailsSection() { |
50 | 0 | TableSection section = new TableSection(SectionTitle.generateH4Title(ProgramProperties.get().programInformation_identifyingDetails())); |
51 | 0 | configurer.addReadOnlyField(section, ProgramConstants.CODE, new MessageKeyInfo(ProgramProperties.get().programInformation_code())); |
52 | 0 | addCredentialPrograms(section); |
53 | 0 | return section; |
54 | |
} |
55 | |
|
56 | |
private void addCredentialPrograms(TableSection section) { |
57 | 0 | FieldDescriptor fieldDescriptor = configurer.addReadOnlyField(section, ProgramConstants.CREDENTIAL_PROGRAMS, new MessageKeyInfo(ProgramProperties.get().programInformation_credentialProgram()), new VerticalPanel()); |
58 | 0 | fieldDescriptor.setWidgetBinding(new CredentialProgramsBinding()); |
59 | 0 | } |
60 | |
|
61 | |
private TableSection createProgramTitleSection() { |
62 | 0 | TableSection section = new TableSection(SectionTitle.generateH4Title(ProgramProperties.get().programInformation_programTitle())); |
63 | 0 | configurer.addReadOnlyField(section, ProgramConstants.LONG_TITLE, new MessageKeyInfo(ProgramProperties.get().programInformation_titleFull())); |
64 | 0 | configurer.addReadOnlyField(section, ProgramConstants.SHORT_TITLE, new MessageKeyInfo(ProgramProperties.get().programInformation_titleShort())); |
65 | 0 | configurer.addReadOnlyField(section, ProgramConstants.TRANSCRIPT, new MessageKeyInfo(ProgramProperties.get().programInformation_titleTranscript())); |
66 | 0 | return section; |
67 | |
} |
68 | |
|
69 | |
private TableSection createDatesSection() { |
70 | 0 | TableSection section = new TableSection(SectionTitle.generateH4Title(ProgramProperties.get().programInformation_dates())); |
71 | 0 | configurer.addReadOnlyField(section, ProgramConstants.START_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_startTerm())); |
72 | 0 | configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_entryTerm())); |
73 | 0 | configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_enrollTerm())); |
74 | 0 | configurer.addReadOnlyField(section, ProgramConstants.PROGRAM_APPROVAL_DATE, new MessageKeyInfo(ProgramProperties.get().programInformation_approvalDate())); |
75 | 0 | return section; |
76 | |
} |
77 | |
|
78 | |
public VerticalSection createActivateProgramSection() { |
79 | 0 | VerticalSection section = new VerticalSection(SectionTitle.generateH2Title(ProgramProperties.get().programInformation_activateProgram())); |
80 | 0 | section.setInstructions("<br>" + ProgramProperties.get().programInformation_activateInstructions() + "<br><br>"); |
81 | 0 | configurer.addField(section, ProgramConstants.PREV_END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_entryTerm())); |
82 | 0 | configurer.addField(section, ProgramConstants.PREV_END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_enrollTerm())); |
83 | 0 | return section; |
84 | |
} |
85 | |
|
86 | |
} |