View Javadoc

1   package org.kuali.student.lum.program.client.credential.edit;
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.VerticalSection;
8   import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
9   import org.kuali.student.lum.common.client.configuration.AbstractSectionConfiguration;
10  import org.kuali.student.lum.program.client.ProgramConstants;
11  import org.kuali.student.lum.program.client.ProgramMsgConstants;
12  import org.kuali.student.lum.program.client.ProgramSections;
13  
14  /**
15   * @author Igor
16   */
17  public class CredentialInformationEditConfiguration extends AbstractSectionConfiguration {
18  
19      public CredentialInformationEditConfiguration(Configurer configurer) {
20          this.setConfigurer(configurer);
21          rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_EDIT, getLabel(ProgramMsgConstants.PROGRAM_MENU_SECTIONS_PROGRAMINFORMATION), 
22                  ProgramConstants.PROGRAM_MODEL_ID);
23      }
24  
25      @Override
26      protected void buildLayout() {
27          HorizontalSection horizontalSection = new HorizontalSection();
28          horizontalSection.addSection(createLeftSection());
29          rootSection.addSection(horizontalSection);
30      }
31  
32      private VerticalSection createLeftSection() {
33          VerticalSection section = new VerticalSection();
34          section.addSection(createKeyProgramInformationSection());
35          section.addSection(createProgramTitleSection());
36          section.addSection(createDatesSection());
37          section.addSection(createOtherInformationSection());
38          return section;
39      }
40  
41      private VerticalSection createKeyProgramInformationSection() {
42          VerticalSection section = new VerticalSection();
43          configurer.addField(section, ProgramConstants.CODE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_CODE));
44          configurer.addField(section, ProgramConstants.PROGRAM_LEVEL, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_LEVEL));
45          configurer.addField(section, ProgramConstants.DEGREE_TYPE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_DEGREETYPE));
46          return section;
47      }
48  
49      private VerticalSection createProgramTitleSection() {
50          VerticalSection section = new VerticalSection();
51          configurer.addField(section, ProgramConstants.LONG_TITLE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLEFULL));
52          configurer.addField(section, ProgramConstants.SHORT_TITLE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLESHORT));
53          return section;
54      }
55  
56      private VerticalSection createDatesSection() {
57          VerticalSection section = new VerticalSection(SectionTitle.generateH3Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_DATES)));
58          //Add this field and hide it so it is available for cross field validation 
59          FieldDescriptor fd = configurer.addField(section,ProgramConstants.PROPOSAL_PREV_START_TERM_PATH, generateMessageInfo(ProgramMsgConstants.MAJORDISCIPLINE_PREVSTARTTERM));
60          fd.getFieldWidget().setVisible(false);
61          fd.hideLabel();
62          configurer.addField(section, ProgramConstants.START_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_STARTTERM));
63          configurer.addField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENTRYTERM));
64          configurer.addField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENROLLTERM));
65          return section;
66      }
67  
68      private VerticalSection createOtherInformationSection() {
69          VerticalSection section = new VerticalSection(SectionTitle.generateH3Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_OTHERINFORMATION)));
70          configurer.addField(section, ProgramConstants.INSTITUTION + "/" + ProgramConstants.ORG_ID, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_INSTITUTION));
71          return section;
72      }
73  }