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