Clover Coverage Report - Kuali Student 1.2-M6-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Sep 12 2011 05:03:53 EDT
../../../../../../../../../img/srcFileCovDistChart0.png 42% of files have more coverage
29   122   16   1.93
2   86   0.55   15
15     1.07  
1    
 
  TabMenuController       Line # 26 29 0% 16 46 0% 0.0
 
No Tests
 
1    package org.kuali.student.common.ui.client.configurable.mvc.layouts;
2   
3    import java.util.ArrayList;
4    import java.util.List;
5   
6    import org.kuali.student.common.ui.client.configurable.mvc.LayoutController;
7    import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
8    import org.kuali.student.common.ui.client.mvc.Callback;
9    import org.kuali.student.common.ui.client.mvc.View;
10    import org.kuali.student.common.ui.client.mvc.history.HistoryManager;
11    import org.kuali.student.common.ui.client.util.ExportElement;
12    import org.kuali.student.common.ui.client.widgets.headers.KSDocumentHeader;
13    import org.kuali.student.common.ui.client.widgets.tabs.KSTabPanel;
14    import org.kuali.student.common.ui.client.widgets.tabs.KSTabPanel.TabPanelStyle;
15   
16    import com.google.gwt.user.client.ui.FlowPanel;
17    import com.google.gwt.user.client.ui.Widget;
18   
19    /**
20    * A layout controller which provides tabs for the views added through the addTab method. If the user
21    * clicks on a tab the view is swapped.
22    *
23    * @author Kuali Student Team
24    *
25    */
 
26    public class TabMenuController extends LayoutController{
27   
28    protected KSTabPanel tabPanel = new KSTabPanel(TabPanelStyle.SMALL);
29    protected FlowPanel layout = new FlowPanel();
30    protected KSDocumentHeader header = new KSDocumentHeader(false);
31   
 
32  0 toggle public TabMenuController(String controllerId) {
33  0 super();
34  0 header.addStyleName("tabLayout-ContentHeader");
35  0 layout.add(header);
36  0 header.setVisible(false);
37  0 layout.add(tabPanel);
38  0 this.initWidget(layout);
39    }
40   
41    /**
42    * Do not use in combination with setContentTitle
43    */
 
44  0 toggle public void setBasicTitle(String titleText){
45  0 layout.insert(SectionTitle.generateH1Title(titleText), 0);
46    }
47   
 
48  0 toggle public void setContentTitle(String title){
49  0 header.setTitle(title);
50  0 header.setVisible(true);
51    }
52   
 
53  0 toggle public void addContentWidget(Widget w){
54  0 header.addWidget(w);
55  0 header.setVisible(true);
56    }
57   
 
58  0 toggle public void setContentInfo(String info){
59  0 header.getInfoLabel().setHTML(info);
60  0 header.getInfoLabel().removeStyleName("content-warning");
61  0 header.getInfoLabel().addStyleName("content-info");
62    }
63   
 
64  0 toggle public void setContentWarning(String info){
65  0 header.getInfoLabel().setHTML(info);
66  0 header.getInfoLabel().removeStyleName("content-info");
67  0 header.getInfoLabel().addStyleName("content-warning");
68   
69    }
70   
 
71  0 toggle public void showPrint(boolean show){
72  0 header.showPrint(show);
73    }
74   
 
75  0 toggle public void showExport(boolean show) {
76  0 header.showExport(show);
77    }
78    /**
79    * This version of updateModel only updates from the currentView (since only one view is shown/accessed at a time).
80    * Call updateModelFromView to update from a specific view under this controller's scope.
81    */
 
82  0 toggle @Override
83    public void updateModel() {
84  0 this.updateModelFromCurrentView();
85    }
86   
 
87  0 toggle @Override
88    protected void hideView(View view) {
89    //Dont need to do anything special here
90    }
91   
 
92  0 toggle @Override
93    protected void renderView(View view) {
94    //tabPanel.selectTab(view.getViewEnum().toString());
95    }
96   
 
97  0 toggle @Override
98    public void showDefaultView(Callback<Boolean> onReadyCallback) {
99  0 super.showDefaultView(onReadyCallback);
100  0 if(this.defaultView != null){
101  0 tabPanel.selectTab(this.defaultView.toString());
102    }
103    }
104   
 
105  0 toggle public void addTab(final View view, String tabName){
106  0 super.addView(view);
107  0 tabPanel.addTab(view.getViewEnum().toString(), tabName, view.asWidget());
108  0 tabPanel.addTabCustomCallback(view.getViewEnum().toString(), new Callback<String>(){
 
109  0 toggle @Override
110    public void exec(String result) {
111  0 HistoryManager.setLogNavigationHistory(false);
112  0 showView(view.getViewEnum());
113    }
114    });
115    }
116   
 
117  0 toggle @Override
118    public List<ExportElement> getExportElementsFromView() {
119  0 return super.getExportElementsFromView();
120   
121    }
122    }