| 1 |  |  package org.kuali.student.lum.program.client.core.view; | 
  | 2 |  |   | 
  | 3 |  |  import com.google.gwt.user.client.ui.VerticalPanel; | 
  | 4 |  |   | 
  | 5 |  |  import org.kuali.student.common.ui.client.configurable.mvc.Configurer; | 
  | 6 |  |  import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor; | 
  | 7 |  |  import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; | 
  | 8 |  |  import org.kuali.student.common.ui.client.configurable.mvc.sections.HorizontalSection; | 
  | 9 |  |  import org.kuali.student.common.ui.client.configurable.mvc.sections.TableSection; | 
  | 10 |  |  import org.kuali.student.common.ui.client.configurable.mvc.sections.VerticalSection; | 
  | 11 |  |  import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; | 
  | 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.ProgramMsgConstants; | 
  | 15 |  |  import org.kuali.student.lum.program.client.ProgramSections; | 
  | 16 |  |  import org.kuali.student.lum.program.client.core.CoreEditableHeader; | 
  | 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(Configurer configurer) { | 
  | 25 | 0 |          return new CoreInformationViewConfiguration(configurer, false); | 
  | 26 |  |      } | 
  | 27 |  |   | 
  | 28 |  |      public static CoreInformationViewConfiguration createSpecial(Configurer configurer) { | 
  | 29 | 0 |          return new CoreInformationViewConfiguration(configurer, true); | 
  | 30 |  |      } | 
  | 31 |  |   | 
  | 32 | 0 |      private CoreInformationViewConfiguration(Configurer configurer, boolean isSpecial) { | 
  | 33 | 0 |          this.setConfigurer(configurer); | 
  | 34 | 0 |          String title = getLabel(ProgramMsgConstants.PROGRAM_MENU_SECTIONS_PROGRAMINFORMATION); | 
  | 35 | 0 |          if (!isSpecial){ | 
  | 36 | 0 |              this.rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW,  | 
  | 37 |  |                  title, ProgramConstants.PROGRAM_MODEL_ID); | 
  | 38 |  |          } else { | 
  | 39 | 0 |              this.rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW,  | 
  | 40 |  |                      title, ProgramConstants.PROGRAM_MODEL_ID, new CoreEditableHeader(title, ProgramSections.PROGRAM_DETAILS_EDIT)); | 
  | 41 |  |          } | 
  | 42 | 0 |          rootSection.addStyleName("programInformationView"); | 
  | 43 | 0 |      } | 
  | 44 |  |   | 
  | 45 |  |      @Override | 
  | 46 |  |      protected void buildLayout() { | 
  | 47 | 0 |          HorizontalSection section = new HorizontalSection(); | 
  | 48 | 0 |          section.addSection(createIdentifyingDetailsSection()); | 
  | 49 | 0 |          section.addSection(createProgramTitleSection()); | 
  | 50 | 0 |          section.nextRow(); | 
  | 51 | 0 |          section.addSection(createDatesSection()); | 
  | 52 | 0 |          rootSection.addSection(section); | 
  | 53 | 0 |      } | 
  | 54 |  |   | 
  | 55 |  |      private TableSection createIdentifyingDetailsSection() { | 
  | 56 | 0 |          TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_IDENTIFYINGDETAILS))); | 
  | 57 | 0 |          configurer.addReadOnlyField(section, ProgramConstants.CODE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_CODE)); | 
  | 58 | 0 |          addCredentialPrograms(section); | 
  | 59 | 0 |          return section; | 
  | 60 |  |      } | 
  | 61 |  |   | 
  | 62 |  |      private void addCredentialPrograms(TableSection section) { | 
  | 63 | 0 |          FieldDescriptor fieldDescriptor = configurer.addReadOnlyField(section, ProgramConstants.CREDENTIAL_PROGRAMS, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_CREDENTIALPROGRAM), new VerticalPanel()); | 
  | 64 | 0 |          fieldDescriptor.setWidgetBinding(new CredentialProgramsBinding()); | 
  | 65 | 0 |      } | 
  | 66 |  |   | 
  | 67 |  |      private TableSection createProgramTitleSection() { | 
  | 68 | 0 |          TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_PROGRAMTITLE))); | 
  | 69 | 0 |          configurer.addReadOnlyField(section, ProgramConstants.LONG_TITLE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLEFULL)); | 
  | 70 | 0 |          configurer.addReadOnlyField(section, ProgramConstants.SHORT_TITLE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLESHORT)); | 
  | 71 | 0 |          configurer.addReadOnlyField(section, ProgramConstants.TRANSCRIPT, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLETRANSCRIPT)); | 
  | 72 | 0 |          return section; | 
  | 73 |  |      } | 
  | 74 |  |   | 
  | 75 |  |      private TableSection createDatesSection() { | 
  | 76 | 0 |          TableSection section = new TableSection(SectionTitle.generateH4Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_DATES))); | 
  | 77 |  |           | 
  | 78 | 0 |          FieldDescriptor fd = configurer.addField(section,ProgramConstants.PREV_START_TERM, generateMessageInfo(ProgramMsgConstants.MAJORDISCIPLINE_PREVSTARTTERM)); | 
  | 79 | 0 |          fd.getFieldWidget().setVisible(false); | 
  | 80 | 0 |          fd.hideLabel(); | 
  | 81 |  |   | 
  | 82 | 0 |          configurer.addReadOnlyField(section, ProgramConstants.START_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_STARTTERM)); | 
  | 83 | 0 |          configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENTRYTERM)); | 
  | 84 | 0 |          configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENROLLTERM)); | 
  | 85 | 0 |          configurer.addReadOnlyField(section, ProgramConstants.PROGRAM_APPROVAL_DATE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_APPROVALDATE)); | 
  | 86 | 0 |          return section; | 
  | 87 |  |      } | 
  | 88 |  |   | 
  | 89 |  |      public VerticalSection createActivateProgramSection() { | 
  | 90 | 0 |          VerticalSection section = new VerticalSection(SectionTitle.generateH2Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_ACTIVATEPROGRAM))); | 
  | 91 | 0 |          section.setInstructions("<br>" + getLabel(ProgramMsgConstants.PROGRAMINFORMATION_ACTIVATEINSTRUCTIONS) + "<br><br>"); | 
  | 92 | 0 |          configurer.addField(section, "proposal/"+ProgramConstants.PREV_END_PROGRAM_ENTRY_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENTRYTERM)); | 
  | 93 | 0 |          configurer.addField(section, "proposal/"+ProgramConstants.PREV_END_PROGRAM_ENROLL_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENROLLTERM)); | 
  | 94 | 0 |          return section; | 
  | 95 |  |      } | 
  | 96 |  |   | 
  | 97 |  |  } |