Coverage Report - org.kuali.student.lum.lu.ui.main.client.controllers.HomeController
 
Classes in this File Line Coverage Branch Coverage Complexity
HomeController
0%
0/38
0%
0/2
1.111
HomeController$HomeViews
0%
0/1
N/A
1.111
 
 1  
 package org.kuali.student.lum.lu.ui.main.client.controllers;
 2  
 
 3  
 import org.kuali.student.common.ui.client.configurable.mvc.LayoutController;
 4  
 import org.kuali.student.common.ui.client.mvc.Callback;
 5  
 import org.kuali.student.common.ui.client.mvc.Controller;
 6  
 import org.kuali.student.common.ui.client.mvc.View;
 7  
 import org.kuali.student.common.ui.client.util.WindowTitleUtils;
 8  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel;
 9  
 import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController;
 10  
 import org.kuali.student.lum.lu.ui.main.client.configuration.AcknowledgeView;
 11  
 import org.kuali.student.lum.lu.ui.main.client.views.HomeView;
 12  
 
 13  
 import com.google.gwt.core.client.GWT;
 14  
 
 15  
 /**
 16  
  * Home controller for the LUM Application, controls its default view, the curriculum home view, and the
 17  
  * Acknowledgments view page.
 18  
  * 
 19  
  * @author Kuali Student Team
 20  
  * @see HomeView
 21  
  */
 22  
 public class HomeController extends LayoutController{
 23  
         
 24  0
         private final CurriculumHomeController curriculumHomeView = GWT.create(CurriculumHomeController.class);
 25  0
         private final HomeView defaultView = new HomeView(this, HomeViews.DEFAULT);
 26  0
         private final AcknowledgeView ackView = new AcknowledgeView(this, HomeViews.ACKNOWLEDGEMENTS);
 27  0
         private SpanPanel panel = new SpanPanel();
 28  
         
 29  0
         public enum HomeViews{DEFAULT, CURRICULUM_HOME, ACKNOWLEDGEMENTS}
 30  
     
 31  0
         public HomeController() {
 32  
                 
 33  0
         }
 34  
         
 35  
         public HomeController(Controller controller, String name, Enum<?> viewType) {
 36  0
                 super();
 37  0
                 super.setController(controller);
 38  0
                 super.setName(name);
 39  0
                 super.setViewEnum(viewType);
 40  0
                 this.initWidget(panel);
 41  
                 
 42  0
                 initCirriculumHomeView(this, "Curriculum Management", HomeViews.CURRICULUM_HOME);
 43  0
                 setupViews();
 44  0
         }
 45  
         
 46  
         public void init(Controller controller, String name, Enum<?> viewType) {
 47  0
                 super.setController(controller);
 48  0
                 super.setName(name);
 49  0
                 super.setViewEnum(viewType);
 50  0
                 this.initWidget(panel);
 51  
                 
 52  0
                 initCirriculumHomeView(this, "Curriculum Management", HomeViews.CURRICULUM_HOME);
 53  0
                 setupViews();
 54  0
         }
 55  
         
 56  
         private void initCirriculumHomeView(Controller controller, String name, Enum<?> viewType){
 57  0
                 curriculumHomeView.setController(controller);
 58  0
                 curriculumHomeView.setName(name);
 59  0
         curriculumHomeView.setViewEnum(viewType);
 60  
         
 61  0
         }
 62  
         
 63  
         private void setupViews(){
 64  0
                 this.addView(defaultView);
 65  0
                 this.addView(curriculumHomeView);
 66  0
                 this.addView(ackView);
 67  0
         }
 68  
 
 69  
         @Override
 70  
         public void updateModel() {
 71  
                 //Does nothing, no model needed here
 72  0
         }
 73  
 
 74  
         @Override
 75  
         protected void hideView(View view) {
 76  0
                 ApplicationController.getApplicationViewContainer().clear();
 77  0
         }
 78  
 
 79  
         @Override
 80  
         protected void renderView(View view) {
 81  0
                 ApplicationController.getApplicationViewContainer().add(view.asWidget());
 82  0
         }
 83  
         
 84  
     public <V extends Enum<?>> void showView(V viewType, Callback<Boolean> onReadyCallback) {
 85  0
             if(viewType == HomeViews.DEFAULT){
 86  0
                     WindowTitleUtils.setContextTitle(name);
 87  
             }
 88  0
             super.showView(viewType, onReadyCallback);
 89  0
     };
 90  
     
 91  
 }