| 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 |  |   | 
  | 16 |  |   | 
  | 17 |  |   | 
  | 18 |  |   | 
  | 19 |  |   | 
  | 20 |  |   | 
  | 21 |  |   | 
  | 22 |  |  public class TabMenuController extends LayoutController{ | 
  | 23 |  |   | 
  | 24 | 0 |          protected KSTabPanel tabPanel = new KSTabPanel(TabPanelStyle.SMALL); | 
  | 25 | 0 |          protected FlowPanel layout = new FlowPanel(); | 
  | 26 | 0 |          protected KSDocumentHeader header = new KSDocumentHeader(false); | 
  | 27 |  |           | 
  | 28 |  |          public TabMenuController(String controllerId) { | 
  | 29 | 0 |                  super(controllerId); | 
  | 30 | 0 |                  header.addStyleName("tabLayout-ContentHeader"); | 
  | 31 | 0 |                  layout.add(header); | 
  | 32 | 0 |                  header.setVisible(false); | 
  | 33 | 0 |                  layout.add(tabPanel); | 
  | 34 | 0 |                  this.initWidget(layout); | 
  | 35 | 0 |          } | 
  | 36 |  |           | 
  | 37 |  |           | 
  | 38 |  |   | 
  | 39 |  |   | 
  | 40 |  |          public void setBasicTitle(String titleText){ | 
  | 41 | 0 |                  layout.insert(SectionTitle.generateH1Title(titleText), 0); | 
  | 42 | 0 |          } | 
  | 43 |  |           | 
  | 44 |  |      public void setContentTitle(String title){ | 
  | 45 | 0 |          header.setTitle(title); | 
  | 46 | 0 |          header.setVisible(true); | 
  | 47 | 0 |      } | 
  | 48 |  |   | 
  | 49 |  |      public void addContentWidget(Widget w){ | 
  | 50 | 0 |          header.addWidget(w); | 
  | 51 | 0 |          header.setVisible(true); | 
  | 52 | 0 |      } | 
  | 53 |  |   | 
  | 54 |  |      public void setContentInfo(String info){ | 
  | 55 | 0 |          header.getInfoLabel().setHTML(info); | 
  | 56 | 0 |          header.getInfoLabel().removeStyleName("content-warning"); | 
  | 57 | 0 |          header.getInfoLabel().addStyleName("content-info"); | 
  | 58 | 0 |      } | 
  | 59 |  |   | 
  | 60 |  |      public void setContentWarning(String info){ | 
  | 61 | 0 |          header.getInfoLabel().setHTML(info); | 
  | 62 | 0 |          header.getInfoLabel().removeStyleName("content-info"); | 
  | 63 | 0 |          header.getInfoLabel().addStyleName("content-warning"); | 
  | 64 |  |   | 
  | 65 | 0 |      } | 
  | 66 |  |       | 
  | 67 |  |      public void showPrint(boolean show){ | 
  | 68 | 0 |              header.showPrint(show); | 
  | 69 | 0 |      } | 
  | 70 |  |   | 
  | 71 |  |           | 
  | 72 |  |   | 
  | 73 |  |   | 
  | 74 |  |   | 
  | 75 |  |          @Override | 
  | 76 |  |          public void updateModel() { | 
  | 77 | 0 |                  this.updateModelFromCurrentView(); | 
  | 78 | 0 |          } | 
  | 79 |  |   | 
  | 80 |  |          @Override | 
  | 81 |  |          protected void hideView(View view) { | 
  | 82 |  |                   | 
  | 83 | 0 |          } | 
  | 84 |  |   | 
  | 85 |  |          @Override | 
  | 86 |  |          protected void renderView(View view) { | 
  | 87 |  |                   | 
  | 88 | 0 |          } | 
  | 89 |  |           | 
  | 90 |  |          @Override | 
  | 91 |  |          public void showDefaultView(Callback<Boolean> onReadyCallback) { | 
  | 92 | 0 |                  super.showDefaultView(onReadyCallback); | 
  | 93 | 0 |                  if(this.defaultView != null){ | 
  | 94 | 0 |                          tabPanel.selectTab(this.defaultView.toString()); | 
  | 95 |  |                  } | 
  | 96 | 0 |          } | 
  | 97 |  |           | 
  | 98 |  |          public void addTab(final View view, String tabName){ | 
  | 99 | 0 |                  super.addView(view); | 
  | 100 | 0 |                  tabPanel.addTab(view.getViewEnum().toString(), tabName, view.asWidget()); | 
  | 101 | 0 |                  tabPanel.addTabCustomCallback(view.getViewEnum().toString(), new Callback<String>(){ | 
  | 102 |  |                          @Override | 
  | 103 |  |                          public void exec(String result) { | 
  | 104 | 0 |                                  HistoryManager.setLogNavigationHistory(false); | 
  | 105 | 0 |                                  showView(view.getViewEnum()); | 
  | 106 | 0 |                          } | 
  | 107 |  |                  }); | 
  | 108 | 0 |          } | 
  | 109 |  |   | 
  | 110 |  |  } |