Coverage Report - org.kuali.student.lum.program.client.credential.view.CredentialInformationViewConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
CredentialInformationViewConfiguration
0%
0/41
N/A
1
 
 1  
 package org.kuali.student.lum.program.client.credential.view;
 2  
 
 3  
 import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor;
 4  
 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
 5  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.HorizontalSection;
 6  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.TableSection;
 7  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.VerticalSection;
 8  
 import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView;
 9  
 import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
 10  
 import org.kuali.student.common.ui.client.mvc.Controller;
 11  
 import org.kuali.student.common.ui.client.mvc.DataModel;
 12  
 import org.kuali.student.common.ui.client.mvc.ModelRequestCallback;
 13  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo;
 14  
 import org.kuali.student.core.workflow.ui.client.widgets.WorkflowUtilities;
 15  
 import org.kuali.student.lum.common.client.configuration.AbstractSectionConfiguration;
 16  
 import org.kuali.student.lum.program.client.ProgramConstants;
 17  
 import org.kuali.student.lum.program.client.ProgramSections;
 18  
 import org.kuali.student.lum.program.client.credential.CredentialEditableHeader;
 19  
 import org.kuali.student.lum.program.client.properties.ProgramProperties;
 20  
 
 21  
 /**
 22  
  * @author Igor
 23  
  */
 24  
 public class CredentialInformationViewConfiguration extends AbstractSectionConfiguration {
 25  
 
 26  
     public static CredentialInformationViewConfiguration create() {
 27  0
         CredentialInformationViewConfiguration instance = new CredentialInformationViewConfiguration(new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW, ProgramProperties.get().program_menu_sections_programInformation(), ProgramConstants.PROGRAM_MODEL_ID));
 28  0
         return instance;
 29  
     }
 30  
 
 31  
     public static CredentialInformationViewConfiguration createSpecial() {
 32  0
         CredentialInformationViewConfiguration instance = new CredentialInformationViewConfiguration(new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_VIEW, ProgramProperties.get().program_menu_sections_programInformation(), ProgramConstants.PROGRAM_MODEL_ID, new CredentialEditableHeader(ProgramProperties.get().program_menu_sections_programInformation(), ProgramSections.PROGRAM_DETAILS_EDIT)));
 33  0
         return instance;
 34  
     }
 35  
 
 36  0
     private CredentialInformationViewConfiguration(SectionView sectionView) {
 37  0
         rootSection = sectionView;
 38  0
         rootSection.addStyleName("programInformationView");
 39  0
     }
 40  
 
 41  
     @Override
 42  
     protected void buildLayout() {
 43  0
         HorizontalSection section = new HorizontalSection();
 44  0
         section.addSection(createIdentifyingDetailsSection());
 45  0
         section.addSection(createProgramTitleSection());
 46  0
         section.nextRow();
 47  0
         section.addSection(createDatesSection());
 48  0
         section.addSection(createOtherInformationSection());
 49  0
         rootSection.addSection(section);
 50  0
     }
 51  
 
 52  
     private TableSection createIdentifyingDetailsSection() {
 53  0
         TableSection section = new TableSection(SectionTitle.generateH4Title(ProgramProperties.get().programInformation_identifyingDetails()));
 54  0
         configurer.addReadOnlyField(section, ProgramConstants.CODE, new MessageKeyInfo(ProgramProperties.get().programInformation_code()));
 55  0
         configurer.addReadOnlyField(section, ProgramConstants.PROGRAM_LEVEL, new MessageKeyInfo(ProgramProperties.get().programInformation_level()));
 56  0
         configurer.addReadOnlyField(section, ProgramConstants.DEGREE_TYPE, new MessageKeyInfo(ProgramProperties.get().programInformation_degreeType()));
 57  0
         return section;
 58  
     }
 59  
 
 60  
     private TableSection createProgramTitleSection() {
 61  0
         TableSection section = new TableSection(SectionTitle.generateH4Title(ProgramProperties.get().programInformation_programTitle()));
 62  0
         configurer.addReadOnlyField(section, ProgramConstants.LONG_TITLE, new MessageKeyInfo(ProgramProperties.get().programInformation_titleFull()));
 63  0
         configurer.addReadOnlyField(section, ProgramConstants.SHORT_TITLE, new MessageKeyInfo(ProgramProperties.get().programInformation_titleShort()));
 64  0
         return section;
 65  
     }
 66  
 
 67  
     private TableSection createDatesSection() {
 68  0
         TableSection section = new TableSection(SectionTitle.generateH4Title(ProgramProperties.get().programInformation_dates()));
 69  
         //Add this field and hide it so it is available for cross field validation 
 70  0
         FieldDescriptor fd = configurer.addField(section,ProgramConstants.PREV_START_TERM, new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevStartTerm()));
 71  0
         fd.getFieldWidget().setVisible(false);
 72  0
         fd.hideLabel();
 73  
 
 74  
         
 75  0
         configurer.addReadOnlyField(section, ProgramConstants.START_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_startTerm()));
 76  0
         configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_entryTerm()));
 77  0
         configurer.addReadOnlyField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_enrollTerm()));
 78  0
         return section;
 79  
     }
 80  
 
 81  
     private TableSection createOtherInformationSection() {
 82  0
         TableSection section = new TableSection(SectionTitle.generateH4Title(ProgramProperties.get().programInformation_otherInformation()));
 83  0
         configurer.addReadOnlyField(section, ProgramConstants.INSTITUTION + "/" + ProgramConstants.ORG_ID, new MessageKeyInfo(ProgramProperties.get().programInformation_institution()));
 84  0
         return section;
 85  
     }
 86  
 
 87  
     public VerticalSection createActivateProgramSection(){
 88  0
         final VerticalSection section = new VerticalSection(SectionTitle.generateH2Title(ProgramProperties.get().programInformation_activateProgram()));
 89  0
         section.setInstructions("<br>" + ProgramProperties.get().programInformation_activateInstructions() + "<br><br>");
 90  0
         configurer.addField(section, "proposal/"+ProgramConstants.PREV_END_PROGRAM_ENTRY_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_entryTerm()));
 91  0
         configurer.addField(section, "proposal/"+ProgramConstants.PREV_END_PROGRAM_ENROLL_TERM, new MessageKeyInfo(ProgramProperties.get().programInformation_enrollTerm()));
 92  0
         return section;
 93  
     }    
 94  
 }