Coverage Report - org.kuali.student.lum.lu.ui.main.client.controllers.ApplicationController
 
Classes in this File Line Coverage Branch Coverage Complexity
ApplicationController
0%
0/30
0%
0/2
1.1
ApplicationController$1
0%
0/3
N/A
1.1
ApplicationController$AppViews
0%
0/1
N/A
1.1
 
 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.mvc.events.LogoutEvent;
 8  
 import org.kuali.student.common.ui.client.mvc.events.LogoutHandler;
 9  
 import org.kuali.student.common.ui.client.widgets.KSFooter;
 10  
 
 11  
 import com.google.gwt.user.client.Window;
 12  
 import com.google.gwt.user.client.ui.ComplexPanel;
 13  
 import com.google.gwt.user.client.ui.FlowPanel;
 14  
 import com.google.gwt.user.client.ui.Widget;
 15  
 
 16  
 public class ApplicationController extends LayoutController{
 17  
 
 18  0
         public static enum AppViews{HOME}
 19  
         
 20  0
         public static FlowPanel contentPanel = new FlowPanel();
 21  0
         public FlowPanel container = new FlowPanel();
 22  
         
 23  
         public ApplicationController(String controllerId, Widget header) {
 24  0
                 super(controllerId);
 25  0
                 this.init(header);
 26  0
                 this.setupViews();
 27  0
                 this.addHandlers();
 28  0
         }
 29  
         
 30  
         private void init(Widget header){
 31  0
                 container.add(header);
 32  0
                 container.add(contentPanel);
 33  0
                 contentPanel.addStyleName("app-content");
 34  0
                 container.addStyleName("app-wrap");
 35  0
                 this.initWidget(container);
 36  0
         }
 37  
         
 38  
         private void addHandlers(){
 39  0
                 addApplicationEventHandler(LogoutEvent.TYPE, new LogoutHandler() {
 40  
                         public void onLogout(LogoutEvent event) {
 41  0
                                 Window.Location.assign("/j_spring_security_logout");
 42  0
                         }
 43  
                 });
 44  0
         }
 45  
         
 46  
         private void setupViews(){
 47  
                 //if a configurer pattern makes sense here this is where it would be called
 48  0
                 HomeController home = new HomeController(this, "Home", 
 49  
                                 AppViews.HOME);
 50  0
                 this.addView(home);
 51  0
                 this.setDefaultView(AppViews.HOME);
 52  0
         }
 53  
 
 54  
         @Override
 55  
         public void updateModel() {
 56  
                 //Does nothing, no model needed here
 57  0
         }
 58  
 
 59  
         @Override
 60  
         protected void hideView(View view) {
 61  0
                 contentPanel.clear();
 62  0
         }
 63  
 
 64  
         @Override
 65  
         protected void renderView(View view) {
 66  0
                 contentPanel.add(view.asWidget());
 67  0
         }
 68  
         
 69  
         public static ComplexPanel getApplicationViewContainer(){
 70  0
                 return contentPanel;
 71  
         }
 72  
         
 73  
         @Override
 74  
         public void showDefaultView(Callback<Boolean> onReadyCallback) {
 75  0
                 super.showView(AppViews.HOME);
 76  0
                 if(this.getCurrentView() instanceof Controller){
 77  0
                         ((Controller) this.getCurrentView()).showDefaultView(onReadyCallback);
 78  
                 }
 79  
                 else{
 80  0
                         onReadyCallback.exec(true);
 81  
                 }
 82  0
         }
 83  
 }