Coverage Report - org.kuali.student.common.ui.client.configurable.mvc.layouts.TabMenuController
 
Classes in this File Line Coverage Branch Coverage Complexity
TabMenuController
0%
0/40
0%
0/2
1.077
TabMenuController$1
0%
0/4
N/A
1.077
 
 1  
 package org.kuali.student.common.ui.client.configurable.mvc.layouts;
 2  
 
 3  
 import org.kuali.student.common.ui.client.configurable.mvc.LayoutController;
 4  
 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
 5  
 import org.kuali.student.common.ui.client.mvc.Callback;
 6  
 import org.kuali.student.common.ui.client.mvc.View;
 7  
 import org.kuali.student.common.ui.client.mvc.history.HistoryManager;
 8  
 import org.kuali.student.common.ui.client.widgets.headers.KSDocumentHeader;
 9  
 import org.kuali.student.common.ui.client.widgets.tabs.KSTabPanel;
 10  
 import org.kuali.student.common.ui.client.widgets.tabs.KSTabPanel.TabPanelStyle;
 11  
 
 12  
 import com.google.gwt.user.client.ui.FlowPanel;
 13  
 import com.google.gwt.user.client.ui.Widget;
 14  
 
 15  
 public class TabMenuController extends LayoutController{
 16  
 
 17  0
         protected KSTabPanel tabPanel = new KSTabPanel(TabPanelStyle.SMALL);
 18  0
         protected FlowPanel layout = new FlowPanel();
 19  0
         protected KSDocumentHeader header = new KSDocumentHeader(false);
 20  
         
 21  
         public TabMenuController(String controllerId) {
 22  0
                 super(controllerId);
 23  0
                 header.addStyleName("tabLayout-ContentHeader");
 24  0
                 layout.add(header);
 25  0
                 header.setVisible(false);
 26  0
                 layout.add(tabPanel);
 27  0
                 this.initWidget(layout);
 28  0
         }
 29  
         
 30  
         /**
 31  
          * Do not use in combination with setContentTitle
 32  
          */
 33  
         public void setBasicTitle(String titleText){
 34  0
                 layout.insert(SectionTitle.generateH1Title(titleText), 0);
 35  0
         }
 36  
         
 37  
     public void setContentTitle(String title){
 38  0
         header.setTitle(title);
 39  0
         header.setVisible(true);
 40  0
     }
 41  
 
 42  
     public void addContentWidget(Widget w){
 43  0
         header.addWidget(w);
 44  0
         header.setVisible(true);
 45  0
     }
 46  
 
 47  
     public void setContentInfo(String info){
 48  0
         header.getInfoLabel().setHTML(info);
 49  0
         header.getInfoLabel().removeStyleName("content-warning");
 50  0
         header.getInfoLabel().addStyleName("content-info");
 51  0
     }
 52  
 
 53  
     public void setContentWarning(String info){
 54  0
         header.getInfoLabel().setHTML(info);
 55  0
         header.getInfoLabel().removeStyleName("content-info");
 56  0
         header.getInfoLabel().addStyleName("content-warning");
 57  
 
 58  0
     }
 59  
     
 60  
     public void showPrint(boolean show){
 61  0
             header.showPrint(show);
 62  0
     }
 63  
 
 64  
         /** 
 65  
          * This version of updateModel only updates from the currentView (since only one view is shown/accessed at a time).  
 66  
          * Call updateModelFromView to update from a specific view under this controller's scope.
 67  
          */
 68  
         @Override
 69  
         public void updateModel() {
 70  0
                 this.updateModelFromCurrentView();
 71  0
         }
 72  
 
 73  
         @Override
 74  
         protected void hideView(View view) {
 75  
                 //Dont need to do anything special here
 76  0
         }
 77  
 
 78  
         @Override
 79  
         protected void renderView(View view) {
 80  
                 //tabPanel.selectTab(view.getViewEnum().toString());
 81  0
         }
 82  
         
 83  
         @Override
 84  
         public void showDefaultView(Callback<Boolean> onReadyCallback) {
 85  0
                 super.showDefaultView(onReadyCallback);
 86  0
                 if(this.defaultView != null){
 87  0
                         tabPanel.selectTab(this.defaultView.toString());
 88  
                 }
 89  0
         }
 90  
         
 91  
         public void addTab(final View view, String tabName){
 92  0
                 super.addView(view);
 93  0
                 tabPanel.addTab(view.getViewEnum().toString(), tabName, view.asWidget());
 94  0
                 tabPanel.addTabCustomCallback(view.getViewEnum().toString(), new Callback<String>(){
 95  
                         @Override
 96  
                         public void exec(String result) {
 97  0
                                 HistoryManager.setLogNavigationHistory(false);
 98  0
                                 showView(view.getViewEnum());
 99  0
                         }
 100  
                 });
 101  0
         }
 102  
 
 103  
 }