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.CurriculumHomeController; |
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 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
public class HomeController extends LayoutController{ |
21 | |
|
22 | |
private final CurriculumHomeController curriculumHomeView; |
23 | 0 | private final HomeView defaultView = new HomeView(this, HomeViews.DEFAULT); |
24 | 0 | private final AcknowledgeView ackView = new AcknowledgeView(this, HomeViews.ACKNOWLEDGEMENTS); |
25 | 0 | private SpanPanel panel = new SpanPanel(); |
26 | |
|
27 | 0 | public enum HomeViews{DEFAULT, CURRICULUM_HOME, ACKNOWLEDGEMENTS} |
28 | |
|
29 | |
public HomeController(Controller controller, String name, Enum<?> viewType) { |
30 | 0 | super(HomeController.class.getName()); |
31 | 0 | super.setController(controller); |
32 | 0 | super.setName(name); |
33 | 0 | super.setViewEnum(viewType); |
34 | 0 | this.initWidget(panel); |
35 | |
|
36 | 0 | curriculumHomeView = new CurriculumHomeController(this, "Curriculum Management", HomeViews.CURRICULUM_HOME); |
37 | 0 | setupViews(); |
38 | 0 | } |
39 | |
|
40 | |
private void setupViews(){ |
41 | 0 | this.addView(defaultView); |
42 | 0 | this.addView(curriculumHomeView); |
43 | 0 | this.addView(ackView); |
44 | 0 | } |
45 | |
|
46 | |
@Override |
47 | |
public void updateModel() { |
48 | |
|
49 | 0 | } |
50 | |
|
51 | |
@Override |
52 | |
protected void hideView(View view) { |
53 | 0 | ApplicationController.getApplicationViewContainer().clear(); |
54 | 0 | } |
55 | |
|
56 | |
@Override |
57 | |
protected void renderView(View view) { |
58 | 0 | ApplicationController.getApplicationViewContainer().add(view.asWidget()); |
59 | 0 | } |
60 | |
|
61 | |
public <V extends Enum<?>> void showView(V viewType, Callback<Boolean> onReadyCallback) { |
62 | 0 | if(viewType == HomeViews.DEFAULT){ |
63 | 0 | WindowTitleUtils.setContextTitle(name); |
64 | |
} |
65 | 0 | super.showView(viewType, onReadyCallback); |
66 | 0 | }; |
67 | |
} |