1 | |
package org.kuali.student.lum.program.client.core.edit; |
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.BaseSection; |
7 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.HorizontalSection; |
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.ProgramSections; |
14 | |
import org.kuali.student.lum.program.client.core.CredentialProgramsBinding; |
15 | |
import org.kuali.student.lum.program.client.properties.ProgramProperties; |
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
public class CoreInformationEditConfiguration extends AbstractSectionConfiguration { |
21 | |
|
22 | 0 | public CoreInformationEditConfiguration() { |
23 | 0 | rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_EDIT, ProgramProperties.get().program_menu_sections_programInformation(), ProgramConstants.PROGRAM_MODEL_ID); |
24 | 0 | } |
25 | |
|
26 | |
@Override |
27 | |
protected void buildLayout() { |
28 | 0 | HorizontalSection horizontalSection = new HorizontalSection(); |
29 | 0 | horizontalSection.addSection(createLeftSection()); |
30 | 0 | horizontalSection.addSection(createRightSection()); |
31 | 0 | rootSection.addSection(horizontalSection); |
32 | 0 | } |
33 | |
|
34 | |
private VerticalSection createLeftSection() { |
35 | 0 | VerticalSection section = new VerticalSection(); |
36 | 0 | section.addSection(createKeyProgramInformationSection()); |
37 | 0 | section.addSection(createProgramTitleSection()); |
38 | 0 | section.addSection(createDatesSection()); |
39 | 0 | return section; |
40 | |
} |
41 | |
|
42 | |
private VerticalSection createRightSection() { |
43 | 0 | VerticalSection section = new VerticalSection(); |
44 | 0 | section.addStyleName("readOnlySection"); |
45 | 0 | section.addSection(createReadOnlySection()); |
46 | 0 | return section; |
47 | |
} |
48 | |
|
49 | |
private VerticalSection createKeyProgramInformationSection() { |
50 | 0 | VerticalSection section = new VerticalSection(); |
51 | 0 | configurer.addField(section, ProgramConstants.CODE, new MessageKeyInfo(ProgramProperties.get().programInformation_code())); |
52 | 0 | return section; |
53 | |
} |
54 | |
|
55 | |
private VerticalSection createProgramTitleSection() { |
56 | 0 | VerticalSection section = new VerticalSection(); |
57 | 0 | configurer.addField(section, ProgramConstants.LONG_TITLE, new MessageKeyInfo(ProgramProperties.get().programInformation_titleFull())); |
58 | 0 | configurer.addField(section, ProgramConstants.SHORT_TITLE, new MessageKeyInfo(ProgramProperties.get().programInformation_titleShort())); |
59 | 0 | configurer.addField(section, ProgramConstants.TRANSCRIPT, new MessageKeyInfo(ProgramProperties.get().programInformation_titleTranscript())); |
60 | 0 | return section; |
61 | |
} |
62 | |
|
63 | |
private VerticalSection createDatesSection() { |
64 | 0 | VerticalSection section = new VerticalSection(SectionTitle.generateH3Title(ProgramProperties.get().programInformation_dates())); |
65 | |
|
66 | 0 | FieldDescriptor fd = configurer.addField(section,ProgramConstants.PROPOSAL_PREV_START_TERM_PATH, new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevStartTerm())); |
67 | 0 | fd.getFieldWidget().setVisible(false); |
68 | 0 | fd.hideLabel(); |
69 | 0 | configurer.addField(section, ProgramConstants.START_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_startTerm())); |
70 | 0 | configurer.addField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_entryTerm())); |
71 | 0 | configurer.addField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_enrollTerm())); |
72 | 0 | return section; |
73 | |
} |
74 | |
|
75 | |
private VerticalSection createReadOnlySection() { |
76 | 0 | VerticalSection section = new VerticalSection(); |
77 | 0 | addCredentialPrograms(section); |
78 | 0 | return section; |
79 | |
} |
80 | |
|
81 | |
private void addCredentialPrograms(BaseSection section) { |
82 | 0 | FieldDescriptor fieldDescriptor = configurer.addReadOnlyField(section, ProgramConstants.CREDENTIAL_PROGRAMS, new MessageKeyInfo(ProgramProperties.get().programInformation_credentialProgram()), new VerticalPanel()); |
83 | 0 | fieldDescriptor.setWidgetBinding(new CredentialProgramsBinding()); |
84 | 0 | } |
85 | |
} |