Coverage Report - org.kuali.student.lum.program.client.major.proposal.MajorProposalSummaryConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
MajorProposalSummaryConfiguration
0%
0/26
0%
0/8
2.4
MajorProposalSummaryConfiguration$1
0%
0/4
0%
0/2
2.4
MajorProposalSummaryConfiguration$2
0%
0/14
0%
0/4
2.4
 
 1  
 package org.kuali.student.lum.program.client.major.proposal;
 2  
 
 3  
 import org.kuali.student.common.ui.client.configurable.mvc.Configurer;
 4  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.Section;
 5  
 import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
 6  
 import org.kuali.student.common.ui.client.mvc.Callback;
 7  
 import org.kuali.student.common.ui.client.mvc.DataModel;
 8  
 import org.kuali.student.common.ui.client.mvc.ModelRequestCallback;
 9  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo;
 10  
 import org.kuali.student.core.workflow.ui.client.widgets.WorkflowUtilities;
 11  
 import org.kuali.student.lum.common.client.configuration.AbstractControllerConfiguration;
 12  
 import org.kuali.student.lum.common.client.configuration.Configuration;
 13  
 import org.kuali.student.lum.common.client.configuration.ConfigurationManager;
 14  
 import org.kuali.student.lum.common.client.lu.LUUIConstants;
 15  
 import org.kuali.student.lum.program.client.ProgramConstants;
 16  
 import org.kuali.student.lum.program.client.ProgramSections;
 17  
 import org.kuali.student.lum.program.client.major.view.CatalogInformationViewConfiguration;
 18  
 import org.kuali.student.lum.program.client.major.view.LearningObjectivesViewConfiguration;
 19  
 import org.kuali.student.lum.program.client.major.view.MajorKeyProgramInfoViewConfiguration;
 20  
 import org.kuali.student.lum.program.client.major.view.ManagingBodiesViewConfiguration;
 21  
 import org.kuali.student.lum.program.client.major.view.ProgramRequirementsViewConfiguration;
 22  
 import org.kuali.student.lum.program.client.major.view.SpecializationsViewConfiguration;
 23  
 import org.kuali.student.lum.program.client.major.view.SupportingDocsViewConfiguration;
 24  
 import org.kuali.student.lum.program.client.properties.ProgramProperties;
 25  
 
 26  
 import com.google.gwt.user.client.ui.Widget;
 27  
 
 28  
 /**
 29  
  * This configuration is used to define what widgets should appear on the screen
 30  
  * for the major proposal controller.  
 31  
  * <p>
 32  
  * Note that this is pretty much a copy of the major discipline controller, 
 33  
  * but this controller has a couple extra tabs .
 34  
  * 
 35  
  * @author cmann
 36  
  */
 37  0
 public class MajorProposalSummaryConfiguration extends AbstractControllerConfiguration {
 38  
 
 39  0
     public MajorProposalSummaryConfiguration() {
 40  0
         rootSection = new VerticalSectionView(ProgramSections.SUMMARY, ProgramProperties.get().proposal_menu_sections_summary(), ProgramConstants.PROGRAM_MODEL_ID, true);
 41  0
     }
 42  
 
 43  
     /**
 44  
      * This is an inherited method called by the framework to layout components on the screen.
 45  
      */
 46  
     @Override
 47  
     protected void buildLayout() {
 48  0
         ConfigurationManager configurationManager = new ConfigurationManager(configurer);
 49  
             
 50  
         // Initialize tabs on left of screen
 51  0
         MajorKeyProgramInfoViewConfiguration majorInfoViewConfig = MajorKeyProgramInfoViewConfiguration.createSpecial(controller);
 52  0
         configurationManager.registerConfiguration(majorInfoViewConfig);
 53  0
         configurationManager.registerConfiguration(ManagingBodiesViewConfiguration.createSpecial(controller));
 54  0
         configurationManager.registerConfiguration(SpecializationsViewConfiguration.createSpecial(controller));
 55  0
         configurationManager.registerConfiguration(CatalogInformationViewConfiguration.createSpecial(controller));
 56  0
         configurationManager.registerConfiguration(new ProgramRequirementsViewConfiguration(controller));
 57  0
         configurationManager.registerConfiguration(LearningObjectivesViewConfiguration.createSpecial(controller));
 58  0
         configurationManager.registerConfiguration(SupportingDocsViewConfiguration.createSpecial(controller));
 59  
 
 60  
         // Add the work flow utilities to the screen light box to the screen
 61  
         // Instance of check ensures we only do this for majors
 62  0
         if (controller instanceof MajorProposalController){
 63  
             
 64  
             // Grab the work flow utilities widget we initialized in the controller
 65  0
             final WorkflowUtilities workflowUtilities = ((MajorProposalController) controller).getWfUtilities();
 66  0
             workflowUtilities.addSubmitCallback(new Callback<Boolean>() {
 67  
 
 68  
                 @Override
 69  
                 public void exec(Boolean result) {
 70  0
                     if (result) {
 71  0
                         ((MajorProposalController) controller).setStatus();
 72  
                     }
 73  
 
 74  0
                 }
 75  
             });
 76  
             //Add fields to workflow utils screens
 77  0
             if(workflowUtilities!=null){
 78  0
                     controller.requestModel(new ModelRequestCallback<DataModel>(){
 79  
                                         public void onModelReady(DataModel model) {
 80  
                                                 //Only display if this is a modification
 81  0
                                                 String versionedFromId = model.get("versionInfo/versionedFromId");
 82  0
                                                 if(versionedFromId!=null && !versionedFromId.isEmpty()){
 83  
                                                         //Add the previous start term since we need it as a widget so it can act as a cross field constraint
 84  0
                                                         workflowUtilities.addApproveDialogField("", "startTerm",  new MessageKeyInfo(ProgramProperties.get().programInformation_startTerm()), MajorProposalSummaryConfiguration.this.configurer.getModelDefinition(), true, true);
 85  0
                                                     workflowUtilities.addApproveDialogField("proposal", "prevEndTerm", new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevEndTerm()), MajorProposalSummaryConfiguration.this.configurer.getModelDefinition(),false);
 86  0
                                                         workflowUtilities.addApproveDialogField("proposal", "prevEndProgramEntryTerm", new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevEndProgramEntryTerm()), MajorProposalSummaryConfiguration.this.configurer.getModelDefinition(),false);
 87  0
                                                         workflowUtilities.addApproveDialogField("proposal", "prevEndInstAdmitTerm", new MessageKeyInfo(ProgramProperties.get().majorDiscipline_prevEndInstAdmitTerm()), MajorProposalSummaryConfiguration.this.configurer.getModelDefinition(),false);
 88  0
                                                         workflowUtilities.updateApproveFields();
 89  0
                                                         workflowUtilities.progressiveEnableFields();        
 90  
                                                 }else{
 91  
                                                         //Ignore this field (so blanket approve works if this is a new course proposal and not modifiaction)
 92  0
                                                         workflowUtilities.addIgnoreDialogField("proposal/prevEndTerm");
 93  0
                                                         workflowUtilities.addIgnoreDialogField("proposal/prevEndProgramEntryTerm");
 94  0
                                                         workflowUtilities.addIgnoreDialogField("proposal/prevEndInstAdmitTerm");
 95  
                                                 }
 96  0
                                         }
 97  
                                         public void onRequestFail(Throwable cause) {
 98  0
                                         }
 99  
                     });
 100  
             }
 101  
             
 102  
             // Get a reference to the widget so we can add it to the root section of the screen
 103  0
             Widget widget = workflowUtilities.getWorkflowActionsWidget();
 104  
             
 105  
             // Enable widget so it is visible
 106  
             // TODO: Is this needed here or can we do this when displaying widget
 107  0
             workflowUtilities.enableWorkflowActionsWidgets(true);
 108  
             
 109  
             // Add the widget to the root section of the screen
 110  0
             rootSection.addWidget(widget); 
 111  
         }
 112  
  
 113  
         
 114  
         // Loop over all configurations in the configuration manager
 115  0
         for (Configuration configuration : configurationManager.getConfigurations()) {
 116  0
             if (configuration instanceof AbstractControllerConfiguration) {
 117  0
                 ((AbstractControllerConfiguration) configuration).setController(controller);
 118  
             }
 119  0
             rootSection.addSection((Section) configuration.getView());
 120  
         }    
 121  0
      }
 122  
 }