1 | |
package org.kuali.student.lum.program.client.core; |
2 | |
|
3 | |
import com.google.gwt.event.shared.HandlerManager; |
4 | |
import org.kuali.student.common.ui.client.application.ViewContext; |
5 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
6 | |
import org.kuali.student.lum.program.client.core.edit.CoreEditController; |
7 | |
import org.kuali.student.lum.program.client.core.view.CoreViewController; |
8 | |
import org.kuali.student.lum.program.client.events.ProgramViewEvent; |
9 | |
import org.kuali.student.lum.program.client.versions.ProgramVersionsController; |
10 | |
import org.kuali.student.lum.program.client.widgets.ProgramSideBar; |
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
public class CoreManager { |
16 | |
|
17 | |
private CoreViewController viewController; |
18 | |
|
19 | |
private CoreEditController editController; |
20 | |
|
21 | |
private ProgramVersionsController programVersionsController; |
22 | |
|
23 | |
protected DataModel model; |
24 | |
|
25 | 0 | private ViewContext viewContext = new ViewContext(); |
26 | |
|
27 | |
private static HandlerManager eventBus; |
28 | |
|
29 | 0 | public CoreManager() { |
30 | 0 | eventBus = new HandlerManager(null); |
31 | 0 | model = new DataModel(); |
32 | 0 | } |
33 | |
|
34 | |
public CoreViewController getViewController() { |
35 | 0 | model.resetRoot(); |
36 | 0 | if (viewController == null) { |
37 | 0 | viewController = new CoreViewController(model, viewContext, eventBus); |
38 | |
} |
39 | 0 | eventBus.fireEvent(new ProgramViewEvent()); |
40 | 0 | return viewController; |
41 | |
} |
42 | |
|
43 | |
public CoreEditController getEditController() { |
44 | 0 | model.resetRoot(); |
45 | 0 | if (editController == null) { |
46 | 0 | editController = new CoreEditController(model, viewContext, eventBus); |
47 | |
} |
48 | 0 | return editController; |
49 | |
} |
50 | |
|
51 | |
public ProgramVersionsController getProgramVersionsController() { |
52 | 0 | if (programVersionsController == null) { |
53 | 0 | programVersionsController = new ProgramVersionsController(model, ProgramSideBar.Type.CORE, viewContext, eventBus); |
54 | |
} |
55 | 0 | return programVersionsController; |
56 | |
} |
57 | |
|
58 | |
public static HandlerManager getEventBus() { |
59 | 0 | return eventBus; |
60 | |
} |
61 | |
} |