1 package org.kuali.student.lum.lu.ui.main.client.controllers;
2
3 import org.kuali.student.common.ui.client.application.Application;
4 import org.kuali.student.common.ui.client.configurable.mvc.LayoutController;
5 import org.kuali.student.common.ui.client.mvc.Callback;
6 import org.kuali.student.common.ui.client.mvc.Controller;
7 import org.kuali.student.common.ui.client.mvc.View;
8 import org.kuali.student.common.ui.client.util.WindowTitleUtils;
9 import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel;
10 import org.kuali.student.lum.lu.ui.main.client.configuration.AcknowledgeView;
11 import org.kuali.student.lum.lu.ui.main.client.views.HomeView;
12
13 import com.google.gwt.core.client.GWT;
14
15
16
17
18
19
20
21
22 public class HomeController extends LayoutController{
23
24 private final CurriculumHomeController curriculumHomeView = GWT.create(CurriculumHomeController.class);
25 private final HomeView defaultView = new HomeView(this, HomeViews.DEFAULT);
26 private final AcknowledgeView ackView = new AcknowledgeView(this, HomeViews.ACKNOWLEDGEMENTS);
27 private SpanPanel panel = new SpanPanel();
28
29 public enum HomeViews{DEFAULT, CURRICULUM_HOME, ACKNOWLEDGEMENTS}
30
31 public HomeController() {
32
33 }
34
35 public HomeController(Controller controller, String name, Enum<?> viewType) {
36 super();
37 super.setController(controller);
38 super.setName(name);
39 super.setViewEnum(viewType);
40 this.initWidget(panel);
41
42 initCirriculumHomeView(this, Application.getApplicationContext().getUILabel("common",
43 "curriculumManagementTitle"), HomeViews.CURRICULUM_HOME);
44 setupViews();
45 }
46
47 public void init(Controller controller, String name, Enum<?> viewType) {
48 super.setController(controller);
49 super.setName(name);
50 super.setViewEnum(viewType);
51 this.initWidget(panel);
52
53 initCirriculumHomeView(this, Application.getApplicationContext().getUILabel("common",
54 "curriculumManagementTitle"), HomeViews.CURRICULUM_HOME);
55 setupViews();
56 }
57
58 private void initCirriculumHomeView(Controller controller, String name, Enum<?> viewType){
59 curriculumHomeView.setController(controller);
60 curriculumHomeView.setName(name);
61 curriculumHomeView.setViewEnum(viewType);
62
63 }
64
65 private void setupViews(){
66 this.addView(defaultView);
67 this.addView(curriculumHomeView);
68 this.addView(ackView);
69 }
70
71 @Override
72 public void updateModel() {
73
74 }
75
76 @Override
77 protected void hideView(View view) {
78 ApplicationController.getApplicationViewContainer().clear();
79 }
80
81 @Override
82 protected void renderView(View view) {
83 ApplicationController.getApplicationViewContainer().add(view.asWidget());
84 }
85
86 public <V extends Enum<?>> void showView(V viewType, Callback<Boolean> onReadyCallback) {
87 if(viewType == HomeViews.DEFAULT){
88 WindowTitleUtils.setContextTitle(name);
89 }
90 super.showView(viewType, onReadyCallback);
91 };
92
93 }