Coverage Report - org.kuali.student.lum.lu.ui.course.client.controllers.ViewCourseParentController
 
Classes in this File Line Coverage Branch Coverage Complexity
ViewCourseParentController
0%
0/29
0%
0/8
1.667
ViewCourseParentController$Views
0%
0/1
N/A
1.667
 
 1  
 package org.kuali.student.lum.lu.ui.course.client.controllers;
 2  
 
 3  
 import org.kuali.student.common.ui.client.application.ViewContext;
 4  
 import org.kuali.student.common.ui.client.configurable.mvc.layouts.BasicLayout;
 5  
 import org.kuali.student.common.ui.client.mvc.Callback;
 6  
 import org.kuali.student.common.ui.client.mvc.breadcrumb.BreadcrumbManager;
 7  
 import org.kuali.student.common.ui.client.mvc.history.HistoryManager;
 8  
 
 9  
 public class ViewCourseParentController extends BasicLayout{
 10  
         
 11  0
         public static enum Views{VIEW, VERSIONS}
 12  
         
 13  
         private ViewCourseController view;
 14  
         private VersionsController versions;
 15  
 
 16  
         public ViewCourseParentController() {
 17  0
                 super(ViewCourseParentController.class.toString());
 18  0
         this.setDefaultView(Views.VIEW);
 19  0
         setupDefaultView();
 20  0
     }
 21  
 
 22  
     private void setupDefaultView() {
 23  0
         view = new ViewCourseController(Views.VIEW);
 24  0
         view.setParentController(this);
 25  0
         versions = new VersionsController(Views.VERSIONS);
 26  0
         view.setParentController(this);
 27  0
         this.addView(view);
 28  0
         this.addView(versions);
 29  0
     }
 30  
         
 31  
         @Override
 32  
         public void setViewContext(ViewContext viewContext) {
 33  
                 //super.setViewContext(viewContext);
 34  0
                 view.setViewContext(viewContext);
 35  0
         }
 36  
         
 37  
         @Override
 38  
     public <V extends Enum<?>> void showView(final V viewType, final Callback<Boolean> onReadyCallback) {
 39  0
                 if(viewType == Views.VERSIONS){
 40  0
                         view.setName("");
 41  0
                         this.setName(view.getCourseTitle());
 42  0
                         versions.setVersionIndId(view.getVersionIndId());
 43  0
                         versions.setCurrentVersionId(view.getCurrentId());
 44  0
                         versions.setCurrentTitle(view.getCourseTitle());
 45  
                 }
 46  0
                 else if(viewType == Views.VIEW){
 47  0
                         view.setName(view.getCourseTitle());
 48  0
                         this.setName("");
 49  
                 }
 50  0
                 super.showView(viewType, onReadyCallback);
 51  0
     }
 52  
 
 53  
     @Override
 54  
     public Enum<?> getViewEnumValue(String enumValue) {
 55  0
         return Views.valueOf(enumValue);
 56  
     }
 57  
     
 58  
     @Override
 59  
     public void beforeShow(Callback<Boolean> onReadyCallback) {
 60  0
             if(this.getName() != null && !this.getName().equals("")){
 61  0
                     this.setName("");
 62  
             }
 63  0
             super.beforeShow(onReadyCallback);
 64  0
     }
 65  
     
 66  
 }