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