1 package org.kuali.student.lum.lu.ui.main.client.controllers;
2
3 import org.kuali.student.common.ui.client.configurable.mvc.LayoutController;
4 import org.kuali.student.common.ui.client.mvc.Callback;
5 import org.kuali.student.common.ui.client.mvc.Controller;
6 import org.kuali.student.common.ui.client.mvc.View;
7 import org.kuali.student.common.ui.client.util.WindowTitleUtils;
8 import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel;
9 import org.kuali.student.lum.lu.ui.course.client.controllers.CourseProposalController;
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, "Curriculum Management", HomeViews.CURRICULUM_HOME);
43 setupViews();
44 }
45
46 public void init(Controller controller, String name, Enum<?> viewType) {
47 super.setController(controller);
48 super.setName(name);
49 super.setViewEnum(viewType);
50 this.initWidget(panel);
51
52 initCirriculumHomeView(this, "Curriculum Management", HomeViews.CURRICULUM_HOME);
53 setupViews();
54 }
55
56 private void initCirriculumHomeView(Controller controller, String name, Enum<?> viewType){
57 curriculumHomeView.setController(controller);
58 curriculumHomeView.setName(name);
59 curriculumHomeView.setViewEnum(viewType);
60
61 }
62
63 private void setupViews(){
64 this.addView(defaultView);
65 this.addView(curriculumHomeView);
66 this.addView(ackView);
67 }
68
69 @Override
70 public void updateModel() {
71
72 }
73
74 @Override
75 protected void hideView(View view) {
76 ApplicationController.getApplicationViewContainer().clear();
77 }
78
79 @Override
80 protected void renderView(View view) {
81 ApplicationController.getApplicationViewContainer().add(view.asWidget());
82 }
83
84 public <V extends Enum<?>> void showView(V viewType, Callback<Boolean> onReadyCallback) {
85 if(viewType == HomeViews.DEFAULT){
86 WindowTitleUtils.setContextTitle(name);
87 }
88 super.showView(viewType, onReadyCallback);
89 };
90
91 }