Coverage Report - org.kuali.student.lum.program.client.core.view.CoreInformationViewConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
CoreInformationViewConfiguration
0%
0/41
N/A
1
 
 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  
  * @author Igor
 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  
         //Add this field and hide it so it is available for cross field validation 
 72  0
         FieldDescriptor fd = configurer.addField(section,ProgramConstants.PREV_START_TERM, new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevStartTerm()));
 73  0
         fd.getFieldWidget().setVisible(false);
 74  0
         fd.hideLabel();
 75  
 
 76  0
         configurer.addReadOnlyField(section, ProgramConstants.START_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_startTerm()));
 77  0
         configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_entryTerm()));
 78  0
         configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_enrollTerm()));
 79  0
         configurer.addReadOnlyField(section, ProgramConstants.PROGRAM_APPROVAL_DATE, new MessageKeyInfo(ProgramProperties.get().programInformation_approvalDate()));
 80  0
         return section;
 81  
     }
 82  
 
 83  
     public VerticalSection createActivateProgramSection() {
 84  0
         VerticalSection section = new VerticalSection(SectionTitle.generateH2Title(ProgramProperties.get().programInformation_activateProgram()));
 85  0
         section.setInstructions("<br>" + ProgramProperties.get().programInformation_activateInstructions() + "<br><br>");
 86  0
         configurer.addField(section, "proposal/"+ProgramConstants.PREV_END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_entryTerm()));
 87  0
         configurer.addField(section, "proposal/"+ProgramConstants.PREV_END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_enrollTerm()));
 88  0
         return section;
 89  
     }
 90  
 
 91  
 }