| 1 |  |  package org.kuali.student.common.ui.client.configurable.mvc.layouts; | 
  | 2 |  |   | 
  | 3 |  |  import java.util.List; | 
  | 4 |  |   | 
  | 5 |  |  import org.kuali.student.common.ui.client.configurable.mvc.LayoutController; | 
  | 6 |  |  import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; | 
  | 7 |  |  import org.kuali.student.common.ui.client.mvc.Callback; | 
  | 8 |  |  import org.kuali.student.common.ui.client.mvc.View; | 
  | 9 |  |  import org.kuali.student.common.ui.client.mvc.history.HistoryManager; | 
  | 10 |  |  import org.kuali.student.common.ui.client.util.ExportElement; | 
  | 11 |  |  import org.kuali.student.common.ui.client.widgets.headers.KSDocumentHeader; | 
  | 12 |  |  import org.kuali.student.common.ui.client.widgets.tabs.KSTabPanel; | 
  | 13 |  |  import org.kuali.student.common.ui.client.widgets.tabs.KSTabPanel.TabPanelStyle; | 
  | 14 |  |   | 
  | 15 |  |  import com.google.gwt.user.client.ui.FlowPanel; | 
  | 16 |  |  import com.google.gwt.user.client.ui.Widget; | 
  | 17 |  |   | 
  | 18 |  |   | 
  | 19 |  |   | 
  | 20 |  |   | 
  | 21 |  |   | 
  | 22 |  |   | 
  | 23 |  |   | 
  | 24 |  |   | 
  | 25 |  |  public class TabMenuController extends LayoutController{ | 
  | 26 |  |   | 
  | 27 | 0 |          protected KSTabPanel tabPanel = new KSTabPanel(TabPanelStyle.SMALL); | 
  | 28 | 0 |          protected FlowPanel layout = new FlowPanel(); | 
  | 29 | 0 |          protected KSDocumentHeader header = new KSDocumentHeader(false); | 
  | 30 |  |           | 
  | 31 |  |          public TabMenuController(String controllerId) { | 
  | 32 | 0 |                  super(); | 
  | 33 | 0 |                  header.addStyleName("tabLayout-ContentHeader"); | 
  | 34 | 0 |                  layout.add(header); | 
  | 35 | 0 |                  header.setVisible(false); | 
  | 36 | 0 |                  layout.add(tabPanel); | 
  | 37 | 0 |                  this.initWidget(layout); | 
  | 38 | 0 |          } | 
  | 39 |  |           | 
  | 40 |  |           | 
  | 41 |  |   | 
  | 42 |  |   | 
  | 43 |  |          public void setBasicTitle(String titleText){ | 
  | 44 | 0 |                  layout.insert(SectionTitle.generateH1Title(titleText), 0); | 
  | 45 | 0 |          } | 
  | 46 |  |           | 
  | 47 |  |      public void setContentTitle(String title){ | 
  | 48 | 0 |          header.setTitle(title); | 
  | 49 | 0 |          header.setVisible(true); | 
  | 50 | 0 |      } | 
  | 51 |  |   | 
  | 52 |  |      public void addContentWidget(Widget w){ | 
  | 53 | 0 |          header.addWidget(w); | 
  | 54 | 0 |          header.setVisible(true); | 
  | 55 | 0 |      } | 
  | 56 |  |   | 
  | 57 |  |      public void setContentInfo(String info){ | 
  | 58 | 0 |          header.getInfoLabel().setHTML(info); | 
  | 59 | 0 |          header.getInfoLabel().removeStyleName("content-warning"); | 
  | 60 | 0 |          header.getInfoLabel().addStyleName("content-info"); | 
  | 61 | 0 |      } | 
  | 62 |  |   | 
  | 63 |  |      public void setContentWarning(String info){ | 
  | 64 | 0 |          header.getInfoLabel().setHTML(info); | 
  | 65 | 0 |          header.getInfoLabel().removeStyleName("content-info"); | 
  | 66 | 0 |          header.getInfoLabel().addStyleName("content-warning"); | 
  | 67 |  |   | 
  | 68 | 0 |      } | 
  | 69 |  |       | 
  | 70 |  |      public void showPrint(boolean show){ | 
  | 71 | 0 |              header.showPrint(show); | 
  | 72 | 0 |      } | 
  | 73 |  |   | 
  | 74 |  |      public void showExport(boolean show) { | 
  | 75 | 0 |          header.showExport(show); | 
  | 76 | 0 |      } | 
  | 77 |  |           | 
  | 78 |  |   | 
  | 79 |  |   | 
  | 80 |  |   | 
  | 81 |  |          @Override | 
  | 82 |  |          public void updateModel() { | 
  | 83 | 0 |                  this.updateModelFromCurrentView(); | 
  | 84 | 0 |          } | 
  | 85 |  |   | 
  | 86 |  |          @Override | 
  | 87 |  |          protected void hideView(View view) { | 
  | 88 |  |                   | 
  | 89 | 0 |          } | 
  | 90 |  |   | 
  | 91 |  |          @Override | 
  | 92 |  |          protected void renderView(View view) { | 
  | 93 |  |                   | 
  | 94 | 0 |          } | 
  | 95 |  |           | 
  | 96 |  |          @Override | 
  | 97 |  |          public void showDefaultView(Callback<Boolean> onReadyCallback) { | 
  | 98 | 0 |                  super.showDefaultView(onReadyCallback); | 
  | 99 | 0 |                  if(this.defaultView != null){ | 
  | 100 | 0 |                          tabPanel.selectTab(this.defaultView.toString()); | 
  | 101 |  |                  } | 
  | 102 | 0 |          } | 
  | 103 |  |           | 
  | 104 |  |          public void addTab(final View view, String tabName){ | 
  | 105 | 0 |                  super.addView(view); | 
  | 106 | 0 |                  tabPanel.addTab(view.getViewEnum().toString(), tabName, view.asWidget()); | 
  | 107 | 0 |                  tabPanel.addTabCustomCallback(view.getViewEnum().toString(), new Callback<String>(){ | 
  | 108 |  |                          @Override | 
  | 109 |  |                          public void exec(String result) { | 
  | 110 | 0 |                                  HistoryManager.setLogNavigationHistory(false); | 
  | 111 | 0 |                                  showView(view.getViewEnum()); | 
  | 112 | 0 |                          } | 
  | 113 |  |                  }); | 
  | 114 | 0 |          } | 
  | 115 |  |   | 
  | 116 |  |      @Override | 
  | 117 |  |      public List<ExportElement> getExportElementsFromView() { | 
  | 118 | 0 |          return super.getExportElementsFromView(); | 
  | 119 |  |           | 
  | 120 |  |      } | 
  | 121 |  |  } |